GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 87.5% 21 / 0 / 24
Functions: 100.0% 1 / 0 / 1
Branches: 75.6% 34 / 0 / 45

src/energyplus/ReverseTranslator/ReverseTranslateScheduleCompact.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/ScheduleCompact.hpp"
9 #include "../../model/ScheduleCompact_Impl.hpp"
10
11 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
12
13 #include <utilities/idd/Schedule_Compact_FieldEnums.hxx>
14 #include <utilities/idd/OS_Schedule_Compact_FieldEnums.hxx>
15 #include "../../utilities/idd/IddEnums.hpp"
16 #include <utilities/idd/IddEnums.hxx>
17
18 using namespace openstudio::model;
19
20 namespace openstudio {
21
22 namespace energyplus {
23
24 167 OptionalModelObject ReverseTranslator::translateScheduleCompact(const WorkspaceObject& workspaceObject) {
25
4/5
✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
✓ Branch 7 taken 167 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 167 times.
167 if (workspaceObject.iddObject().type() != IddObjectType::Schedule_Compact) {
26 ✗ LOG(Error, "WorkspaceObject is not IddObjectType: Schedule:Compact");
27 ✗ return boost::none;
28 }
29
30
1/1
✓ Branch 1 taken 167 times.
167 ScheduleCompact scheduleCompact(m_model);
31
32
1/1
✓ Branch 1 taken 167 times.
167 OptionalWorkspaceObject target = workspaceObject.getTarget(Schedule_CompactFields::ScheduleTypeLimitsName);
33
2/2
✓ Branch 0 taken 164 times.
✓ Branch 1 taken 3 times.
167 if (target) {
34
2/2
✓ Branch 1 taken 164 times.
✓ Branch 4 taken 164 times.
164 OptionalModelObject scheduleTypeLimits = translateAndMapWorkspaceObject(*target);
35
2/2
✓ Branch 0 taken 143 times.
✓ Branch 1 taken 21 times.
164 if (scheduleTypeLimits) {
36
3/3
✓ Branch 1 taken 143 times.
✓ Branch 4 taken 143 times.
✓ Branch 7 taken 143 times.
143 scheduleCompact.setPointer(OS_Schedule_CompactFields::ScheduleTypeLimitsName, scheduleTypeLimits->handle());
37 }
38 164 }
39
40
2/3
✓ Branch 1 taken 167 times.
✓ Branch 3 taken 167 times.
✗ Branch 4 not taken.
334 if (OptionalString os = workspaceObject.name()) {
41
2/2
✓ Branch 1 taken 167 times.
✓ Branch 4 taken 167 times.
167 scheduleCompact.setName(*os);
42 167 }
43
44
3/3
✓ Branch 1 taken 167 times.
✓ Branch 7 taken 2693 times.
✓ Branch 8 taken 167 times.
2860 for (IdfExtensibleGroup& eg : workspaceObject.extensibleGroups()) {
45
3/3
✓ Branch 1 taken 5386 times.
✓ Branch 3 taken 2693 times.
✓ Branch 4 taken 2693 times.
5386 for (unsigned i = 0; i < eg.numFields(); ++i) {
46
2/3
✓ Branch 1 taken 2693 times.
✓ Branch 3 taken 2693 times.
✗ Branch 4 not taken.
5386 if (auto value = eg.getString(i)) {
47
4/5
✓ Branch 1 taken 2693 times.
✓ Branch 4 taken 2693 times.
✓ Branch 7 taken 2693 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2693 times.
5386 if (istringEqual(value.get(), "Interpolate:Average")) {
48 ✗ eg.setString(i, "Interpolate:Yes");
49 }
50 2693 }
51 }
52
2/2
✓ Branch 1 taken 2693 times.
✓ Branch 4 taken 2693 times.
2693 scheduleCompact.pushExtensibleGroup(eg.fields());
53 167 }
54
55
1/1
✓ Branch 1 taken 167 times.
167 return scheduleCompact;
56 167 }
57
58 } // namespace energyplus
59
60 } // namespace openstudio
61