• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

libbitcoin / libbitcoin-system / 39899818290

23 Oct 2026 04:20AM UTC coverage: 97.2% (-0.03%) from 97.234%
39899818290

push

github

web-flow
Merge pull request #2111 from evoskuil/master

Replace Boost.JSON with system json.

1247 of 1289 new or added lines in 17 files covered. (96.74%)

1 existing line in 1 file now uncovered.

21627 of 22250 relevant lines covered (97.2%)

2775774.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.08
/src/serial/json/array.cpp
1
/**
2
 * Copyright (c) 2011-2026 libbitcoin developers
3
 *
4
 * This file is part of libbitcoin.
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Affero General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU Affero General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Affero General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
#include <bitcoin/system/serial/json/value.hpp>
20

21
#include <bitcoin/system/define.hpp>
22

23
namespace libbitcoin {
24
namespace system {
25
namespace json {
26

27
array::array() NOEXCEPT
8,025 ✔
28
  : values_{}
8,025 ✔
29
{
30
}
8,025 ✔
31

32
array::array(const array& other) THROWS
7,603 ✔
33
  : values_(other.values_)
7,603 ✔
34
{
35
}
7,603 ✔
36

37
array::array(array&& other) NOEXCEPT
25,755 ✔
38
  : values_(std::move(other.values_))
39
{
40
}
25,755 ✔
41

42
array::array(size_t count) THROWS
12 ✔
43
  : values_(count)
12 ✔
44
{
45
}
12 ✔
46

47
array::array(size_t count, const value& fill) THROWS
1 ✔
48
  : values_(count, fill)
1 ✔
49
{
50
}
1 ✔
51

52
array::array(std::initializer_list<value_ref> list) THROWS
17 ✔
53
  : array(value_ref::make_array(list))
17 ✔
54
{
55
}
17 ✔
56

57
array::~array() NOEXCEPT
41,396 ✔
58
{
59
}
41,396 ✔
60

NEW
61
array& array::operator=(const array& other) THROWS
×
62
{
NEW
63
    values_ = other.values_;
×
NEW
64
    return *this;
×
65
}
66

67
array& array::operator=(array&& other) NOEXCEPT
1 ✔
68
{
69
    values_ = std::move(other.values_);
1 ✔
70
    return *this;
1 ✔
71
}
72

73
array& array::operator=(std::initializer_list<value_ref> list) THROWS
1 ✔
74
{
75
    *this = value_ref::make_array(list);
1 ✔
76
    return *this;
1 ✔
77
}
78

79
void array::reserve(size_t count) THROWS
84 ✔
80
{
81
    values_.reserve(count);
84 ✔
82
}
84 ✔
83

NEW
84
void array::shrink_to_fit() THROWS
×
85
{
NEW
86
    values_.shrink_to_fit();
×
NEW
87
}
×
88

89
value& array::at(size_t index) THROWS
10 ✔
90
{
91
    if (index >= values_.size())
10 ✔
NEW
92
        throw_error(error::json_out_of_range);
×
93

94
    return (*this)[index];
10 ✔
95
}
96

97
const value& array::at(size_t index) const THROWS
26 ✔
98
{
99
    if (index >= values_.size())
26 ✔
100
        throw_error(error::json_out_of_range);
2 ✔
101

102
    return (*this)[index];
24 ✔
103
}
104

NEW
105
value* array::if_contains(size_t index) NOEXCEPT
×
106
{
NEW
107
    return index < values_.size() ? &(*this)[index] : nullptr;
×
108
}
109

110
const value* array::if_contains(size_t index) const NOEXCEPT
2 ✔
111
{
112
    return index < values_.size() ? &(*this)[index] : nullptr;
2 ✔
113
}
114

115
void array::clear() NOEXCEPT
1 ✔
116
{
117
    values_.clear();
1 ✔
118
}
1 ✔
119

120
void array::push_back(const value& element) THROWS
1 ✔
121
{
122
    values_.push_back(element);
1 ✔
123
}
1 ✔
124

125
void array::push_back(value&& element) THROWS
5,976 ✔
126
{
127
    values_.push_back(std::move(element));
5,976 ✔
128
}
5,976 ✔
129

NEW
130
array::iterator array::insert(const_iterator position,
×
131
    const value& element) THROWS
132
{
NEW
133
    return emplace(position, element);
×
134
}
135

136
array::iterator array::insert(const_iterator position,
2 ✔
137
    value&& element) THROWS
138
{
139
    return emplace(position, std::move(element));
2 ✔
140
}
141

142
array::iterator array::erase(const_iterator position) NOEXCEPT
1 ✔
143
{
144
    return erase(position, std::next(position));
1 ✔
145
}
146

147
array::iterator array::erase(const_iterator first,
2 ✔
148
    const_iterator last) NOEXCEPT
149
{
150
    const auto from = std::distance(cbegin(), first);
151
    const auto to = std::distance(cbegin(), last);
152
    values_.erase(std::next(values_.cbegin(), from),
2 ✔
153
        std::next(values_.cbegin(), to));
154
    return std::next(begin(), from);
2 ✔
155
}
156

157
void array::pop_back() NOEXCEPT
1 ✔
158
{
159
    values_.pop_back();
160
}
1 ✔
161

162
void array::resize(size_t count) THROWS
1 ✔
163
{
164
    values_.resize(count);
1 ✔
165
}
1 ✔
166

167
void array::resize(size_t count, const value& fill) THROWS
1 ✔
168
{
169
    values_.resize(count, fill);
1 ✔
170
}
1 ✔
171

172
void array::swap(array& other) NOEXCEPT
1 ✔
173
{
174
    values_.swap(other.values_);
175
}
1 ✔
176

177
bool array::operator==(const array& other) const NOEXCEPT
28 ✔
178
{
179
    return values_ == other.values_;
28 ✔
180
}
181

182
void swap(array& left, array& right) NOEXCEPT
1 ✔
183
{
184
    left.swap(right);
1 ✔
185
}
1 ✔
186

187
} // namespace json
188
} // namespace system
189
} // namespace libbitcoin
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc