GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 80.0% 8 / 0 / 10
Functions: 100.0% 1 / 0 / 1
Branches: 58.8% 10 / 0 / 17

src/energyplus/ReverseTranslator/ReverseTranslateTimestep.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 #include "../../model/Timestep.hpp"
8 #include "../../model/Timestep_Impl.hpp"
9 #include <utilities/idd/Timestep_FieldEnums.hxx>
10 #include <utilities/idd/OS_Timestep_FieldEnums.hxx>
11 #include "../../utilities/idd/IddEnums.hpp"
12 #include <utilities/idd/IddEnums.hxx>
13
14 using namespace openstudio::model;
15
16 namespace openstudio {
17
18 namespace energyplus {
19
20 42 OptionalModelObject ReverseTranslator::translateTimestep(const WorkspaceObject& workspaceObject) {
21
4/5
✓ Branch 1 taken 42 times.
✓ Branch 4 taken 42 times.
✓ Branch 7 taken 42 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 42 times.
42 if (workspaceObject.iddObject().type() != IddObjectType::Timestep) {
22 ✗ LOG(Error, "WorkspaceObject is not IddObjectType: Timestep");
23 ✗ return boost::none;
24 }
25
26
1/1
✓ Branch 1 taken 42 times.
42 auto mo = m_model.getUniqueModelObject<Timestep>();
27
28
1/1
✓ Branch 1 taken 42 times.
42 boost::optional<int> i = workspaceObject.getInt(TimestepFields::NumberofTimestepsperHour);
29
1/2
✓ Branch 0 taken 42 times.
✗ Branch 1 not taken.
42 if (i) {
30
2/2
✓ Branch 1 taken 42 times.
✓ Branch 4 taken 42 times.
42 mo.setInt(OS_TimestepFields::NumberofTimestepsperHour, i.get());
31 }
32
33
1/1
✓ Branch 1 taken 42 times.
42 return mo;
34 42 }
35
36 } // namespace energyplus
37
38 } // namespace openstudio
39