GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 76.0% 19 / 0 / 25
Functions: 72.7% 8 / 0 / 11
Branches: 75.0% 12 / 0 / 16

src/model/Inverter.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 "Inverter.hpp"
7 #include "Inverter_Impl.hpp"
8 #include "ParentObject.hpp"
9 #include "ParentObject_Impl.hpp"
10 #include "Model.hpp"
11 #include "Model_Impl.hpp"
12 #include "ElectricLoadCenterDistribution.hpp"
13 #include "ElectricLoadCenterDistribution_Impl.hpp"
14
15 #include "../utilities/core/Assert.hpp"
16
17 namespace openstudio {
18
19 namespace model {
20
21 namespace detail {
22
23 ✗ Inverter_Impl::Inverter_Impl(IddObjectType type, Model_Impl* model) : ParentObject_Impl(type, model) {}
24
25 18 Inverter_Impl::Inverter_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) : ParentObject_Impl(idfObject, model, keepHandle) {}
26
27 ✗ Inverter_Impl::Inverter_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
28 ✗ : ParentObject_Impl(other, model, keepHandle) {}
29
30 7 Inverter_Impl::Inverter_Impl(const Inverter_Impl& other, Model_Impl* model, bool keepHandles) : ParentObject_Impl(other, model, keepHandles) {}
31
32 32 boost::optional<ElectricLoadCenterDistribution> Inverter_Impl::electricLoadCenterDistribution() const {
33
3/3
✓ Branch 1 taken 32 times.
✓ Branch 4 taken 32 times.
✓ Branch 7 taken 32 times.
32 auto elcds = getObject<ModelObject>().getModelObjectSources<ElectricLoadCenterDistribution>(ElectricLoadCenterDistribution::iddObjectType());
34
2/2
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 22 times.
32 if (elcds.empty()) {
35 // no error
36
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 } else if (elcds.size() == 1u) {
37
1/1
✓ Branch 2 taken 10 times.
10 return elcds[0];
38 } else {
39 // error
40 }
41
42 22 return boost::none;
43 32 }
44
45 } // namespace detail
46
47 18 Inverter::Inverter(IddObjectType type, const Model& model) : ParentObject(type, model) {
48
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 18 times.
✗ Branch 5 not taken.
18 OS_ASSERT(getImpl<detail::Inverter_Impl>());
49 18 }
50
51
1/1
✓ Branch 3 taken 26 times.
26 Inverter::Inverter(std::shared_ptr<detail::Inverter_Impl> p) : ParentObject(std::move(p)) {}
52
53 32 boost::optional<ElectricLoadCenterDistribution> Inverter::electricLoadCenterDistribution() const {
54
1/1
✓ Branch 3 taken 32 times.
32 return getImpl<detail::Inverter_Impl>()->electricLoadCenterDistribution();
55 }
56
57 6 boost::optional<ThermalZone> Inverter::thermalZone() const {
58
1/1
✓ Branch 3 taken 6 times.
6 return getImpl<detail::Inverter_Impl>()->thermalZone();
59 }
60
61 2 bool Inverter::setThermalZone(const ThermalZone& thermalZone) {
62
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::Inverter_Impl>()->setThermalZone(thermalZone);
63 }
64
65 ✗ void Inverter::resetThermalZone() {
66 ✗ getImpl<detail::Inverter_Impl>()->resetThermalZone();
67 ✗ }
68
69 } // namespace model
70
71 } // namespace openstudio
72