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

Function BOOST_AUTO_TEST_CASE

unit_tests/util/packed_vector.cpp:22–45  ·  view source on GitHub ↗

Verify that the packed vector behaves as expected

Source from the content-addressed store, hash-verified

20
21// Verify that the packed vector behaves as expected
22BOOST_AUTO_TEST_CASE(insert_and_retrieve_packed_test)
23{
24 PackedVector<OSMNodeID, 33> packed_ids;
25 std::vector<OSMNodeID> original_ids;
26
27 const constexpr std::size_t num_test_cases = 399;
28 const constexpr std::uint64_t max_id = (1ULL << 33) - 1;
29
30 std::mt19937 rng(osrm::test::getTestRandomSeed());
31 std::uniform_int_distribution<std::uint64_t> dist(0, max_id);
32
33 for (std::size_t i = 0; i < num_test_cases; i++)
34 {
35 OSMNodeID r{dist(rng)}; // max 33-bit uint
36
37 packed_ids.push_back(r);
38 original_ids.push_back(r);
39 }
40
41 for (std::size_t i = 0; i < num_test_cases; i++)
42 {
43 BOOST_CHECK_EQUAL(original_ids.at(i), packed_ids.at(i));
44 }
45}
46
47BOOST_AUTO_TEST_CASE(packed_vector_capacity_test)
48{

Callers

nothing calls this directly

Calls 15

getTestRandomSeedFunction · 0.85
irangeFunction · 0.85
checkPackedOSMNodeIdFitsFunction · 0.85
push_backMethod · 0.45
atMethod · 0.45
capacityMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
cbeginMethod · 0.45
cendMethod · 0.45

Tested by

no test coverage detected