MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / TEST_F

Function TEST_F

src/model/test/ShadowCalculation_GTest.cpp:20–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18using namespace openstudio::model;
19
20TEST_F(ModelFixture, ShadowCalculation) {
21 Model model;
22
23 auto sc = model.getUniqueModelObject<ShadowCalculation>();
24
25 // Shading Calculation Update Frequency Method
26 EXPECT_TRUE(sc.isShadingCalculationUpdateFrequencyMethodDefaulted());
27 EXPECT_EQ("Periodic", sc.shadingCalculationUpdateFrequencyMethod());
28 EXPECT_TRUE(sc.setShadingCalculationUpdateFrequencyMethod("Timestep"));
29 EXPECT_FALSE(sc.isShadingCalculationUpdateFrequencyMethodDefaulted());
30 EXPECT_EQ("Timestep", sc.shadingCalculationUpdateFrequencyMethod());
31 EXPECT_FALSE(sc.setShadingCalculationUpdateFrequencyMethod("BADENUM"));
32 EXPECT_EQ("Timestep", sc.shadingCalculationUpdateFrequencyMethod());
33 sc.resetShadingCalculationUpdateFrequencyMethod();
34 EXPECT_TRUE(sc.isShadingCalculationUpdateFrequencyMethodDefaulted());
35 EXPECT_EQ("Periodic", sc.shadingCalculationUpdateFrequencyMethod());
36
37 // Shading Calculation Update Frequency
38 EXPECT_FALSE(sc.isShadingCalculationUpdateFrequencyDefaulted()); // set in constructor
39 EXPECT_EQ(20, sc.shadingCalculationUpdateFrequency());
40 EXPECT_TRUE(sc.setShadingCalculationUpdateFrequency(1));
41 EXPECT_EQ(1, sc.shadingCalculationUpdateFrequency());
42
43 // Maximum Figures in Shadow Overlap Calculations
44 EXPECT_FALSE(sc.isMaximumFiguresInShadowOverlapCalculationsDefaulted()); // set in constructor
45 EXPECT_EQ(15000, sc.maximumFiguresInShadowOverlapCalculations());
46 EXPECT_TRUE(sc.setMaximumFiguresInShadowOverlapCalculations(200));
47 EXPECT_EQ(200, sc.maximumFiguresInShadowOverlapCalculations());
48
49 // Polygon Clipping Algorithm
50 EXPECT_EQ("SutherlandHodgman", sc.polygonClippingAlgorithm());
51 EXPECT_TRUE(sc.setPolygonClippingAlgorithm("ConvexWeilerAtherton"));
52 EXPECT_EQ("ConvexWeilerAtherton", sc.polygonClippingAlgorithm());
53 EXPECT_FALSE(sc.setPolygonClippingAlgorithm("BADENUM"));
54 EXPECT_EQ("ConvexWeilerAtherton", sc.polygonClippingAlgorithm());
55
56 // Sky Diffuse Modeling Algorithm
57 EXPECT_EQ("SimpleSkyDiffuseModeling", sc.skyDiffuseModelingAlgorithm());
58 EXPECT_TRUE(sc.setSkyDiffuseModelingAlgorithm("DetailedSkyDiffuseModeling"));
59 EXPECT_EQ("DetailedSkyDiffuseModeling", sc.skyDiffuseModelingAlgorithm());
60 EXPECT_FALSE(sc.setSkyDiffuseModelingAlgorithm("BADENUM"));
61 EXPECT_EQ("DetailedSkyDiffuseModeling", sc.skyDiffuseModelingAlgorithm());
62
63 // NEW FIELDS: ALL REQUIRED
64
65 // Shading Calculation Method: set in Ctor
66 EXPECT_EQ("PolygonClipping", sc.shadingCalculationMethod());
67 EXPECT_TRUE(sc.setShadingCalculationMethod("PixelCounting"));
68 EXPECT_EQ("PixelCounting", sc.shadingCalculationMethod());
69 EXPECT_FALSE(sc.setShadingCalculationMethod("BADENUM"));
70 EXPECT_EQ("PixelCounting", sc.shadingCalculationMethod());
71
72 // Pixel Counting Resolution
73 EXPECT_EQ(512, sc.pixelCountingResolution());
74 EXPECT_TRUE(sc.setPixelCountingResolution(499));
75 EXPECT_EQ(499, sc.pixelCountingResolution());
76
77 // Output External Shading Calculation Results

Callers

nothing calls this directly

Tested by

no test coverage detected