TEST_F(IdfFixture, WorkspaceObject_Lights_Strictness_Draft) { Workspace workspace(StrictnessLevel::Draft,IddFileType::EnergyPlus); EXPECT_TRUE(workspace.isValid()); OptionalWorkspaceObject w = workspace.addObject(IdfObject(IddObjectType::Lights)); ASSERT_TRUE(w); OptionalWorkspaceObject light = workspace.getObject(w->handle()); ASSERT_TRUE(light); // certain things we can't invalidate EXPECT_TRUE(light->setString(LightsFields::Name, "")); EXPECT_TRUE(light->setDouble(LightsFields::Name, 0)); EXPECT_TRUE(light->setString(LightsFields::ZoneorZoneListName, "")); // PointerType error EXPECT_TRUE(light->setPointer(LightsFields::ZoneorZoneListName, Handle())); // PointerType error EXPECT_TRUE(light->setString(LightsFields::ScheduleName, "")); // PointerType error EXPECT_TRUE(light->setPointer(LightsFields::ScheduleName, Handle())); // PointerType error EXPECT_TRUE(light->setString(LightsFields::DesignLevelCalculationMethod, "")); // this is ok because there is a default EXPECT_FALSE(light->setString(LightsFields::DesignLevelCalculationMethod, "Hi")); // DataType error EXPECT_FALSE(light->setDouble(LightsFields::DesignLevelCalculationMethod, 0)); // DataType error EXPECT_FALSE(light->setString(LightsFields::LightingLevel, "Hi")); // DataType error EXPECT_FALSE(light->setDouble(LightsFields::LightingLevel, -1)); // NumericBound error EXPECT_TRUE(light->setDouble(LightsFields::LightingLevel, 0)); EXPECT_TRUE(light->setDouble(LightsFields::LightingLevel, 1)); EXPECT_TRUE(workspace.isValid(StrictnessLevel::None)); EXPECT_TRUE(workspace.isValid(StrictnessLevel::Draft)); EXPECT_FALSE(workspace.isValid(StrictnessLevel::Final)); }
TEST_F(IdfFixture, WorkspaceObject_Lights_Strictness_None) { Workspace workspace(StrictnessLevel::None,IddFileType::EnergyPlus); EXPECT_TRUE(workspace.isValid()); OptionalWorkspaceObject w = workspace.addObject(IdfObject(IddObjectType::Lights)); ASSERT_TRUE(w); OptionalWorkspaceObject light = workspace.getObject(w->handle()); ASSERT_TRUE(light); // can invalidate all we want EXPECT_TRUE(light->setString(LightsFields::Name, "")); EXPECT_TRUE(light->setDouble(LightsFields::Name, 0)); EXPECT_TRUE(light->setString(LightsFields::ZoneorZoneListName, "")); EXPECT_TRUE(light->setPointer(LightsFields::ZoneorZoneListName, Handle())); EXPECT_TRUE(light->setString(LightsFields::ScheduleName, "")); EXPECT_TRUE(light->setPointer(LightsFields::ScheduleName, Handle())); EXPECT_TRUE(light->setString(LightsFields::DesignLevelCalculationMethod, "")); EXPECT_TRUE(light->setDouble(LightsFields::DesignLevelCalculationMethod, 0)); EXPECT_TRUE(light->setString(LightsFields::LightingLevel, "Hi")); EXPECT_TRUE(light->setDouble(LightsFields::LightingLevel, -1)); EXPECT_TRUE(light->setDouble(LightsFields::LightingLevel, 0)); EXPECT_TRUE(light->setDouble(LightsFields::LightingLevel, 1)); EXPECT_TRUE(workspace.isValid(StrictnessLevel::None)); EXPECT_FALSE(workspace.isValid(StrictnessLevel::Draft)); EXPECT_FALSE(workspace.isValid(StrictnessLevel::Final)); }