コード例 #1
0
// 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);
}
コード例 #2
0
// 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));
}
コード例 #3
0
// 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() );
}
コード例 #4
0
TEST_F(IddFixture,IddFactory_IddFile)
{
    IddFile file = IddFactory::instance().getIddFile(IddFileType::OpenStudio);
    EXPECT_TRUE(file.getObject("OS:Building"));
    EXPECT_TRUE(file.getObject(IddObjectType::CommentOnly));
    EXPECT_TRUE(file.getObject(IddObjectType::OS_ClimateZones));
    // print out for visual inspection
    path outPath = resourcesPath()/toPath("utilities/RoundTrip_OpenStudio.idd");
    file.save(outPath,true);
    // check against getIddObjects
    IddObjectVector objects = IddFactory::instance().getObjects(IddFileType::OpenStudio);
    EXPECT_TRUE(file.objects().size() == objects.size());
    // required objects
    EXPECT_TRUE(file.requiredObjects().size() > 0);
    EXPECT_TRUE(file.requiredObjects().size() ==
                IddFactory::instance().getRequiredObjects(IddFileType::OpenStudio).size());
    EXPECT_TRUE(file.requiredObjects().size() <= IddFactory::instance().requiredObjects().size());
    // unique objects
    EXPECT_TRUE(file.uniqueObjects().size() > 0);
    EXPECT_TRUE(file.uniqueObjects().size() ==
                IddFactory::instance().getUniqueObjects(IddFileType::OpenStudio).size());
    EXPECT_TRUE(file.uniqueObjects().size() <= IddFactory::instance().uniqueObjects().size());

    file = IddFactory::instance().getIddFile(IddFileType::EnergyPlus);
    EXPECT_TRUE(file.getObject("Building"));
    EXPECT_TRUE(file.getObject(IddObjectType::CommentOnly));
    EXPECT_FALSE(file.getObject(IddObjectType::OS_ClimateZones));
    // print out for visual inspection
    outPath = resourcesPath()/toPath("energyplus/RoundTrip_ProposedEnergy+.idd");
    file.save(outPath,true);
    // check against getIddObjects
    objects = IddFactory::instance().getObjects(IddFileType::EnergyPlus);
    EXPECT_TRUE(file.objects().size() == objects.size());
}
コード例 #5
0
// 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());
}