Add asm test suite: 75 tests (unit + integration + functional)
Unit tests (42): arithmetic, comparison, booleans, predicates, pairs/lists, and/or — each verifies expected output. Integration tests (18): special forms, bindings, named-let, recursion, higher-order, closures. Functional tests (15): fib(35), ack(3,4), TCO 100k depth, list processing, mutual recursion, closure state, display. make test-all now runs: Python 571 + C 76 + asm 75 + functional 114. All pass.
This commit is contained in:
parent
8b37399288
commit
a7239ea717
3 changed files with 186 additions and 47 deletions
43
asm/Makefile
43
asm/Makefile
|
|
@ -5,48 +5,7 @@ uncommonlisp: uncommonlisp.s
|
|||
ld -o uncommonlisp uncommonlisp.o
|
||||
|
||||
test: uncommonlisp
|
||||
@echo "=== Basic arithmetic ==="
|
||||
echo '(+ 1 2)' | ./uncommonlisp
|
||||
@echo "=== Nested arithmetic ==="
|
||||
echo '(+ (* 3 4) (- 10 5))' | ./uncommonlisp
|
||||
@echo "=== Boolean and comparison ==="
|
||||
echo '(< 1 2)' | ./uncommonlisp
|
||||
@echo "=== Quote ==="
|
||||
echo "(quote (1 2 3))" | ./uncommonlisp
|
||||
@echo "=== If ==="
|
||||
echo '(if (< 1 2) 42 99)' | ./uncommonlisp
|
||||
@echo "=== Define and use ==="
|
||||
echo '(define x 10) (+ x 5)' | ./uncommonlisp
|
||||
@echo "=== Lambda ==="
|
||||
echo '((lambda (x y) (+ x y)) 3 4)' | ./uncommonlisp
|
||||
@echo "=== Factorial ==="
|
||||
echo '(define (fact n) (if (<= n 1) 1 (* n (fact (- n 1))))) (fact 10)' | ./uncommonlisp
|
||||
@echo "=== Fibonacci (named let) ==="
|
||||
echo '(define (fib n) (let loop ((a 0) (b 1) (i 0)) (if (= i n) a (loop b (+ a b) (+ i 1))))) (fib 35)' | ./uncommonlisp
|
||||
@echo "=== Ackermann ==="
|
||||
echo '(define (ack m n) (cond ((= m 0) (+ n 1)) ((= n 0) (ack (- m 1) 1)) (else (ack (- m 1) (ack m (- n 1)))))) (ack 3 4)' | ./uncommonlisp
|
||||
@echo "=== List operations ==="
|
||||
echo '(car (cdr (list 1 2 3)))' | ./uncommonlisp
|
||||
@echo "=== Length ==="
|
||||
echo '(length (list 1 2 3 4 5))' | ./uncommonlisp
|
||||
@echo "=== And/Or ==="
|
||||
echo '(and 1 2 3)' | ./uncommonlisp
|
||||
echo '(or #f #f 42)' | ./uncommonlisp
|
||||
@echo "=== Let ==="
|
||||
echo '(let ((x 10) (y 20)) (+ x y))' | ./uncommonlisp
|
||||
@echo "=== Begin ==="
|
||||
echo '(begin 1 2 3)' | ./uncommonlisp
|
||||
@echo "=== Set! ==="
|
||||
echo '(define x 1) (set! x 42) x' | ./uncommonlisp
|
||||
@echo "=== Not ==="
|
||||
echo '(not #f)' | ./uncommonlisp
|
||||
echo '(not 42)' | ./uncommonlisp
|
||||
@echo "=== Null/Pair ==="
|
||||
echo "(null? '())" | ./uncommonlisp
|
||||
echo '(pair? (cons 1 2))' | ./uncommonlisp
|
||||
@echo "=== Display ==="
|
||||
echo '(display 42) (newline)' | ./uncommonlisp
|
||||
@echo "=== All tests passed ==="
|
||||
@bash test.sh
|
||||
|
||||
clean:
|
||||
rm -f uncommonlisp.o uncommonlisp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue