Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 34s
lib/apl/runtime.sx (60 forms): - Core: apl-iota (1..N), apl-rho (shape), apl-at (1-indexed access). - Rank-polymorphic apl-dyadic/apl-monadic helpers: scalar×scalar, scalar×vector, vector×vector all supported uniformly. - Arithmetic: add/sub/mul/div/mod/pow/max/min, neg/abs/floor/ceil/sqrt. - Comparison: eq/neq/lt/le/gt/ge → 0/1 result vectors. - Boolean: and/or/not on 0/1 values, element-wise. - Bitwise: bitand/bitor/bitxor/bitnot/lshift/rshift — element-wise. - Reduction: reduce-add/mul/max/min/and/or; scan-add/mul. - Vector ops: reverse, cat (scalar/vector catenate), take (±N), drop (±N), rotate, compress (boolean mask), index (multi-index). - Set ops: member (∊, → 0/1), nub (∪, unique preserve-order), union, intersect (∩), without (~). All use SX make-set internally. - Format (⍕): vector → space-separated string, scalar → str. lib/apl/tests/runtime.sx + lib/apl/test.sh: 73/73 pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
52 lines
1.3 KiB
Bash
Executable File
52 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# lib/apl/test.sh — smoke-test the APL runtime layer.
|
|
|
|
set -uo pipefail
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
|
|
SX_SERVER="${SX_SERVER:-hosts/ocaml/_build/default/bin/sx_server.exe}"
|
|
if [ ! -x "$SX_SERVER" ]; then
|
|
SX_SERVER="/root/rose-ash/hosts/ocaml/_build/default/bin/sx_server.exe"
|
|
fi
|
|
if [ ! -x "$SX_SERVER" ]; then
|
|
echo "ERROR: sx_server.exe not found."
|
|
exit 1
|
|
fi
|
|
|
|
TMPFILE=$(mktemp); trap "rm -f $TMPFILE" EXIT
|
|
|
|
cat > "$TMPFILE" << 'EPOCHS'
|
|
(epoch 1)
|
|
(load "spec/stdlib.sx")
|
|
(load "lib/apl/runtime.sx")
|
|
(epoch 2)
|
|
(load "lib/apl/tests/runtime.sx")
|
|
(epoch 3)
|
|
(eval "(list apl-test-pass apl-test-fail)")
|
|
EPOCHS
|
|
|
|
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
|
|
|
LINE=$(echo "$OUTPUT" | awk '/^\(ok-len 3 / {getline; print; exit}')
|
|
if [ -z "$LINE" ]; then
|
|
LINE=$(echo "$OUTPUT" | grep -E '^\(ok 3 \([0-9]+ [0-9]+\)\)' | tail -1 \
|
|
| sed -E 's/^\(ok 3 //; s/\)$//')
|
|
fi
|
|
if [ -z "$LINE" ]; then
|
|
echo "ERROR: could not extract summary"
|
|
echo "$OUTPUT" | tail -10
|
|
exit 1
|
|
fi
|
|
|
|
P=$(echo "$LINE" | sed -E 's/^\(([0-9]+) ([0-9]+)\).*/\1/')
|
|
F=$(echo "$LINE" | sed -E 's/^\(([0-9]+) ([0-9]+)\).*/\2/')
|
|
TOTAL=$((P + F))
|
|
|
|
if [ "$F" -eq 0 ]; then
|
|
echo "ok $P/$TOTAL lib/apl tests passed"
|
|
else
|
|
echo "FAIL $P/$TOTAL passed, $F failed"
|
|
fi
|
|
|
|
[ "$F" -eq 0 ]
|