ocaml: phase 6 Float module fleshed out (+6 tests, 598 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
New Float members: zero / one / minus_one abs / neg add / sub / mul / div (lift host '+.' '-.' '*.' '/.') max / min (if-based) equal / compare (Float.compare returns -1 / 0 / 1) to_int (host floor) of_int (identity in dynamic runtime) of_string (delegates to _int_of_string) Aligns Float with Int's API and lets baselines use Float.add / Float.compare / etc without lifting the symbols themselves. Float.add 3.5 4.5 = 8 Float.compare 2.5 5.0 = -1 Float.abs -3.7 = 3.7 Float.max 3.14 2.71 = 3.14
This commit is contained in:
@@ -1480,6 +1480,20 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 5232)
|
||||
(eval "(ocaml-run \"Result.compare compare compare (Ok 1) (Error \\\"fail\\\")\")")
|
||||
|
||||
;; ── Float module additions ───────────────────────────────────
|
||||
(epoch 5240)
|
||||
(eval "(ocaml-run \"Float.add 3.5 4.5\")")
|
||||
(epoch 5241)
|
||||
(eval "(ocaml-run \"Float.compare 2.5 5.0\")")
|
||||
(epoch 5242)
|
||||
(eval "(ocaml-run \"Float.abs (-3.7)\")")
|
||||
(epoch 5243)
|
||||
(eval "(ocaml-run \"Float.max 3.14 2.71\")")
|
||||
(epoch 5244)
|
||||
(eval "(ocaml-run \"Float.equal 1.5 1.5\")")
|
||||
(epoch 5245)
|
||||
(eval "(ocaml-run \"Float.zero +. Float.one\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 360 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -2354,6 +2368,14 @@ check 5230 "Result.equal Ok 1 Ok 1" 'true'
|
||||
check 5231 "Result.compare Ok 5 Ok 3" '1'
|
||||
check 5232 "Result.compare Ok < Error" '-1'
|
||||
|
||||
# ── Float module additions ──────────────────────────────────────
|
||||
check 5240 "Float.add 3.5 4.5" '8'
|
||||
check 5241 "Float.compare 2.5 5.0" '-1'
|
||||
check 5242 "Float.abs -3.7" '3.7'
|
||||
check 5243 "Float.max 3.14 2.71" '3.14'
|
||||
check 5244 "Float.equal 1.5 1.5" 'true'
|
||||
check 5245 "Float.zero +. Float.one" '1'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL OCaml-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user