GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 95.2% 20 / 0 / 21
Functions: 100.0% 1 / 0 / 1
Branches: 83.8% 31 / 0 / 37

src/energyplus/ForwardTranslator/ForwardTranslateScheduleCompact.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/Model.hpp"
9 #include "../../model/ScheduleTypeLimits.hpp"
10 #include "../../model/ScheduleTypeLimits_Impl.hpp"
11 #include "../../model/ScheduleCompact.hpp"
12 #include "../../model/ScheduleCompact_Impl.hpp"
13
14 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
15
16 #include <utilities/idd/Schedule_Compact_FieldEnums.hxx>
17
18 #include "../../utilities/idd/IddEnums.hpp"
19 #include <utilities/idd/IddEnums.hxx>
20 #include <utilities/idd/IddFactory.hxx>
21
22 using namespace openstudio::model;
23
24 using namespace std;
25
26 namespace openstudio {
27
28 namespace energyplus {
29
30 94 boost::optional<IdfObject> ForwardTranslator::translateScheduleCompact(ScheduleCompact& modelObject) {
31
2/2
✓ Branch 1 taken 94 times.
✓ Branch 4 taken 94 times.
94 IdfObject scheduleCompact = createAndRegisterIdfObject(openstudio::IddObjectType::Schedule_Compact, modelObject);
32
33 94 OptionalString os;
34
2/3
✓ Branch 1 taken 94 times.
✓ Branch 5 taken 94 times.
✗ Branch 6 not taken.
188 if ((os = modelObject.name())) {
35
2/2
✓ Branch 1 taken 94 times.
✓ Branch 4 taken 94 times.
94 scheduleCompact.setName(*os);
36 }
37
38
1/1
✓ Branch 1 taken 94 times.
94 boost::optional<ScheduleTypeLimits> scheduleTypeLimits = modelObject.scheduleTypeLimits();
39
2/2
✓ Branch 0 taken 92 times.
✓ Branch 1 taken 2 times.
94 if (scheduleTypeLimits) {
40
2/2
✓ Branch 1 taken 92 times.
✓ Branch 4 taken 92 times.
92 boost::optional<IdfObject> idfScheduleTypeLimits = translateAndMapModelObject(*scheduleTypeLimits);
41
1/2
✓ Branch 0 taken 92 times.
✗ Branch 1 not taken.
92 if (idfScheduleTypeLimits) {
42
4/4
✓ Branch 1 taken 92 times.
✓ Branch 4 taken 92 times.
✓ Branch 7 taken 92 times.
✓ Branch 10 taken 92 times.
92 scheduleCompact.setString(Schedule_CompactFields::ScheduleTypeLimitsName, idfScheduleTypeLimits->name().get());
43 }
44 92 }
45
46
3/3
✓ Branch 1 taken 94 times.
✓ Branch 7 taken 638 times.
✓ Branch 8 taken 94 times.
732 for (IdfExtensibleGroup& eg : modelObject.extensibleGroups()) {
47
3/3
✓ Branch 1 taken 1276 times.
✓ Branch 3 taken 638 times.
✓ Branch 4 taken 638 times.
1276 for (unsigned i = 0; i < eg.numFields(); ++i) {
48
2/3
✓ Branch 1 taken 638 times.
✓ Branch 3 taken 638 times.
✗ Branch 4 not taken.
1276 if (auto value = eg.getString(i)) {
49
4/5
✓ Branch 1 taken 638 times.
✓ Branch 4 taken 638 times.
✓ Branch 7 taken 638 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 638 times.
1276 if (istringEqual(value.get(), "Interpolate:Yes")) {
50 ✗ eg.setString(i, "Interpolate:Average");
51 }
52 638 }
53 }
54
2/2
✓ Branch 1 taken 638 times.
✓ Branch 4 taken 638 times.
638 scheduleCompact.pushExtensibleGroup(eg.fields());
55 94 }
56
57
1/1
✓ Branch 1 taken 94 times.
188 return boost::optional<IdfObject>(scheduleCompact);
58 94 }
59
60 } // namespace energyplus
61
62 } // namespace openstudio
63