GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 22 / 0 / 22
Functions: 100.0% 1 / 0 / 1
Branches: 85.3% 29 / 0 / 34

src/energyplus/ForwardTranslator/ForwardTranslateExternalInterfaceFunctionalMockupUnitImportToVariable.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/ModelObject.hpp"
10 #include "../../model/ExternalInterfaceFunctionalMockupUnitImportToVariable.hpp"
11 #include "../../model/ExternalInterfaceFunctionalMockupUnitImportToVariable_Impl.hpp"
12 #include "../../model/ExternalInterfaceFunctionalMockupUnitImport.hpp"
13
14 #include <utilities/idd/ExternalInterface_FunctionalMockupUnitImport_To_Variable_FieldEnums.hxx>
15 #include "../../utilities/idd/IddEnums.hpp"
16 #include <utilities/idd/IddEnums.hxx>
17
18 using namespace openstudio::model;
19
20 using namespace std;
21
22 namespace openstudio {
23
24 namespace energyplus {
25
26 1 boost::optional<IdfObject> ForwardTranslator::translateExternalInterfaceFunctionalMockupUnitImportToVariable(
27 ExternalInterfaceFunctionalMockupUnitImportToVariable& modelObject) {
28 1 boost::optional<std::string> s;
29 1 boost::optional<double> d;
30
31
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject idfObject(openstudio::IddObjectType::ExternalInterface_FunctionalMockupUnitImport_To_Variable);
32
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(idfObject);
33 //Name
34
1/1
✓ Branch 1 taken 1 time.
1 s = modelObject.name();
35
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (s) {
36
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setName(*s);
37 }
38
39
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<ExternalInterfaceFunctionalMockupUnitImport> file = modelObject.fMUFile();
40
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (file.is_initialized()) {
41
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_VariableFields::FMUFileName, file.get().fMUFileName());
42 }
43
44
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.fMUInstanceName();
45
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
46
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_VariableFields::FMUInstanceName, s.get());
47 }
48
49
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.fMUVariableName();
50
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
51
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_To_VariableFields::FMUVariableName, s.get());
52 }
53
54
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 d = modelObject.initialValue();
55
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (d.is_initialized()) {
56
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(ExternalInterface_FunctionalMockupUnitImport_To_VariableFields::InitialValue, d.get());
57 }
58
59
1/1
✓ Branch 1 taken 1 time.
2 return idfObject;
60 1 }
61
62 } // namespace energyplus
63
64 } // namespace openstudio
65