GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 68.9% 31 / 0 / 45
Functions: 66.7% 12 / 0 / 18
Branches: 64.7% 22 / 0 / 34

src/model/Version.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 "Version.hpp"
7 #include "Version_Impl.hpp"
8
9 #include "ParentObject.hpp"
10
11 #include <utilities/idd/OS_Version_FieldEnums.hxx>
12 #include <utilities/idd/IddEnums.hxx>
13
14 #include "../utilities/core/Assert.hpp"
15
16 #include <OpenStudio.hxx>
17
18 namespace openstudio {
19 namespace model {
20
21 namespace detail {
22
23 5196 Version_Impl::Version_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) : ModelObject_Impl(idfObject, model, keepHandle) {
24
4/6
✓ Branch 1 taken 5196 times.
✓ Branch 4 taken 5196 times.
✓ Branch 7 taken 5196 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 5196 times.
✗ Branch 13 not taken.
5196 OS_ASSERT(idfObject.iddObject().type() == Version::iddObjectType());
25 5196 }
26
27 169 Version_Impl::Version_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle)
28 169 : ModelObject_Impl(other, model, keepHandle) {
29
4/6
✓ Branch 1 taken 169 times.
✓ Branch 4 taken 169 times.
✓ Branch 7 taken 169 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 169 times.
✗ Branch 13 not taken.
169 OS_ASSERT(other.iddObject().type() == Version::iddObjectType());
30 169 }
31
32 10620 Version_Impl::Version_Impl(const Version_Impl& other, Model_Impl* model, bool keepHandle) : ModelObject_Impl(other, model, keepHandle) {}
33
34 ✗ IddObjectType Version_Impl::iddObjectType() const {
35 ✗ return Version::iddObjectType();
36 }
37
38 2 std::string Version_Impl::versionIdentifier() const {
39
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 return getString(OS_VersionFields::VersionIdentifier).get();
40 }
41
42 5026 bool Version_Impl::setVersionIdentifier(const std::string& s) {
43 5026 return setString(OS_VersionFields::VersionIdentifier, s);
44 ;
45 }
46
47 ✗ boost::optional<std::string> Version_Impl::prereleaseIdentifier() const {
48 ✗ return getString(OS_VersionFields::PrereleaseIdentifier, false, true);
49 }
50
51 5026 bool Version_Impl::setPrereleaseIdentifier(const std::string& s) {
52 5026 return setString(OS_VersionFields::PrereleaseIdentifier, s);
53 ;
54 }
55
56 // return the parent object in the hierarchy
57 ✗ boost::optional<ParentObject> Version_Impl::parent() const {
58 ✗ boost::optional<ParentObject> result;
59 ✗ return result;
60 }
61
62 ✗ bool Version_Impl::setParent(ParentObject& /*newParent*/) {
63 ✗ return false;
64 }
65
66 // Get all output variable names that could be associated with this object.
67 ✗ const std::vector<std::string>& Version_Impl::outputVariableNames() const {
68 ✗ static const std::vector<std::string> result;
69 ✗ return result;
70 }
71
72 } // namespace detail
73
74 5026 Version::Version(const Model& model) : ModelObject(iddObjectType(), model) {
75
1/3
✗ Branch 2 not taken.
✓ Branch 3 taken 5026 times.
✗ Branch 5 not taken.
5026 OS_ASSERT(getImpl<detail::Version_Impl>());
76
2/2
✓ Branch 1 taken 5026 times.
✓ Branch 4 taken 5026 times.
5026 setVersionIdentifier(openStudioVersion());
77
78
1/1
✓ Branch 1 taken 5026 times.
5026 std::string preReleaseTag = openStudioVersionPrerelease();
79
1/2
✓ Branch 1 taken 5026 times.
✗ Branch 2 not taken.
5026 if (!preReleaseTag.empty()) {
80
1/1
✓ Branch 1 taken 5026 times.
5026 setPrereleaseIdentifier(preReleaseTag);
81 }
82 5026 }
83
84 // constructor
85
1/1
✓ Branch 3 taken 1983 times.
1983 Version::Version(std::shared_ptr<detail::Version_Impl> impl) : ModelObject(std::move(impl)) {}
86
87 2 std::string Version::versionIdentifier() const {
88
1/1
✓ Branch 3 taken 2 times.
2 return getImpl<detail::Version_Impl>()->versionIdentifier();
89 }
90
91 5026 bool Version::setVersionIdentifier(const std::string& s) {
92
1/1
✓ Branch 3 taken 5026 times.
5026 return getImpl<detail::Version_Impl>()->setVersionIdentifier(s);
93 }
94
95 ✗ boost::optional<std::string> Version::prereleaseIdentifier() const {
96 ✗ return getImpl<detail::Version_Impl>()->prereleaseIdentifier();
97 }
98
99 5026 bool Version::setPrereleaseIdentifier(const std::string& s) {
100
1/1
✓ Branch 3 taken 5026 times.
5026 return getImpl<detail::Version_Impl>()->setPrereleaseIdentifier(s);
101 }
102
103 24224 IddObjectType Version::iddObjectType() {
104
1/1
✓ Branch 1 taken 24224 times.
24224 IddObjectType result(IddObjectType::OS_Version);
105 24224 return result;
106 }
107
108 } // namespace model
109 } // namespace openstudio
110