GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 76.5% 26 / 0 / 34
Functions: 69.2% 9 / 0 / 13
Branches: 61.5% 16 / 0 / 26

src/utilities/idf/IdfObjectDiff.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 "IdfObjectDiff.hpp"
7 #include "IdfObjectDiff_Impl.hpp"
8
9 #include "../core/Assert.hpp"
10
11 namespace openstudio {
12 namespace detail {
13
14 4 IdfObjectDiff_Impl::IdfObjectDiff_Impl() = default;
15
16 6094893 IdfObjectDiff_Impl::IdfObjectDiff_Impl(boost::optional<unsigned> index, boost::optional<std::string> oldValue,
17 6094893 boost::optional<std::string> newValue)
18
1/1
✓ Branch 2 taken 6094893 times.
6094893 : m_index(index), m_oldValue(oldValue), m_newValue(newValue) {}
19
20 4388850 boost::optional<unsigned> IdfObjectDiff_Impl::index() const {
21 4388850 return m_index;
22 }
23
24 5612124 bool IdfObjectDiff_Impl::isNull() const {
25 5612124 bool result = true;
26
6/6
✓ Branch 1 taken 4751299 times.
✓ Branch 2 taken 860825 times.
✓ Branch 4 taken 4432295 times.
✓ Branch 5 taken 319004 times.
✓ Branch 6 taken 4432295 times.
✓ Branch 7 taken 1179829 times.
15975547 if (m_oldValue && m_newValue) {
27 4432295 result = (m_oldValue.get() == m_newValue.get());
28 } else {
29 1179829 result = (m_oldValue == m_newValue);
30 }
31 5612124 return result;
32 }
33
34 ✗ boost::optional<std::string> IdfObjectDiff_Impl::oldValue() const {
35 ✗ return m_oldValue;
36 }
37
38 ✗ boost::optional<std::string> IdfObjectDiff_Impl::newValue() const {
39 ✗ return m_newValue;
40 }
41
42 } // namespace detail
43
44
2/4
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 4 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
4 IdfObjectDiff::IdfObjectDiff() : m_impl(std::shared_ptr<detail::IdfObjectDiff_Impl>(new detail::IdfObjectDiff_Impl())) {
45
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
4 OS_ASSERT(m_impl);
46 4 }
47
48 5674648 IdfObjectDiff::IdfObjectDiff(boost::optional<unsigned> index, boost::optional<std::string> oldValue, boost::optional<std::string> newValue)
49
4/6
✓ Branch 2 taken 5674648 times.
✓ Branch 5 taken 5674648 times.
✓ Branch 8 taken 5674648 times.
✓ Branch 11 taken 5674648 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
5674648 : m_impl(std::shared_ptr<detail::IdfObjectDiff_Impl>(new detail::IdfObjectDiff_Impl(index, oldValue, newValue))) {
50
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 5674648 times.
✗ Branch 4 not taken.
5674648 OS_ASSERT(m_impl);
51 5674648 }
52
53 973261 IdfObjectDiff::IdfObjectDiff(const std::shared_ptr<detail::IdfObjectDiff_Impl>& impl) : m_impl(impl) {
54
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 973261 times.
✗ Branch 4 not taken.
973261 OS_ASSERT(m_impl);
55 973261 }
56
57 4388850 boost::optional<unsigned> IdfObjectDiff::index() const {
58 4388850 return m_impl->index();
59 }
60
61 5612124 bool IdfObjectDiff::isNull() const {
62 5612124 return m_impl->isNull();
63 }
64
65 ✗ boost::optional<std::string> IdfObjectDiff::oldValue() const {
66 ✗ return m_impl->oldValue();
67 }
68
69 ✗ boost::optional<std::string> IdfObjectDiff::newValue() const {
70 ✗ return m_impl->newValue();
71 }
72
73 } // namespace openstudio
74