GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 10 / 0 / 10
Functions: 100.0% 2 / 0 / 2
Branches: 81.8% 18 / 0 / 22

src/energyplus/ForwardTranslator/ForwardTranslatePythonPluginVariable.cpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #include "../ForwardTranslator.hpp"
7 #include "../../model/Model.hpp"
8
9 #include "../../model/PythonPluginVariable.hpp"
10
11 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
12
13 #include <utilities/idd/PythonPlugin_Variables_FieldEnums.hxx>
14 // #include "../../utilities/idd/IddEnums.hpp"
15 #include <utilities/idd/IddEnums.hxx>
16
17 #include <algorithm>
18
19 using namespace openstudio::model;
20
21 constexpr static auto pythonVariablesName = "Python Plugin Variables";
22
23 namespace openstudio {
24
25 namespace energyplus {
26
27 8 boost::optional<IdfObject> ForwardTranslator::translatePythonPluginVariable(model::PythonPluginVariable& modelObject) {
28
29 // Our objects are all translated to a single E+ PythonPlugin:Variables object which is extensible
30
31
3/3
✓ Branch 1 taken 1104 times.
✓ Branch 4 taken 1104 times.
✓ Branch 11 taken 8 times.
1112 auto it = std::find_if(m_idfObjects.begin(), m_idfObjects.end(), [](auto& idfObject) { return idfObject.nameString() == pythonVariablesName; });
32
2/2
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 4 times.
8 if (it == m_idfObjects.end()) {
33
1/1
✓ Branch 1 taken 4 times.
4 auto& pluginVariables = m_idfObjects.emplace_back(openstudio::IddObjectType::PythonPlugin_Variables);
34
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 pluginVariables.setName(pythonVariablesName);
35
4/6
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 4 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
12 pluginVariables.pushExtensibleGroup({modelObject.nameString()});
36
1/1
✓ Branch 1 taken 4 times.
4 return pluginVariables;
37 }
38
39
4/6
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 4 times.
✓ Branch 9 taken 4 times.
✓ Branch 10 taken 4 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
16 it->pushExtensibleGroup({modelObject.nameString()});
40
1/1
✓ Branch 2 taken 4 times.
4 return *it;
41 8 } // End of translate function
42
43 } // end namespace energyplus
44 } // end namespace openstudio
45