okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-022-int (68864c564) into f-022-gyrocuda: release notes keep both sides1df3a3108

main
1.0 KiB22 linesraw
1// src/spec/spec_start_test.cpp - the speculative loop's start position: 0 is a real position (a 1-token prompt on a native pack).
2#include "strata/spec/spec_start.hpp"
3
4#include <cstdio>
5
6using namespace strata::spec;
7
8int main() {
9    int fail = 0;
10    auto check = [&](bool ok, const char* what) {
11        if (!ok) { std::printf("FAIL: %s\n", what); ++fail; }
12    };
13    check(!spec_loop_runs(kSpecNotStarted, 0, 100, false), "no start position: the loop is not used");
14    check(spec_loop_runs(0, 0, 100, false), "position 0 (a 1-token prompt on a native pack) starts the loop");
15    check(spec_loop_runs(910, 0, 100, false), "a long prompt's start position");
16    check(spec_loop_runs(1, 0, 100, false), "position 1 (a 1-token prompt on the per-token path)");
17    check(!spec_loop_runs(0, 100, 100, false), "nothing left to generate");
18    check(!spec_loop_runs(0, 3, 100, true), "the text already ended");
19    check(kSpecNotStarted < 0, "the sentinel is not a position");
20    std::printf("spec_start tests: %s\n", fail ? "FAILED" : "OK");
21    return fail ? 1 : 0;
22}