GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 82.6% 19 / 0 / 23
Functions: 100.0% 1 / 0 / 1
Branches: 68.3% 28 / 0 / 41

src/energyplus/ForwardTranslator/ForwardTranslateCurveCubic.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
8 #include "../../model/CurveCubic.hpp"
9 #include "../../model/CurveCubic_Impl.hpp"
10
11 #include "../../utilities/core/Assert.hpp"
12
13 #include <utilities/idd/Curve_Cubic_FieldEnums.hxx>
14 #include <utilities/idd/IddEnums.hxx>
15
16 using namespace openstudio::model;
17 using namespace std;
18
19 namespace openstudio {
20 namespace energyplus {
21
22 339 boost::optional<IdfObject> ForwardTranslator::translateCurveCubic(CurveCubic& modelObject) {
23
2/2
✓ Branch 1 taken 339 times.
✓ Branch 4 taken 339 times.
339 IdfObject idfObject(IddObjectType::Curve_Cubic);
24
25
1/1
✓ Branch 1 taken 339 times.
339 m_idfObjects.push_back(idfObject);
26
27 339 OptionalString s;
28 339 OptionalDouble d;
29
30
2/3
✓ Branch 1 taken 339 times.
✓ Branch 5 taken 339 times.
✗ Branch 6 not taken.
678 if ((s = modelObject.name())) {
31
2/2
✓ Branch 1 taken 339 times.
✓ Branch 4 taken 339 times.
339 idfObject.setName(*s);
32 }
33
34
2/2
✓ Branch 1 taken 339 times.
✓ Branch 4 taken 339 times.
339 idfObject.setDouble(Curve_CubicFields::Coefficient1Constant, modelObject.coefficient1Constant());
35
2/2
✓ Branch 1 taken 339 times.
✓ Branch 4 taken 339 times.
339 idfObject.setDouble(Curve_CubicFields::Coefficient2x, modelObject.coefficient2x());
36
2/2
✓ Branch 1 taken 339 times.
✓ Branch 4 taken 339 times.
339 idfObject.setDouble(Curve_CubicFields::Coefficient3x_POW_2, modelObject.coefficient3xPOW2());
37
2/2
✓ Branch 1 taken 339 times.
✓ Branch 4 taken 339 times.
339 idfObject.setDouble(Curve_CubicFields::Coefficient4x_POW_3, modelObject.coefficient4xPOW3());
38
2/2
✓ Branch 1 taken 339 times.
✓ Branch 4 taken 339 times.
339 idfObject.setDouble(Curve_CubicFields::MinimumValueofx, modelObject.minimumValueofx());
39
2/2
✓ Branch 1 taken 339 times.
✓ Branch 4 taken 339 times.
339 idfObject.setDouble(Curve_CubicFields::MaximumValueofx, modelObject.maximumValueofx());
40
2/3
✓ Branch 1 taken 339 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 339 times.
678 if ((d = modelObject.minimumCurveOutput())) {
41 ✗ idfObject.setDouble(Curve_CubicFields::MinimumCurveOutput, *d);
42 }
43
2/3
✓ Branch 1 taken 339 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 339 times.
678 if ((d = modelObject.maximumCurveOutput())) {
44 ✗ idfObject.setDouble(Curve_CubicFields::MaximumCurveOutput, *d);
45 }
46
2/3
✓ Branch 1 taken 339 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 339 times.
339 if (!modelObject.isInputUnitTypeforXDefaulted()) {
47 ✗ idfObject.setString(Curve_CubicFields::InputUnitTypeforX, modelObject.inputUnitTypeforX());
48 }
49
2/3
✓ Branch 1 taken 339 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 339 times.
339 if (!modelObject.isOutputUnitTypeDefaulted()) {
50 ✗ idfObject.setString(Curve_CubicFields::OutputUnitType, modelObject.outputUnitType());
51 }
52
53
1/1
✓ Branch 1 taken 339 times.
678 return idfObject;
54 339 }
55
56 } // namespace energyplus
57 } // namespace openstudio
58