GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 17 / 0 / 17
Functions: 100.0% 1 / 0 / 1
Branches: 95.7% 22 / 0 / 23

src/energyplus/ReverseTranslator/ReverseTranslateOutputConstructions.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/OutputConstructions.hpp"
9 #include "../../model/OutputConstructions_Impl.hpp"
10
11 #include <utilities/idd/Output_Constructions_FieldEnums.hxx>
12 #include <utilities/idd/IddEnums.hxx>
13
14 using namespace openstudio::model;
15
16 namespace openstudio {
17
18 namespace energyplus {
19
20 7 boost::optional<ModelObject> ReverseTranslator::translateOutputConstructions(const WorkspaceObject& workspaceObject) {
21
22 7 bool reportConstructions = false;
23 7 bool reportMaterials = false;
24
25
2/2
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 7 times.
21 for (unsigned index : {Output_ConstructionsFields::DetailsType1, Output_ConstructionsFields::DetailsType2}) {
26
3/3
✓ Branch 1 taken 14 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 7 times.
28 if (boost::optional<std::string> detailsType_ = workspaceObject.getString(index, true, false)) {
27
5/5
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✓ Branch 10 taken 5 times.
✓ Branch 11 taken 2 times.
21 if (istringEqual("Constructions", detailsType_.get())) {
28 5 reportConstructions = true;
29
4/5
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
6 } else if (istringEqual("Materials", detailsType_.get())) {
30 2 reportMaterials = true;
31 }
32 14 }
33 }
34
35
4/4
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 1 time.
✓ Branch 3 taken 1 time.
7 if (!reportConstructions && !reportMaterials) {
36 1 return boost::none;
37 }
38
39 // This is a Unique ModelObject
40
1/1
✓ Branch 1 taken 6 times.
6 openstudio::model::OutputConstructions modelObject = m_model.getUniqueModelObject<OutputConstructions>();
41
42
1/1
✓ Branch 1 taken 6 times.
6 modelObject.setReportConstructions(reportConstructions);
43
1/1
✓ Branch 1 taken 6 times.
6 modelObject.setReportMaterials(reportMaterials);
44
45
1/1
✓ Branch 1 taken 6 times.
6 return modelObject;
46
47 6 } // End of translate function
48
49 } // end namespace energyplus
50 } // end namespace openstudio
51