ocaml: phase 4 Set.Make / Map.Make functor application smoke tests (+3 tests, 572 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s
Functors were already wired through ocaml-make-functor in eval.sx (curried host closure consuming module dicts) but had no explicit tests for the user-defined Ord application path. This commit adds three smoke tests that confirm: module IntOrd = struct let compare a b = a - b end module S = Set.Make (IntOrd) S.elements (fold-add [5;1;3;1;5]) sums to 9 (dedupe + sort) S.mem 2 (S.add 1 (S.add 2 (S.add 3 S.empty))) = true M.cardinal (M.add 1 'a' (M.add 2 'b' M.empty)) = 2 The Ord parameter is properly threaded through the functor body — elements are sorted in compare order and dedupe works.
This commit is contained in:
@@ -1422,6 +1422,14 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 5171)
|
||||
(eval "(ocaml-run \"Char.equal \\\"a\\\" \\\"a\\\"\")")
|
||||
|
||||
;; ── Set.Make / Map.Make functor application ──────────────────
|
||||
(epoch 5180)
|
||||
(eval "(ocaml-run-program \"module IntOrd = struct let compare a b = a - b end ;; module S = Set.Make (IntOrd) ;; let s = List.fold_left (fun s x -> S.add x s) S.empty [5;1;3;1;5] ;; List.fold_left (+) 0 (S.elements s)\")")
|
||||
(epoch 5181)
|
||||
(eval "(ocaml-run-program \"module IntOrd = struct let compare a b = a - b end ;; module S = Set.Make (IntOrd) ;; let s = S.add 1 (S.add 2 (S.add 3 S.empty)) ;; S.mem 2 s\")")
|
||||
(epoch 5182)
|
||||
(eval "(ocaml-run-program \"module IntOrd = struct let compare a b = a - b end ;; module M = Map.Make (IntOrd) ;; let m = M.add 1 \\\"a\\\" (M.add 2 \\\"b\\\" M.empty) ;; M.cardinal m\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 360 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -2261,6 +2269,11 @@ check 5164 "chop_extension hello.ml" '"hello"'
|
||||
check 5170 "Char.compare b a" '1'
|
||||
check 5171 "Char.equal a a" 'true'
|
||||
|
||||
# ── Set.Make / Map.Make functor application ─────────────────────
|
||||
check 5180 "Set.Make dedupe sum" '9'
|
||||
check 5181 "Set.Make mem" 'true'
|
||||
check 5182 "Map.Make cardinal" '2'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"
|
||||
|
||||
@@ -407,6 +407,13 @@ _Newest first._
|
||||
binary search tree (`type 'a tree = Leaf | Node of 'a * 'a tree *
|
||||
'a tree`) with insert + in-order traversal. Tests parametric ADT,
|
||||
recursive match, List.append, List.fold_left.
|
||||
- 2026-05-09 Phase 4 — Set.Make / Map.Make functor application
|
||||
smoke tests (+3 tests, 572 total). Functors were already wired
|
||||
through ocaml-make-functor in eval.sx but had no explicit tests
|
||||
for the user-defined Ord application path. Confirms that
|
||||
`module S = Set.Make (IntOrd) ;; let s = ... in S.elements s`,
|
||||
`S.mem 2 s`, and `Map.Make (IntOrd) ;; M.cardinal m` all work end
|
||||
to end.
|
||||
- 2026-05-09 Phase 6 — Filename module + Char.compare/equal/escaped
|
||||
(+7 tests, 569 total). Filename: basename, dirname, extension,
|
||||
chop_extension, concat, is_relative + dir_sep / current_dir_name /
|
||||
|
||||
Reference in New Issue
Block a user