GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 95.7% 22 / 0 / 23
Functions: 87.5% 7 / 0 / 8
Branches: 89.5% 17 / 0 / 19

src/model/Thermostat.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 "Thermostat.hpp"
7 #include "Thermostat_Impl.hpp"
8 #include "Model.hpp"
9 #include "Model_Impl.hpp"
10 #include "ThermalZone.hpp"
11 #include "ThermalZone_Impl.hpp"
12 #include "../utilities/core/Assert.hpp"
13
14 namespace openstudio {
15 namespace model {
16
17 namespace detail {
18
19 ✗ Thermostat_Impl::Thermostat_Impl(IddObjectType type, Model_Impl* model) : ModelObject_Impl(type, model) {}
20
21 1249 Thermostat_Impl::Thermostat_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
22 1249 : ModelObject_Impl(idfObject, model, keepHandle) {}
23
24 1003 Thermostat_Impl::Thermostat_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
25 1003 : ModelObject_Impl(other, model, keepHandle) {}
26
27 178 Thermostat_Impl::Thermostat_Impl(const Thermostat_Impl& other, Model_Impl* model, bool keepHandles)
28 178 : ModelObject_Impl(other, model, keepHandles) {}
29
30 273 boost::optional<ThermalZone> Thermostat_Impl::thermalZone() const {
31
1/1
✓ Branch 1 taken 273 times.
273 Handle h = handle();
32
2/2
✓ Branch 1 taken 273 times.
✓ Branch 4 taken 273 times.
273 auto zones = model().getConcreteModelObjects<model::ThermalZone>();
33
2/2
✓ Branch 5 taken 1037 times.
✓ Branch 6 taken 259 times.
1296 for (const auto& zone : zones) {
34
3/3
✓ Branch 1 taken 1037 times.
✓ Branch 3 taken 436 times.
✓ Branch 4 taken 601 times.
2074 if (auto thermostat = zone.thermostat()) {
35
5/5
✓ Branch 1 taken 436 times.
✓ Branch 4 taken 436 times.
✓ Branch 7 taken 436 times.
✓ Branch 9 taken 14 times.
✓ Branch 10 taken 422 times.
436 if (thermostat->handle() == h) {
36
1/1
✓ Branch 1 taken 14 times.
14 return zone;
37 }
38 1037 }
39 }
40 259 return boost::none;
41 273 }
42
43 } // namespace detail
44
45
1/1
✓ Branch 3 taken 712 times.
712 Thermostat::Thermostat(std::shared_ptr<detail::Thermostat_Impl> p) : ModelObject(std::move(p)) {}
46
47 245 Thermostat::Thermostat(IddObjectType type, const Model& model) : ModelObject(type, model) {
48
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 245 times.
✗ Branch 5 not taken.
245 OS_ASSERT(getImpl<detail::Thermostat_Impl>());
49 245 }
50
51 273 boost::optional<ThermalZone> Thermostat::thermalZone() const {
52
1/1
✓ Branch 3 taken 273 times.
273 return getImpl<detail::Thermostat_Impl>()->thermalZone();
53 }
54
55 } // namespace model
56
57 } // namespace openstudio
58