ocaml: phase 5.1 baseline 8/8 — quicksort + exceptions + closures
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 38s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 38s
Added 3 baseline programs: - closures.ml — curried make_adder; verifies closure capture - quicksort.ml — recursive sort using List.filter + List.append, sums result - exception_handle.ml — exception NegArg of int + raise + try/with All 8/8 baseline programs pass through ocaml-run-program. Combined the suite exercises: let-rec, modules, refs, for-loops, pattern matching, exceptions, lambdas, list ops (map/filter/append/fold), arithmetic. run.sh streamlined to one sx_server invocation per program. End-to-end runtime ≈2 min.
This commit is contained in:
@@ -22,25 +22,7 @@ for f in lib/ocaml/baseline/*.ml; do
|
||||
fi
|
||||
|
||||
TMP=$(mktemp)
|
||||
cat > "$TMP" << EPOCHS
|
||||
(epoch 1)
|
||||
(load "lib/guest/lex.sx")
|
||||
(load "lib/guest/prefix.sx")
|
||||
(load "lib/guest/pratt.sx")
|
||||
(load "lib/ocaml/tokenizer.sx")
|
||||
(load "lib/ocaml/parser.sx")
|
||||
(load "lib/ocaml/eval.sx")
|
||||
(load "lib/ocaml/runtime.sx")
|
||||
(eval "(ocaml-load-stdlib!)")
|
||||
(epoch 2)
|
||||
(eval "(ocaml-run-program (file-read \\"$f\\"))")
|
||||
EPOCHS
|
||||
|
||||
output=$(timeout 60 "$SX_SERVER" < "$TMP" 2>/dev/null | grep -E '^\(ok-len 2|^\(ok 2' | head -1)
|
||||
rm -f "$TMP"
|
||||
|
||||
# Pull the next line which has the value
|
||||
result=$(timeout 60 "$SX_SERVER" < <(cat <<EPOCHS
|
||||
cat > "$TMP" << EOF
|
||||
(epoch 1)
|
||||
(load "lib/guest/lex.sx")
|
||||
(load "lib/guest/prefix.sx")
|
||||
@@ -52,8 +34,15 @@ EPOCHS
|
||||
(eval "(ocaml-load-stdlib!)")
|
||||
(epoch 2)
|
||||
(eval "(ocaml-run-program (file-read \"$f\"))")
|
||||
EPOCHS
|
||||
) 2>/dev/null | awk '/^\(ok-len 2 / {getline; print; exit} /^\(ok 2 / {sub(/^\(ok 2 /, ""); sub(/\)$/, ""); print; exit}')
|
||||
EOF
|
||||
|
||||
output=$(timeout 60 "$SX_SERVER" < "$TMP" 2>/dev/null)
|
||||
rm -f "$TMP"
|
||||
|
||||
result=$(echo "$output" | awk '
|
||||
/^\(ok-len 2 / { getline; print; exit }
|
||||
/^\(ok 2 [^)]+\)$/ { sub(/^\(ok 2 /, ""); sub(/\)$/, ""); print; exit }
|
||||
')
|
||||
|
||||
if [ "$result" = "$expected" ]; then
|
||||
PASS=$((PASS + 1))
|
||||
|
||||
Reference in New Issue
Block a user