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 6068915 IdfObjectDiff_Impl::IdfObjectDiff_Impl(boost::optional<unsigned> index, boost::optional<std::string> oldValue,
17 6068915 boost::optional<std::string> newValue)
18
1/1
✓ Branch 2 taken 6068915 times.
6068915 : m_index(index), m_oldValue(oldValue), m_newValue(newValue) {}
19
20 4371469 boost::optional<unsigned> IdfObjectDiff_Impl::index() const {
21 4371469 return m_index;
22 }
23
24 5588302 bool IdfObjectDiff_Impl::isNull() const {
25 5588302 bool result = true;
26
6/6
✓ Branch 1 taken 4734877 times.
✓ Branch 2 taken 853425 times.
✓ Branch 4 taken 4416269 times.
✓ Branch 5 taken 318608 times.
✓ Branch 6 taken 4416269 times.
✓ Branch 7 taken 1172033 times.
15911481 if (m_oldValue && m_newValue) {
27 4416269 result = (m_oldValue.get() == m_newValue.get());
28 } else {
29 1172033 result = (m_oldValue == m_newValue);
30 }
31 5588302 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 5651288 IdfObjectDiff::IdfObjectDiff(boost::optional<unsigned> index, boost::optional<std::string> oldValue, boost::optional<std::string> newValue)
49
4/6
✓ Branch 2 taken 5651288 times.
✓ Branch 5 taken 5651288 times.
✓ Branch 8 taken 5651288 times.
✓ Branch 11 taken 5651288 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
5651288 : 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 5651288 times.
✗ Branch 4 not taken.
5651288 OS_ASSERT(m_impl);
51 5651288 }
52
53 968385 IdfObjectDiff::IdfObjectDiff(const std::shared_ptr<detail::IdfObjectDiff_Impl>& impl) : m_impl(impl) {
54
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 968385 times.
✗ Branch 4 not taken.
968385 OS_ASSERT(m_impl);
55 968385 }
56
57 4371469 boost::optional<unsigned> IdfObjectDiff::index() const {
58 4371469 return m_impl->index();
59 }
60
61 5588302 bool IdfObjectDiff::isNull() const {
62 5588302 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