GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 77.4% 41 / 0 / 53
Functions: 77.8% 14 / 0 / 18
Branches: 44.4% 24 / 0 / 54

src/model/OutputControlTableStyle.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 "OutputControlTableStyle.hpp"
7 #include "OutputControlTableStyle_Impl.hpp"
8
9 #include <utilities/idd/OS_OutputControl_Table_Style_FieldEnums.hxx>
10 #include <utilities/idd/IddEnums.hxx>
11 #include <utilities/idd/IddFactory.hxx>
12
13 #include "../utilities/units/Unit.hpp"
14
15 #include "../utilities/core/Assert.hpp"
16
17 namespace openstudio {
18 namespace model {
19
20 namespace detail {
21
22 41 OutputControlTableStyle_Impl::OutputControlTableStyle_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
23 41 : ModelObject_Impl(idfObject, model, keepHandle) {
24
4/6
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
✓ Branch 7 taken 41 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 41 times.
✗ Branch 13 not taken.
41 OS_ASSERT(idfObject.iddObject().type() == OutputControlTableStyle::iddObjectType());
25 41 }
26
27 ✗ OutputControlTableStyle_Impl::OutputControlTableStyle_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model,
28 ✗ bool keepHandle)
29 ✗ : ModelObject_Impl(other, model, keepHandle) {
30 ✗ OS_ASSERT(other.iddObject().type() == OutputControlTableStyle::iddObjectType());
31 ✗ }
32
33 7 OutputControlTableStyle_Impl::OutputControlTableStyle_Impl(const OutputControlTableStyle_Impl& other, Model_Impl* model, bool keepHandle)
34 7 : ModelObject_Impl(other, model, keepHandle) {}
35
36 ✗ const std::vector<std::string>& OutputControlTableStyle_Impl::outputVariableNames() const {
37 ✗ static const std::vector<std::string> result;
38 ✗ return result;
39 }
40
41 2 IddObjectType OutputControlTableStyle_Impl::iddObjectType() const {
42 2 return OutputControlTableStyle::iddObjectType();
43 }
44
45 9 std::string OutputControlTableStyle_Impl::columnSeparator() const {
46
1/1
✓ Branch 1 taken 9 times.
9 boost::optional<std::string> value = getString(OS_OutputControl_Table_StyleFields::ColumnSeparator, true);
47
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 4 not taken.
9 OS_ASSERT(value);
48
2/2
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
18 return value.get();
49 9 }
50
51 10 std::string OutputControlTableStyle_Impl::unitConversion() const {
52
1/1
✓ Branch 1 taken 10 times.
10 boost::optional<std::string> value = getString(OS_OutputControl_Table_StyleFields::UnitConversion, true);
53
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 4 not taken.
10 OS_ASSERT(value);
54
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
20 return value.get();
55 10 }
56
57 81 bool OutputControlTableStyle_Impl::setColumnSeparator(const std::string& columnSeparator) {
58 81 bool result = setString(OS_OutputControl_Table_StyleFields::ColumnSeparator, columnSeparator);
59 81 return result;
60 }
61
62 82 bool OutputControlTableStyle_Impl::setUnitConversion(const std::string& unitConversion) {
63 82 bool result = setString(OS_OutputControl_Table_StyleFields::UnitConversion, unitConversion);
64 82 return result;
65 }
66
67 } // namespace detail
68
69 8719 IddObjectType OutputControlTableStyle::iddObjectType() {
70
1/1
✓ Branch 1 taken 8719 times.
8719 return IddObjectType(IddObjectType::OS_OutputControl_Table_Style);
71 }
72
73 ✗ std::vector<std::string> OutputControlTableStyle::columnSeparatorValues() {
74 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_OutputControl_Table_StyleFields::ColumnSeparator);
75 }
76
77 ✗ std::vector<std::string> OutputControlTableStyle::unitConversionValues() {
78 ✗ return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_OutputControl_Table_StyleFields::UnitConversion);
79 }
80
81 9 std::string OutputControlTableStyle::columnSeparator() const {
82
1/1
✓ Branch 3 taken 9 times.
9 return getImpl<detail::OutputControlTableStyle_Impl>()->columnSeparator();
83 }
84
85 10 std::string OutputControlTableStyle::unitConversion() const {
86
1/1
✓ Branch 3 taken 10 times.
10 return getImpl<detail::OutputControlTableStyle_Impl>()->unitConversion();
87 }
88
89 81 bool OutputControlTableStyle::setColumnSeparator(const std::string& columnSeparator) {
90
1/1
✓ Branch 3 taken 81 times.
81 return getImpl<detail::OutputControlTableStyle_Impl>()->setColumnSeparator(columnSeparator);
91 }
92
93 82 bool OutputControlTableStyle::setUnitConversion(const std::string& unitConversion) {
94
1/1
✓ Branch 3 taken 82 times.
82 return getImpl<detail::OutputControlTableStyle_Impl>()->setUnitConversion(unitConversion);
95 }
96
97 /// @cond
98
1/1
✓ Branch 3 taken 16 times.
16 OutputControlTableStyle::OutputControlTableStyle(std::shared_ptr<detail::OutputControlTableStyle_Impl> impl) : ModelObject(std::move(impl)) {}
99 41 OutputControlTableStyle::OutputControlTableStyle(Model& model) : ModelObject(OutputControlTableStyle::iddObjectType(), model) {
100
2/2
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
41 bool ok = setColumnSeparator("HTML");
101
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 41 times.
✗ Branch 3 not taken.
41 OS_ASSERT(ok);
102
2/2
✓ Branch 1 taken 41 times.
✓ Branch 4 taken 41 times.
41 ok = setUnitConversion("None");
103
1/3
✗ Branch 0 not taken.
✓ Branch 1 taken 41 times.
✗ Branch 3 not taken.
41 OS_ASSERT(ok);
104 41 }
105
106 /// @endcond
107
108 } // namespace model
109 } // namespace openstudio
110