GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 24 / 0 / 24
Functions: 100.0% 1 / 0 / 1
Branches: 85.0% 34 / 0 / 40

src/energyplus/ForwardTranslator/ForwardTranslateExternalInterfaceFunctionalMockupUnitImportFromVariable.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/ExternalInterfaceFunctionalMockupUnitImportFromVariable.hpp"
11 #include "../../model/ExternalInterfaceFunctionalMockupUnitImportFromVariable_Impl.hpp"
12 #include "../../model/ExternalInterfaceFunctionalMockupUnitImport.hpp"
13
14 #include <utilities/idd/ExternalInterface_FunctionalMockupUnitImport_From_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::translateExternalInterfaceFunctionalMockupUnitImportFromVariable(
27 ExternalInterfaceFunctionalMockupUnitImportFromVariable& modelObject) {
28 1 boost::optional<std::string> s;
29
30
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject idfObject(openstudio::IddObjectType::ExternalInterface_FunctionalMockupUnitImport_From_Variable);
31
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(idfObject);
32 //Name
33
1/1
✓ Branch 1 taken 1 time.
1 s = modelObject.name();
34
1/2
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
1 if (s) {
35
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setName(*s);
36 }
37
38
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.outputVariableIndexKeyName();
39
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
40
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_From_VariableFields::Output_VariableIndexKeyName, s.get());
41 }
42
43
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.outputVariableName();
44
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
45
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_From_VariableFields::Output_VariableName, s.get());
46 }
47
48
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 boost::optional<ExternalInterfaceFunctionalMockupUnitImport> file = modelObject.fMUFile();
49
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (file.is_initialized()) {
50
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_From_VariableFields::FMUFileName, file.get().fMUFileName());
51 }
52
53
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.fMUInstanceName();
54
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
55
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_From_VariableFields::FMUInstanceName, s.get());
56 }
57
58
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 s = modelObject.fMUVariableName();
59
1/2
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
1 if (s.is_initialized()) {
60
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(ExternalInterface_FunctionalMockupUnitImport_From_VariableFields::FMUVariableName, s.get());
61 }
62
1/1
✓ Branch 1 taken 1 time.
2 return idfObject;
63 1 }
64
65 } // namespace energyplus
66
67 } // namespace openstudio
68