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

Function TEST_F

src/model/test/SurfacePropertyLocalEnvironment_GTest.cpp:22–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20using namespace openstudio::model;
21
22TEST_F(ModelFixture, SurfacePropertyLocalEnvironment_GettersSetters) {
23 Model m;
24
25 double w = 10.0;
26 std::vector<Point3d> points{
27 {0, 0, 0},
28 {0, w, 0},
29 {w, w, 0},
30 {w, 0, 0},
31 };
32
33 Surface surface(points, m);
34
35 SurfacePropertyLocalEnvironment surfacePropertyLocalEnvironment(surface);
36 surfacePropertyLocalEnvironment.setName("My SurfacePropertyLocalEnvironment");
37
38 // Exterior Surface Name: Required Object
39 EXPECT_EQ(surface, surfacePropertyLocalEnvironment.exteriorSurface());
40 std::vector<Point3d> points2{
41 {0, 0, 2},
42 {0, w, 2},
43 {w, w, 2},
44 {w, 0, 2},
45 };
46 Surface surface2(points2, m);
47 EXPECT_FALSE(surface2.surfacePropertyLocalEnvironment());
48
49 EXPECT_TRUE(surfacePropertyLocalEnvironment.setExteriorSurface(surface2));
50 EXPECT_EQ(surface2, surfacePropertyLocalEnvironment.exteriorSurface());
51 ASSERT_TRUE(surfacePropertyLocalEnvironment.exteriorSurfaceAsSurface());
52 EXPECT_EQ(surface2, surfacePropertyLocalEnvironment.exteriorSurfaceAsSurface().get());
53 EXPECT_FALSE(surfacePropertyLocalEnvironment.exteriorSurfaceAsSubSurface());
54
55 ASSERT_TRUE(surface2.surfacePropertyLocalEnvironment());
56 EXPECT_EQ(surfacePropertyLocalEnvironment, surface2.surfacePropertyLocalEnvironment().get());
57
58 // External Shading Fraction Schedule Name: Optional Object
59 EXPECT_FALSE(surfacePropertyLocalEnvironment.externalShadingFractionSchedule());
60 ScheduleConstant shadingSch(m);
61 EXPECT_TRUE(surfacePropertyLocalEnvironment.setExternalShadingFractionSchedule(shadingSch));
62 ASSERT_TRUE(surfacePropertyLocalEnvironment.externalShadingFractionSchedule());
63 EXPECT_EQ(shadingSch, surfacePropertyLocalEnvironment.externalShadingFractionSchedule().get());
64 surfacePropertyLocalEnvironment.resetExternalShadingFractionSchedule();
65 EXPECT_FALSE(surfacePropertyLocalEnvironment.externalShadingFractionSchedule());
66
67 // Surrounding Surfaces Object Name: Optional Object
68 {
69 EXPECT_FALSE(surfacePropertyLocalEnvironment.surfacePropertySurroundingSurfaces());
70 SurfacePropertySurroundingSurfaces sp(m);
71 EXPECT_FALSE(sp.surfacePropertyLocalEnvironment());
72
73 EXPECT_TRUE(surfacePropertyLocalEnvironment.setSurfacePropertySurroundingSurfaces(sp));
74 ASSERT_TRUE(surfacePropertyLocalEnvironment.surfacePropertySurroundingSurfaces());
75 EXPECT_EQ(sp, surfacePropertyLocalEnvironment.surfacePropertySurroundingSurfaces().get());
76
77 ASSERT_TRUE(sp.surfacePropertyLocalEnvironment());
78 EXPECT_EQ(surfacePropertyLocalEnvironment, sp.surfacePropertyLocalEnvironment().get());
79

Callers

nothing calls this directly

Tested by

no test coverage detected