gem/tests/online_merge_check.sh
2026-08-30 18:24:55 -06:00

21 lines
745 B
Bash
Executable file

#!/bin/sh
set -eu
[ "$#" -eq 1 ] || { echo "usage: $0 BINARY" >&2; exit 2; }
binary=$1
output=$("$binary" --tokens 13 --partitions 16 --seed 7)
printf '%s\n' "$output" | jq -e '
.schema_version == 1 and
.workload == "d512-online-softmax-partition-differential" and
.tokens == 13 and .value_dimension == 512 and .partitions == 16 and
.reference == "independent-double-direct-softmax" and
.finite == true and .deterministic == true and
.correlation >= .correlation_floor and .nmse <= .nmse_ceiling and
.passed == true and (.candidate_hash | test("^[0-9a-f]{16}$")) and
.candidate_hash == .repeat_hash
' >/dev/null
if "$binary" --tokens 0 >/dev/null 2>&1; then
echo "online merge check accepted zero tokens" >&2
exit 1
fi