| 3 | #include <cstdio> |
| 4 | |
| 5 | int main() { |
| 6 | using strata::program::message_checkpoint_boundary; |
| 7 | constexpr int64_t token = 248045; |
| 8 | std::vector<int64_t> ids(33100, 7); |
| 9 | ids[0] = ids[12] = ids[32800] = ids[33000] = token; |
| 10 | int checks = 0; |
| 11 | auto check = [&](int64_t resume, int64_t turn, int64_t expected) { |
| 12 | ++checks; |
| 13 | return message_checkpoint_boundary(ids, resume, turn, token) == expected; |
| 14 | }; |
| 15 | if (!check(0, 33000, 32800) || !check(22016, 33000, 32800) || |
| 16 | !check(32800, 33000, -1) || !check(33000, 33000, -1) || |
| 17 | !check(-1, 33000, -1) || !check(0, -1, -1) || |
| 18 | !check(0, 33100, -1) || !check(0, 32999, -1) || |
| 19 | !check(0, 12, -1) || !check(0, 32800, -1)) return 1; |
| 20 | for (int tail : {1, 63, 64, 512, 1024, 1025, 2048}) { |
| 21 | std::vector<int64_t> fixture(8192 + tail + 1, 9); |
| 22 | fixture[8192] = fixture[8192 + tail] = token; |
| 23 | if (message_checkpoint_boundary(fixture, 0, 8192 + tail, token) != |
| 24 | (tail <= 1024 ? 8192 : -1)) return 1; |
| 25 | ++checks; |
| 26 | } |
| 27 | if (message_checkpoint_boundary({}, 0, 0, token) != -1 || |
| 28 | message_checkpoint_boundary(ids, 0, 33000, -1) != -1 || |
| 29 | message_checkpoint_boundary(ids, 0, 33000, token, 8192, 0) != -1 || |
| 30 | message_checkpoint_boundary(ids, 0, 33000, token, -1) != -1) return 1; |
| 31 | checks += 4; |
| 32 | std::printf("message_boundary_test OK (%d checks)\n", checks); |
| 33 | } |
nothing calls this directly
no test coverage detected