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

Function BOOST_AUTO_TEST_CASE

unit_tests/util/range_table.cpp:53–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53BOOST_AUTO_TEST_CASE(construction_test)
54{
55 // only offset empty block
56 std::vector<unsigned> empty_lengths;
57 empty_lengths.push_back(1);
58 ConstructionTest(empty_lengths, {0, 1});
59 // first block almost full => sentinel is last element of block
60 // [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, (16)}
61 std::vector<unsigned> almost_full_lengths;
62 std::vector<unsigned> almost_full_offsets;
63 ComputeLengthsOffsets(almost_full_lengths, almost_full_offsets, BLOCK_SIZE);
64 ConstructionTest(almost_full_lengths, almost_full_offsets);
65
66 // first block full => sentinel is offset of new block, next block empty
67 // [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
68 // [(153)] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
69 std::vector<unsigned> full_lengths;
70 std::vector<unsigned> full_offsets;
71 ComputeLengthsOffsets(full_lengths, full_offsets, BLOCK_SIZE + 1);
72 ConstructionTest(full_lengths, full_offsets);
73
74 // first block full and offset of next block not sentinel, but the first differential value
75 // [0] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
76 // [153] {(17), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
77 std::vector<unsigned> over_full_lengths;
78 std::vector<unsigned> over_full_offsets;
79 ComputeLengthsOffsets(over_full_lengths, over_full_offsets, BLOCK_SIZE + 2);
80 ConstructionTest(over_full_lengths, over_full_offsets);
81
82 // test multiple blocks
83 std::vector<unsigned> multiple_lengths;
84 std::vector<unsigned> multiple_offsets;
85 ComputeLengthsOffsets(multiple_lengths, multiple_offsets, (BLOCK_SIZE + 1) * 10);
86 ConstructionTest(multiple_lengths, multiple_offsets);
87}
88
89BOOST_AUTO_TEST_SUITE_END()

Callers

nothing calls this directly

Calls 3

ConstructionTestFunction · 0.85
ComputeLengthsOffsetsFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected