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

Method run

src/measure/test/OSMeasure_GTest.cpp:59–86  ·  view source on GitHub ↗

remove all spaces and add a new one

Source from the content-addressed store, hash-verified

57
58 // remove all spaces and add a new one
59 virtual bool run(Model& model, OSRunner& runner, const std::map<std::string, OSArgument>& user_arguments) const override {
60 ModelMeasure::run(model, runner, user_arguments);
61
62 if (!runner.validateUserArguments(arguments(model), user_arguments)) {
63 return false;
64 }
65
66 std::stringstream ss;
67
68 // remove old spaces
69 int count(0);
70 for (openstudio::model::Space space : model.getConcreteModelObjects<openstudio::model::Space>()) {
71 space.remove();
72 ++count;
73 }
74 ss << "Initial model had " << count << " spaces.";
75 runner.registerInitialCondition(ss.str());
76 ss.str("");
77
78 // add a new one
79 openstudio::model::Space space(model);
80
81 ss << "Removed the " << count << " original spaces, and added one new one named '" << space.name().get() << "'.";
82 runner.registerFinalCondition(ss.str());
83
84 // success
85 return true;
86 }
87};
88
89TEST_F(MeasureFixture, UserScript_TestModelUserScript1) {

Callers 1

TEST_FFunction · 0.45

Calls 7

validateUserArgumentsMethod · 0.80
removeMethod · 0.45
strMethod · 0.45
getMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected