ocaml: phase 1/5/6 float arithmetic +./-./*./. (+5 tests, 372 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
Tokenizer: +. -. *. /. (with -. avoiding clash with negative float literals). Parser table places dotted ops at int-precedence levels. Eval routes to host SX +/-/*//. HM types them Float->Float->Float; literal floats now infer as Float (was Int). OCaml-style 1.5 +. 2.5 : Float works end-to-end through tokenize + parse + eval + infer.
This commit is contained in:
@@ -910,6 +910,18 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 2203)
|
||||
(eval "(ocaml-run \"List.map2 (fun a b -> a + b) [1;2;3] [10;20;30]\")")
|
||||
|
||||
;; ── Float arithmetic ───────────────────────────────────────────
|
||||
(epoch 2300)
|
||||
(eval "(ocaml-run \"1.5 +. 2.5\")")
|
||||
(epoch 2301)
|
||||
(eval "(ocaml-run \"3.0 *. 2.0\")")
|
||||
(epoch 2302)
|
||||
(eval "(ocaml-run \"10.0 /. 4.0\")")
|
||||
(epoch 2303)
|
||||
(eval "(ocaml-type-of \"1.5 +. 2.5\")")
|
||||
(epoch 2304)
|
||||
(eval "(ocaml-type-of \"fun x y -> x +. y\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 180 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1439,6 +1451,13 @@ check 2201 "List.split" '("tuple" (1 2) ("a" "b"))'
|
||||
check 2202 "List.fold_left2" '66'
|
||||
check 2203 "List.map2" '(11 22 33)'
|
||||
|
||||
# ── Float arithmetic ────────────────────────────────────────────
|
||||
check 2300 "1.5 +. 2.5" '4'
|
||||
check 2301 "3.0 *. 2.0" '6'
|
||||
check 2302 "10.0 /. 4.0" '2.5'
|
||||
check 2303 "type 1.5 +. 2.5" '"Float"'
|
||||
check 2304 "type fun x y -> x +. y" '"Float -> Float -> Float"'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user