MCPcopy Create free account
hub / github.com/Niko1221/Strata / main

Function main

engine/tests/core/batch_rows_test.cpp:24–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22} // namespace
23
24int main() {
25 using strata::core::batch_rows_error;
26 // plain batch: one row per slot, any positions
27 {
28 const int rows[] = {0, 1, 2};
29 const long long pos[] = {10, 500, 3};
30 check(run(rows, pos, 3, 3, 8, 0, false) == nullptr, "one row per slot");
31 check(run(rows, pos, 3, 3, 8, 0, true) == nullptr, "one row per slot through the hand-off");
32 }
33 // --batch-mtp: a slot's two rows at consecutive positions; also on a layer split (S > slots)
34 {
35 const int rows[] = {1, 1, 0, 0};
36 const long long pos[] = {40, 41, 7, 8};
37 check(run(rows, pos, 4, 2, 8, 0, false) == nullptr, "two rows per slot, one stage");
38 check(run(rows, pos, 4, 2, 8, 0, true) == nullptr, "two rows per slot across a layer split (S > slots)");
39 }
40 // eight rows = four slots of two: the whole hand-off
41 {
42 const int rows[] = {0, 0, 1, 1, 2, 2, 3, 3};
43 const long long pos[] = {1, 2, 5, 6, 9, 10, 20, 21};
44 check(run(rows, pos, 8, 4, 8, 0, true) == nullptr, "eight rows fill the hand-off");
45 check(run(rows, pos, 8, 4, 8, 1, true) != nullptr, "a group past the hand-off's end");
46 check(run(rows, pos, 8, 4, 8, 1, false) == nullptr, "no hand-off: the base does not bound the rows");
47 }
48 // refused layouts
49 {
50 const int rows[] = {0, 1, 0};
51 const long long pos[] = {5, 9, 6};
52 check(run(rows, pos, 3, 2, 8, 0, false) != nullptr, "a slot's rows must be contiguous");
53 }
54 {
55 const int rows[] = {0, 0};
56 const long long pos[] = {5, 7};
57 check(run(rows, pos, 2, 1, 8, 0, false) != nullptr, "a slot's rows need consecutive positions");
58 }
59 {
60 const int rows[] = {0, 2};
61 const long long pos[] = {5, 7};
62 check(run(rows, pos, 2, 2, 8, 0, false) != nullptr, "a slot past the slots held");
63 const int neg[] = {-1};
64 const long long p1[] = {1};
65 check(run(neg, p1, 1, 2, 8, 0, false) != nullptr, "a negative slot");
66 }
67 {
68 const int rows[] = {0, 0, 0};
69 const long long pos[] = {1, 2, 3};
70 check(run(rows, pos, 3, 1, 2, 0, false) != nullptr, "more rows than the window holds");
71 check(run(rows, pos, 0, 1, 8, 0, false) != nullptr, "an empty window");
72 check(run(rows, pos, 3, 1, 8, -1, false) != nullptr, "a negative hand-off base");
73 check(run(rows, pos, 3, 1, 8, 0, false) == nullptr, "three rows of one slot are a group");
74 }
75 if (failures != 0) return EXIT_FAILURE;
76 std::printf("batch_rows_test: ok\n");
77 return EXIT_SUCCESS;
78}

Callers

nothing calls this directly

Calls 2

checkFunction · 0.70
runFunction · 0.70

Tested by

no test coverage detected