GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 26 / 0 / 26
Functions: 100.0% 1 / 0 / 1
Branches: 92.3% 48 / 0 / 52

src/energyplus/ReverseTranslator/ReverseTranslateCurveQuadratic.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 "../ReverseTranslator.hpp"
7
8 #include "../../model/CurveQuadratic.hpp"
9 #include "../../model/CurveQuadratic_Impl.hpp"
10
11 #include <utilities/idd/Curve_Quadratic_FieldEnums.hxx>
12
13 using namespace openstudio::model;
14
15 namespace openstudio {
16 namespace energyplus {
17
18 77 boost::optional<ModelObject> ReverseTranslator::translateCurveQuadratic(const WorkspaceObject& workspaceObject) {
19
1/1
✓ Branch 1 taken 77 times.
77 CurveQuadratic curve(m_model);
20
21 77 OptionalString s;
22 77 OptionalDouble d;
23
24
2/3
✓ Branch 1 taken 77 times.
✓ Branch 5 taken 77 times.
✗ Branch 6 not taken.
154 if ((s = workspaceObject.name())) {
25
2/2
✓ Branch 1 taken 77 times.
✓ Branch 4 taken 77 times.
77 curve.setName(*s);
26 }
27
28
2/3
✓ Branch 1 taken 77 times.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
154 if ((d = workspaceObject.getDouble(Curve_QuadraticFields::Coefficient1Constant))) {
29
2/2
✓ Branch 1 taken 77 times.
✓ Branch 4 taken 77 times.
77 curve.setCoefficient1Constant(*d);
30 }
31
2/3
✓ Branch 1 taken 77 times.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
154 if ((d = workspaceObject.getDouble(Curve_QuadraticFields::Coefficient2x))) {
32
2/2
✓ Branch 1 taken 77 times.
✓ Branch 4 taken 77 times.
77 curve.setCoefficient2x(*d);
33 }
34
2/3
✓ Branch 1 taken 77 times.
✓ Branch 3 taken 77 times.
✗ Branch 4 not taken.
154 if ((d = workspaceObject.getDouble(Curve_QuadraticFields::Coefficient3x_POW_2))) {
35
2/2
✓ Branch 1 taken 77 times.
✓ Branch 4 taken 77 times.
77 curve.setCoefficient3xPOW2(*d);
36 }
37
3/3
✓ Branch 1 taken 77 times.
✓ Branch 3 taken 71 times.
✓ Branch 4 taken 6 times.
154 if ((d = workspaceObject.getDouble(Curve_QuadraticFields::MinimumValueofx))) {
38
2/2
✓ Branch 1 taken 71 times.
✓ Branch 4 taken 71 times.
71 curve.setMinimumValueofx(*d);
39 }
40
3/3
✓ Branch 1 taken 77 times.
✓ Branch 3 taken 71 times.
✓ Branch 4 taken 6 times.
154 if ((d = workspaceObject.getDouble(Curve_QuadraticFields::MaximumValueofx))) {
41
2/2
✓ Branch 1 taken 71 times.
✓ Branch 4 taken 71 times.
71 curve.setMaximumValueofx(*d);
42 }
43
3/3
✓ Branch 1 taken 77 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 65 times.
154 if ((d = workspaceObject.getDouble(Curve_QuadraticFields::MinimumCurveOutput))) {
44
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 curve.setMinimumCurveOutput(*d);
45 }
46
3/3
✓ Branch 1 taken 77 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 59 times.
154 if ((d = workspaceObject.getDouble(Curve_QuadraticFields::MaximumCurveOutput))) {
47
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 curve.setMaximumCurveOutput(*d);
48 }
49
3/3
✓ Branch 1 taken 77 times.
✓ Branch 5 taken 18 times.
✓ Branch 6 taken 59 times.
154 if ((s = workspaceObject.getString(Curve_QuadraticFields::InputUnitTypeforX, false, true))) {
50
2/2
✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
18 curve.setInputUnitTypeforX(*s);
51 }
52
3/3
✓ Branch 1 taken 77 times.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 65 times.
154 if ((s = workspaceObject.getString(Curve_QuadraticFields::OutputUnitType, false, true))) {
53
2/2
✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
12 curve.setOutputUnitType(*s);
54 }
55
56
1/1
✓ Branch 1 taken 77 times.
154 return curve;
57 77 }
58
59 } // namespace energyplus
60 } // namespace openstudio
61