Skip to content

Commit abab796

Browse files
Update boost.cpp
1 parent 42cf62c commit abab796

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

test/cfg/boost.cpp

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -207,34 +207,27 @@ BOOST_AUTO_TEST_SUITE_END()
207207
namespace bdata = boost::unit_test::data;
208208

209209
// Dataset generating a Fibonacci sequence
210-
class fibonacci_dataset {
211-
public:
210+
struct fibonacci_dataset {
212211
// the type of the samples is deduced
213-
// cppcheck-suppress unusedStructMember // used in template is_dataset
212+
// cppcheck-suppress unusedStructMember // FP #14795, used in template is_dataset
214213
static const int arity = 1;
215214

216215
struct iterator {
217-
218-
iterator() : a(1), b(1) {}
219-
220-
int operator*() const { return b; }
221-
void operator++()
222-
{
216+
int operator*() const { return b; }
217+
void operator++() {
223218
a = a + b;
224219
std::swap(a, b);
225220
}
226221
private:
227-
int a;
228-
int b; // b is the output
222+
int a = 1;
223+
int b = 1; // b is the output
229224
};
230225

231-
fibonacci_dataset() {}
232-
233226
// size is infinite
234-
bdata::size_t size() const { return bdata::BOOST_TEST_DS_INFINITE_SIZE; }
227+
bdata::size_tsize() const { return bdata::BOOST_TEST_DS_INFINITE_SIZE; }
235228

236229
// iterator
237-
static iterator begin() { return iterator(); }
230+
static iterator begin() { return iterator(); }
238231
};
239232

240233
namespace boost { namespace unit_test { namespace data { namespace monomorphic {
@@ -249,6 +242,6 @@ BOOST_DATA_TEST_CASE(
249242
fibonacci_dataset() ^ bdata::make( { 1, 2, 3, 5, 8, 13, 21, 35, 56 } ),
250243
fib_sample, exp)
251244
{
252-
// cppcheck-suppress valueFlowBailoutIncompleteVar // TODO - fib_sample declared in test case
245+
// cppcheck-suppress valueFlowBailoutIncompleteVar // TODO: fib_sample declared in test case
253246
BOOST_TEST(fib_sample == exp);
254247
}

0 commit comments

Comments
 (0)