MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

unit_tests/util/vector_view.cpp:17–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15using namespace osrm::util;
16
17BOOST_AUTO_TEST_CASE(rw_short)
18{
19 std::size_t num_elements = 1000;
20 std::unique_ptr<char[]> data = std::make_unique<char[]>(sizeof(std::uint16_t) * num_elements);
21 util::vector_view<std::uint16_t> view(reinterpret_cast<std::uint16_t *>(data.get()),
22 num_elements);
23 std::vector<std::uint16_t> reference;
24
25 std::mt19937 rng(osrm::test::getTestRandomSeed());
26 std::uniform_int_distribution<std::mt19937::result_type> dist(0, (1UL << 16));
27
28 for (std::size_t i = 0; i < num_elements; i++)
29 {
30 auto r = dist(rng);
31 view[i] = r;
32 reference.push_back(r);
33 }
34
35 for (std::size_t i = 0; i < num_elements; i++)
36 {
37 BOOST_CHECK_EQUAL(view[i], reference[i]);
38 }
39}
40
41BOOST_AUTO_TEST_CASE(rw_bool)
42{

Callers

nothing calls this directly

Calls 3

getTestRandomSeedFunction · 0.85
getMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected