コード例 #1
0
TEST_F(IddFixture,IddFactory_OpenStudioUnits_SubTest3) {
    IddObjectVector objects = IddFactory::instance().getObjects(IddFileType(IddFileType::OpenStudio));
    bool found = false;
    for (const IddObject& object : objects) {
        IddFieldVector fields = object.nonextensibleFields();
        IddFieldVector temp = object.extensibleGroup();
        fields.insert(fields.end(),temp.begin(),temp.end());
        for (const IddField& field : fields) {
            if (OptionalString iddUnits = field.properties().ipUnits) {
                if (*iddUnits == "gal/min") {
                    if (object.type() == IddObjectType::OS_AirTerminal_SingleDuct_ParallelPIU_Reheat) {
                        LOG(Debug,"Gal/min field: " << field.name());
                    }
                    found = true;
                    OptionalUnit ipUnit = field.getUnits(true);
                    ASSERT_TRUE(ipUnit);
                    EXPECT_TRUE(ipUnit->system() == UnitSystem::Mixed);
                    EXPECT_EQ("crgal^3/min",ipUnit->standardString());
                    EXPECT_EQ("gal/min",ipUnit->prettyString());
                }
            }
        }
    }
    EXPECT_TRUE(found);
}
コード例 #2
0
TEST_F(IddFixture,IddFactory_OpenStudioUnits_SubTest2) {
    IddObjectVector objects = IddFactory::instance().getObjects(IddFileType(IddFileType::OpenStudio));
    bool found = false;
    for (const IddObject& object : objects) {
        IddFieldVector fields = object.nonextensibleFields();
        IddFieldVector temp = object.extensibleGroup();
        fields.insert(fields.end(),temp.begin(),temp.end());
        for (const IddField& field : fields) {
            if (OptionalString iddUnits = field.properties().units) {
                if (*iddUnits == "kg-H2O/kg-Air") {
                    found = true;
                    OptionalUnit siUnit = field.getUnits();
                    ASSERT_TRUE(siUnit);
                    EXPECT_TRUE(siUnit->system() == UnitSystem::SI);
                    EXPECT_EQ("",siUnit->standardString());
                    EXPECT_EQ("kg_{H2O}/kg_{air}",siUnit->prettyString());
                    break;
                }
            }
        }
        if (found) {
            break;
        }
    }
    EXPECT_TRUE(found);
}