ocaml: phase 5.1 frequency.ml baseline + Format module alias (+2 tests, 498 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 27s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 27s
frequency.ml exercises the recently-added Hashtbl.iter / fold + Hashtbl.find_opt + s.[i] indexing + for-loop together: build a char-count table for 'abracadabra' then take the max via Hashtbl.fold. Expected = 5 (a x 5). Total 25 baseline programs. Format module added as a thin alias of Printf — sprintf, printf, and asprintf all delegate to Printf.sprintf. The dynamic runtime doesn't distinguish boxes/breaks, so format strings work the same as in Printf and most Format-using OCaml programs now compile.
This commit is contained in:
@@ -1234,6 +1234,12 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 4961)
|
||||
(eval "(ocaml-run \"let counter = ref 0 in let lz = lazy (counter := !counter + 1; 42) in let a = Lazy.force lz in let b = Lazy.force lz in (a + b) * 100 + !counter\")")
|
||||
|
||||
;; ── Format alias of Printf ────────────────────────────────────
|
||||
(epoch 4970)
|
||||
(eval "(ocaml-run \"Format.sprintf \\\"%d\\\" 99\")")
|
||||
(epoch 4971)
|
||||
(eval "(ocaml-run \"Format.asprintf \\\"%s=%d\\\" \\\"n\\\" 7\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 360 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1958,6 +1964,10 @@ check 4951 "Hashtbl.iter ref accum 10+20" '30'
|
||||
check 4960 "lazy 1+2 force" '3'
|
||||
check 4961 "lazy memoization counter=1" '8401'
|
||||
|
||||
# ── Format alias ─────────────────────────────────────────────────
|
||||
check 4970 "Format.sprintf %d" '"99"'
|
||||
check 4971 "Format.asprintf %s=%d" '"n=7"'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user