// (asserts stay on in a Release build: the test is its own check) #undef NDEBUG #include "strata/core/serve_stop_bound.hpp" #include #include #include int main() { int cases = 0; // Independent reference: the existing emission loop, including its budget and EOS rules. for (int accepted = 1; accepted <= 16; ++accepted) for (int remaining = 1; remaining <= 18; ++remaining) for (int eos = -1; eos < accepted; ++eos) { std::vector outputs(accepted); for (int i = 0; i < accepted; ++i) outputs[i] = i == eos ? -1 : 100 + i; std::vector reference; for (int i = 0; i < accepted && static_cast(reference.size()) < remaining; ++i) { reference.push_back(outputs[i]); if (outputs[i] == -1) break; } const int kept = strata::core::serve_stop_bound(accepted, remaining, outputs.data(), [](int t) { return t == -1; }); assert(kept > 0 && kept <= accepted && kept <= remaining); assert(std::vector(outputs.begin(), outputs.begin() + kept) == reference); // Unlike the old full-window commit, no unexposed input suffix enters the cached history. assert(kept == static_cast(reference.size())); ++cases; } assert(strata::core::serve_stop_bound(4, 0, static_cast(nullptr), [](int) { return false; }) == 0); std::cout << "SUMMARY stop_bound cases=" << cases << " passed\n"; }