| 14 | using namespace openstudio::model; |
| 15 | |
| 16 | TEST_F(ModelFixture, TableIndependentVariable_GettersSetters) { |
| 17 | |
| 18 | Model m; |
| 19 | TableIndependentVariable tableIndependentVariable(m); |
| 20 | |
| 21 | // Defaults |
| 22 | EXPECT_EQ("Linear", tableIndependentVariable.interpolationMethod()); |
| 23 | EXPECT_EQ("Constant", tableIndependentVariable.extrapolationMethod()); |
| 24 | EXPECT_FALSE(tableIndependentVariable.minimumValue()); |
| 25 | EXPECT_FALSE(tableIndependentVariable.maximumValue()); |
| 26 | EXPECT_FALSE(tableIndependentVariable.normalizationReferenceValue()); |
| 27 | EXPECT_EQ("Dimensionless", tableIndependentVariable.unitType()); |
| 28 | EXPECT_EQ(0u, tableIndependentVariable.tableLookups().size()); |
| 29 | |
| 30 | // Interpolation Method: Required String |
| 31 | EXPECT_TRUE(tableIndependentVariable.setInterpolationMethod("Cubic")); |
| 32 | EXPECT_EQ("Cubic", tableIndependentVariable.interpolationMethod()); |
| 33 | // Bad Value |
| 34 | EXPECT_FALSE(tableIndependentVariable.setInterpolationMethod("BADENUM")); |
| 35 | EXPECT_EQ("Cubic", tableIndependentVariable.interpolationMethod()); |
| 36 | |
| 37 | // Extrapolation Method: Required String |
| 38 | EXPECT_TRUE(tableIndependentVariable.setExtrapolationMethod("Linear")); |
| 39 | EXPECT_EQ("Linear", tableIndependentVariable.extrapolationMethod()); |
| 40 | // Bad Value |
| 41 | EXPECT_FALSE(tableIndependentVariable.setExtrapolationMethod("BADENUM")); |
| 42 | EXPECT_EQ("Linear", tableIndependentVariable.extrapolationMethod()); |
| 43 | |
| 44 | // Minimum Value: Optional Double |
| 45 | EXPECT_TRUE(tableIndependentVariable.setMinimumValue(0.5)); |
| 46 | ASSERT_TRUE(tableIndependentVariable.minimumValue()); |
| 47 | EXPECT_EQ(0.5, tableIndependentVariable.minimumValue().get()); |
| 48 | tableIndependentVariable.resetMinimumValue(); |
| 49 | EXPECT_FALSE(tableIndependentVariable.minimumValue()); |
| 50 | |
| 51 | // Maximum Value: Optional Double |
| 52 | EXPECT_TRUE(tableIndependentVariable.setMaximumValue(0.6)); |
| 53 | ASSERT_TRUE(tableIndependentVariable.maximumValue()); |
| 54 | EXPECT_EQ(0.6, tableIndependentVariable.maximumValue().get()); |
| 55 | tableIndependentVariable.resetMaximumValue(); |
| 56 | EXPECT_FALSE(tableIndependentVariable.maximumValue()); |
| 57 | |
| 58 | // Normalization Reference Value: Optional Double |
| 59 | EXPECT_TRUE(tableIndependentVariable.setNormalizationReferenceValue(0.7)); |
| 60 | ASSERT_TRUE(tableIndependentVariable.normalizationReferenceValue()); |
| 61 | EXPECT_EQ(0.7, tableIndependentVariable.normalizationReferenceValue().get()); |
| 62 | tableIndependentVariable.resetNormalizationReferenceValue(); |
| 63 | EXPECT_FALSE(tableIndependentVariable.normalizationReferenceValue()); |
| 64 | |
| 65 | // Unit Type: Required String |
| 66 | EXPECT_TRUE(tableIndependentVariable.setUnitType("Temperature")); |
| 67 | EXPECT_EQ("Temperature", tableIndependentVariable.unitType()); |
| 68 | // Bad Value |
| 69 | EXPECT_FALSE(tableIndependentVariable.setUnitType("BADENUM")); |
| 70 | EXPECT_EQ("Temperature", tableIndependentVariable.unitType()); |
| 71 | |
| 72 | // Values |
| 73 | EXPECT_TRUE(tableIndependentVariable.addValue(1.0)); |
nothing calls this directly
no test coverage detected