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

Function TEST_F

ruby/engine/test/RubyEngine_GTest.cpp:59–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57};
58
59TEST_F(RubyEngineFixture, BadMeasure) {
60 ::testing::FLAGS_gtest_death_test_style = "threadsafe";
61
62 ASSERT_DEATH(
63 {
64 const std::string classAndDirName = "BadMeasure";
65
66 const auto scriptPath = getScriptPath(classAndDirName);
67 auto measureScriptObject = (*thisEngine)->loadMeasure(scriptPath, classAndDirName);
68 auto* measurePtr = (*thisEngine)->getAs<openstudio::measure::ModelMeasure*>(measureScriptObject);
69
70 ASSERT_EQ(measurePtr->name(), "Bad Measure");
71
72 std::string expected_exception = fmt::format(R"(SWIG director method error. RuntimeError: oops
73
74Traceback (most recent call last):
75{0}:12:in `another_method'
76{0}:16:in `arguments')",
77 scriptPath.generic_string());
78
79 openstudio::model::Model model;
80
81 try {
82 measurePtr->arguments(model);
83 ASSERT_FALSE(true) << "Expected measure arguments(model) to throw";
84 } catch (std::exception& e) {
85 std::string error = e.what();
86 EXPECT_EQ(expected_exception, error);
87 }
88
89 thisEngine->reset();
90 },
91 "oops");
92}
93
94TEST_F(RubyEngineFixture, WrongMethodMeasure) {
95 ::testing::FLAGS_gtest_death_test_style = "threadsafe";

Callers

nothing calls this directly

Calls 5

loadMeasureMethod · 0.45
nameMethod · 0.45
argumentsMethod · 0.45
resetMethod · 0.45
hasMethodMethod · 0.45

Tested by

no test coverage detected