// extensible object test, BuildingSurface:Detailed void IddFile_BuildingSurfaceDetailed(const IddFile& iddFile) { string objectName("BuildingSurface:Detailed"); OptionalIddObject object = iddFile.getObject(objectName); ASSERT_TRUE(object); EXPECT_TRUE(iequals(object->name(), objectName)); ASSERT_TRUE(object->nonextensibleFields().size() > 0); EXPECT_EQ(object->nonextensibleFields().size(), static_cast<unsigned int>(10)); EXPECT_FALSE(object->properties().format.empty()); EXPECT_TRUE(iequals("vertices", object->properties().format)); EXPECT_TRUE(object->properties().extensible); EXPECT_TRUE(object->properties().numExtensible); ASSERT_EQ(static_cast<unsigned int>(3), object->properties().numExtensible); EXPECT_FALSE(object->getField("Vertex 1 X-coordinate")); EXPECT_FALSE(object->getField("Vertex 1 X-coordinate")); ASSERT_TRUE(object->extensibleGroup().size() > 0); string fieldName("Vertex X-coordinate"); EXPECT_TRUE(iequals(fieldName, object->extensibleGroup().front().name() )); OptionalIddField field = object->getField(fieldName); ASSERT_TRUE(field); EXPECT_TRUE(iequals(fieldName, field->name())); EXPECT_TRUE(field->properties().beginExtensible); fieldName = "Vertex Z-coordinate"; EXPECT_TRUE(iequals(fieldName, object->extensibleGroup().back().name() )); field = object->getField(fieldName); ASSERT_TRUE(field); EXPECT_TRUE(iequals(fieldName, field->name())); EXPECT_FALSE(field->properties().beginExtensible); }
// case insensitive test void IddFile_bUiLdInG(const IddFile& iddFile) { string objectName("bUiLdInG"); OptionalIddObject object = iddFile.getObject(objectName); ASSERT_TRUE(object); EXPECT_TRUE(iequals(object->name(), objectName)); EXPECT_EQ(static_cast<unsigned int>(8),object->nonextensibleFields().size()); EXPECT_TRUE(object->properties().unique); EXPECT_TRUE(object->properties().required); string fieldName("TeRrAiN"); OptionalIddField field = object->getField(fieldName); ASSERT_TRUE(field); EXPECT_TRUE(iequals(field->name(), fieldName)); EXPECT_EQ(field->keys().size(), static_cast<unsigned int>(5) ); EXPECT_TRUE(field->properties().stringDefault); EXPECT_EQ(*(field->properties().stringDefault), "Suburbs"); EXPECT_FALSE(field->properties().numericDefault); string keyName("SuBuRbS"); OptionalIddKey key = field->getKey(keyName); ASSERT_TRUE(key); EXPECT_FALSE(equals(key->name(), keyName)); EXPECT_TRUE(iequals(key->name(), keyName)); }
// test single object, no fields void IddFile_LeadInput(const IddFile& iddFile) { string objectName("Lead Input"); OptionalIddObject object = iddFile.getObject(objectName); ASSERT_TRUE(object); EXPECT_EQ(object->name(), objectName); EXPECT_TRUE(object->nonextensibleFields().empty() ); }
// test single object, one alpha field, no keys void IddFile_Version(const IddFile& iddFile) { string objectName("Version"); OptionalIddObject object = iddFile.getObject(objectName); ASSERT_TRUE(object); EXPECT_EQ(object->name(), objectName); EXPECT_EQ(static_cast<unsigned int>(1),object->nonextensibleFields().size()); string fieldName("Version Identifier"); OptionalIddField field = object->getField(fieldName); ASSERT_TRUE(field); EXPECT_EQ(field->name(), fieldName); EXPECT_TRUE(field->keys().empty()); }