MCPcopy Create free account
hub / github.com/comaps/comaps / Smoke

Function Smoke

libs/base/base_tests/beam_tests.cpp:21–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20template <template <typename, typename> class Beam>
21void Smoke()
22{
23 size_t const kCapacity = 10;
24 size_t const kTotal = 100;
25
26 CHECK_LESS_OR_EQUAL(kCapacity, kTotal, ());
27
28 Beam<uint32_t, double> beam(kCapacity);
29
30 for (uint32_t i = 0; i < kTotal; ++i)
31 beam.Add(i, static_cast<double>(i));
32
33 vector<double> expected;
34 for (size_t i = 0; i < kCapacity; ++i)
35 expected.emplace_back(kTotal - 1 - i);
36
37 vector<double> actual;
38 actual.reserve(kCapacity);
39 for (auto const & e : beam.GetEntries())
40 actual.emplace_back(e.m_value);
41
42 sort(actual.rbegin(), actual.rend());
43 CHECK_EQUAL(expected, actual, ());
44}
45
46template <template <typename, typename> class Beam>
47void Benchmark(string const & beamType, uint64_t const numResets, size_t const capacity, uint64_t const numEvents)

Callers

nothing calls this directly

Calls 5

rbeginMethod · 0.80
rendMethod · 0.80
AddMethod · 0.45
emplace_backMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected