okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
1df3a3108
main
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 () { 9int fail = 0 ; 10auto check = [& ](bool ok ,const char * what ) { 11if (!ok ) { std::printf ("FAIL: %s\n" ,what );++ fail ; } 12 }; 13check (!spec_loop_runs (kSpecNotStarted ,0 ,100 , false),"no start position: the loop is not used" ); 14check (spec_loop_runs (0 ,0 ,100 , false),"position 0 (a 1-token prompt on a native pack) starts the loop" ); 15check (spec_loop_runs (910 ,0 ,100 , false),"a long prompt's start position" ); 16check (spec_loop_runs (1 ,0 ,100 , false),"position 1 (a 1-token prompt on the per-token path)" ); 17check (!spec_loop_runs (0 ,100 ,100 , false),"nothing left to generate" ); 18check (!spec_loop_runs (0 ,3 ,100 , true),"the text already ended" ); 19check (kSpecNotStarted < 0 ,"the sentinel is not a position" ); 20 std::printf ("spec_start tests: %s\n" ,fail ?"FAILED" :"OK" ); 21return fail ?1 :0 ; 22}