mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
Adding command-line option tests.
This commit is contained in:
parent
74cc4372be
commit
854f2f09ed
46 changed files with 142 additions and 7 deletions
12
Makefile
12
Makefile
|
@ -202,18 +202,15 @@ test-memory: chibi-scheme-ulimit$(EXE)
|
|||
test-build:
|
||||
MAKE=$(MAKE) ./tests/build/build-tests.sh
|
||||
|
||||
test-run:
|
||||
./tests/run/command-line-tests.sh
|
||||
|
||||
test-ffi: chibi-scheme$(EXE)
|
||||
$(CHIBI) tests/ffi/ffi-tests.scm
|
||||
|
||||
test-snow: chibi-scheme$(EXE)
|
||||
$(CHIBI) tests/snow/snow-tests.scm
|
||||
|
||||
test-numbers: chibi-scheme$(EXE)
|
||||
$(CHIBI) -xchibi tests/numeric-tests.scm
|
||||
|
||||
test-flonums: chibi-scheme$(EXE)
|
||||
$(CHIBI) -xchibi tests/flonum-tests.scm
|
||||
|
||||
test-unicode: chibi-scheme$(EXE)
|
||||
$(CHIBI) -xchibi tests/unicode-tests.scm
|
||||
|
||||
|
@ -239,7 +236,8 @@ bench-gabriel: chibi-scheme$(EXE)
|
|||
# Packaging
|
||||
|
||||
clean: clean-libs
|
||||
-$(RM) *.o *.i *.s *.8 tests/basic/*.out tests/basic/*.err
|
||||
-$(RM) *.o *.i *.s *.8 tests/basic/*.out tests/basic/*.err \
|
||||
tests/run/*.out tests/run/*.err
|
||||
|
||||
cleaner: clean
|
||||
-$(RM) chibi-scheme$(EXE) chibi-scheme-static$(EXE) chibi-scheme-ulimit$(EXE) \
|
||||
|
|
33
tests/run/command-line-tests.sh
Executable file
33
tests/run/command-line-tests.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Test chibi-scheme command-line options.
|
||||
# Should be run from a standard build.
|
||||
|
||||
TESTDIR=$(dirname $0)
|
||||
FAILURES=0
|
||||
i=0
|
||||
|
||||
run_chibi() {
|
||||
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH DYLD_LIBRARY_PATH=.:$DYLD_LIBRARY_PATH CHIBI_MODULE_PATH=lib ./chibi-scheme "$@"
|
||||
}
|
||||
|
||||
for t in $TESTDIR/*.args; do
|
||||
IFS=$'\r\n' GLOBIGNORE='*' :; args=($(cat $t))
|
||||
run_chibi ${args[@]} 2> ${t%.args}.err > ${t%.args}.out
|
||||
if diff -w -q ${t%.args}.out ${t%.args}.res \
|
||||
&& ([ ! -e ${t%.args}.err-res ] || \
|
||||
diff -w -q ${t%.args}.err ${t%.args}.err-res); then
|
||||
echo "[PASS] $(basename ${t%.args})"
|
||||
else
|
||||
echo "[FAIL] $(basename ${t%.args})"
|
||||
FAILURES=$((FAILURES + 1))
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
if [ $FAILURES = 0 ]; then
|
||||
echo "command-line-tests: all ${i} tests passed"
|
||||
else
|
||||
echo "command-line-tests: ${FAILURES} out of ${i} tests failed"
|
||||
exit 1
|
||||
fi
|
8
tests/run/lib/fact.sld
Normal file
8
tests/run/lib/fact.sld
Normal file
|
@ -0,0 +1,8 @@
|
|||
(define-library (fact)
|
||||
(export fact)
|
||||
(import (scheme base))
|
||||
(begin
|
||||
(define (fact n)
|
||||
(if (< n 2)
|
||||
1
|
||||
(* n (fact (- n 1)))))))
|
4
tests/run/lib/fib.scm
Normal file
4
tests/run/lib/fib.scm
Normal file
|
@ -0,0 +1,4 @@
|
|||
(define (fib n)
|
||||
(if (< n 2)
|
||||
1
|
||||
(+ (fib (- n 1)) (fib (- n 2)))))
|
11
tests/run/lib/hello.sld
Normal file
11
tests/run/lib/hello.sld
Normal file
|
@ -0,0 +1,11 @@
|
|||
(define-library (hello)
|
||||
(import (scheme base))
|
||||
(begin
|
||||
(define (main args)
|
||||
(write-string "Hello, ")
|
||||
(write-string (if (pair? (cdr args)) (cadr args) "world!"))
|
||||
(newline))
|
||||
(define (bye args)
|
||||
(write-string "Goodbye, ")
|
||||
(write-string (if (pair? (cdr args)) (cadr args) "world!"))
|
||||
(newline))))
|
2
tests/run/test00-p.args
Normal file
2
tests/run/test00-p.args
Normal file
|
@ -0,0 +1,2 @@
|
|||
-p
|
||||
(map (lambda (x) (* x x)) '(0 1 2 3 4 5))
|
1
tests/run/test00-p.res
Normal file
1
tests/run/test00-p.res
Normal file
|
@ -0,0 +1 @@
|
|||
(0 1 4 9 16 25)
|
1
tests/run/test01-p-short.args
Normal file
1
tests/run/test01-p-short.args
Normal file
|
@ -0,0 +1 @@
|
|||
-p(map (lambda (x) (* x x)) '(0 1 2 3 4 5))
|
1
tests/run/test01-p-short.res
Normal file
1
tests/run/test01-p-short.res
Normal file
|
@ -0,0 +1 @@
|
|||
(0 1 4 9 16 25)
|
2
tests/run/test02-h.args
Normal file
2
tests/run/test02-h.args
Normal file
|
@ -0,0 +1,2 @@
|
|||
-h1M
|
||||
-p(map (lambda (x) (* x x)) '(0 1 2 3 4 5))
|
1
tests/run/test02-h.res
Normal file
1
tests/run/test02-h.res
Normal file
|
@ -0,0 +1 @@
|
|||
(0 1 4 9 16 25)
|
2
tests/run/test03-q.args
Normal file
2
tests/run/test03-q.args
Normal file
|
@ -0,0 +1,2 @@
|
|||
-q
|
||||
-p(map (lambda (x) (* x x)) '(0 1 2 3 4 5))
|
1
tests/run/test03-q.res
Normal file
1
tests/run/test03-q.res
Normal file
|
@ -0,0 +1 @@
|
|||
(0 1 4 9 16 25)
|
2
tests/run/test04-Q.args
Normal file
2
tests/run/test04-Q.args
Normal file
|
@ -0,0 +1,2 @@
|
|||
-Q
|
||||
-p(+ 2 2)
|
1
tests/run/test04-Q.res
Normal file
1
tests/run/test04-Q.res
Normal file
|
@ -0,0 +1 @@
|
|||
4
|
2
tests/run/test05-xscheme-r5rs.args
Normal file
2
tests/run/test05-xscheme-r5rs.args
Normal file
|
@ -0,0 +1,2 @@
|
|||
-x(scheme r5rs)
|
||||
-p(map (lambda (x) (* x x)) '(0 1 2 3 4 5))
|
1
tests/run/test05-xscheme-r5rs.res
Normal file
1
tests/run/test05-xscheme-r5rs.res
Normal file
|
@ -0,0 +1 @@
|
|||
(0 1 4 9 16 25)
|
2
tests/run/test06-xscheme-base.args
Normal file
2
tests/run/test06-xscheme-base.args
Normal file
|
@ -0,0 +1,2 @@
|
|||
-xscheme.base
|
||||
-p(map (lambda (x) (* x x)) '(0 1 2 3 4 5))
|
1
tests/run/test06-xscheme-base.res
Normal file
1
tests/run/test06-xscheme-base.res
Normal file
|
@ -0,0 +1 @@
|
|||
(0 1 4 9 16 25)
|
2
tests/run/test07-xchibi.args
Normal file
2
tests/run/test07-xchibi.args
Normal file
|
@ -0,0 +1,2 @@
|
|||
-x(chibi)
|
||||
-p(map (lambda (x) (* x x)) '(0 1 2 3 4 5))
|
1
tests/run/test07-xchibi.res
Normal file
1
tests/run/test07-xchibi.res
Normal file
|
@ -0,0 +1 @@
|
|||
(0 1 4 9 16 25)
|
2
tests/run/test08-xchibi-primitive.args
Normal file
2
tests/run/test08-xchibi-primitive.args
Normal file
|
@ -0,0 +1,2 @@
|
|||
-x(chibi primitive)
|
||||
-p(+ 2 2)
|
1
tests/run/test08-xchibi-primitive.res
Normal file
1
tests/run/test08-xchibi-primitive.res
Normal file
|
@ -0,0 +1 @@
|
|||
4
|
4
tests/run/test09-m.args
Normal file
4
tests/run/test09-m.args
Normal file
|
@ -0,0 +1,4 @@
|
|||
-m
|
||||
srfi.1
|
||||
-p
|
||||
(iota 5)
|
1
tests/run/test09-m.res
Normal file
1
tests/run/test09-m.res
Normal file
|
@ -0,0 +1 @@
|
|||
(0 1 2 3 4)
|
3
tests/run/test10-xscheme-base-m.args
Normal file
3
tests/run/test10-xscheme-base-m.args
Normal file
|
@ -0,0 +1,3 @@
|
|||
-x(scheme base)
|
||||
-m(srfi 1)
|
||||
-p(iota 5)
|
1
tests/run/test10-xscheme-base-m.res
Normal file
1
tests/run/test10-xscheme-base-m.res
Normal file
|
@ -0,0 +1 @@
|
|||
(0 1 2 3 4)
|
3
tests/run/test11-xscheme-r5rs-m.args
Normal file
3
tests/run/test11-xscheme-r5rs-m.args
Normal file
|
@ -0,0 +1,3 @@
|
|||
-xscheme.r5rs
|
||||
-m(srfi 1)
|
||||
-p(iota 5)
|
1
tests/run/test11-xscheme-r5rs-m.res
Normal file
1
tests/run/test11-xscheme-r5rs-m.res
Normal file
|
@ -0,0 +1 @@
|
|||
(0 1 2 3 4)
|
3
tests/run/test12-xchibi-m.args
Normal file
3
tests/run/test12-xchibi-m.args
Normal file
|
@ -0,0 +1,3 @@
|
|||
-xchibi
|
||||
-m(srfi 1)
|
||||
-p(iota 5)
|
1
tests/run/test12-xchibi-m.res
Normal file
1
tests/run/test12-xchibi-m.res
Normal file
|
@ -0,0 +1 @@
|
|||
(0 1 2 3 4)
|
3
tests/run/test13-A-m.args
Normal file
3
tests/run/test13-A-m.args
Normal file
|
@ -0,0 +1,3 @@
|
|||
-Atests/run/lib
|
||||
-mfact
|
||||
-p(fact 5)
|
1
tests/run/test13-A-m.res
Normal file
1
tests/run/test13-A-m.res
Normal file
|
@ -0,0 +1 @@
|
|||
120
|
2
tests/run/test14-R.args
Normal file
2
tests/run/test14-R.args
Normal file
|
@ -0,0 +1,2 @@
|
|||
-Atests/run/lib
|
||||
-Rhello
|
1
tests/run/test14-R.res
Normal file
1
tests/run/test14-R.res
Normal file
|
@ -0,0 +1 @@
|
|||
Hello, world!
|
4
tests/run/test15-R-args.args
Normal file
4
tests/run/test15-R-args.args
Normal file
|
@ -0,0 +1,4 @@
|
|||
-Atests/run/lib
|
||||
-Rhello
|
||||
--
|
||||
Schemer!
|
1
tests/run/test15-R-args.res
Normal file
1
tests/run/test15-R-args.res
Normal file
|
@ -0,0 +1 @@
|
|||
Hello, Schemer!
|
3
tests/run/test16-R-r.args
Normal file
3
tests/run/test16-R-r.args
Normal file
|
@ -0,0 +1,3 @@
|
|||
-Atests/run/lib
|
||||
-Rhello
|
||||
-rbye
|
1
tests/run/test16-R-r.res
Normal file
1
tests/run/test16-R-r.res
Normal file
|
@ -0,0 +1 @@
|
|||
Goodbye, world!
|
5
tests/run/test17-R-r-args.args
Normal file
5
tests/run/test17-R-r-args.args
Normal file
|
@ -0,0 +1,5 @@
|
|||
-Atests/run/lib
|
||||
-Rhello
|
||||
-rbye
|
||||
--
|
||||
Schemer!
|
1
tests/run/test17-R-r-args.res
Normal file
1
tests/run/test17-R-r-args.res
Normal file
|
@ -0,0 +1 @@
|
|||
Goodbye, Schemer!
|
3
tests/run/test18-t.args
Normal file
3
tests/run/test18-t.args
Normal file
|
@ -0,0 +1,3 @@
|
|||
-msrfi.1
|
||||
-tsrfi.1.append-reverse
|
||||
-p(append-reverse (quote(3 2 1)) (quote(4 5)))
|
8
tests/run/test18-t.err-res
Normal file
8
tests/run/test18-t.err-res
Normal file
|
@ -0,0 +1,8 @@
|
|||
> (append-reverse (3 2 1) (4 5))
|
||||
| > (append-reverse (2 1) (3 4 5))
|
||||
| | > (append-reverse (1) (2 3 4 5))
|
||||
| | | > (append-reverse () (1 2 3 4 5))
|
||||
| | | (1 2 3 4 5)
|
||||
| | (1 2 3 4 5)
|
||||
| (1 2 3 4 5)
|
||||
(1 2 3 4 5)
|
1
tests/run/test18-t.res
Normal file
1
tests/run/test18-t.res
Normal file
|
@ -0,0 +1 @@
|
|||
(1 2 3 4 5)
|
3
tests/run/test19-l.args
Normal file
3
tests/run/test19-l.args
Normal file
|
@ -0,0 +1,3 @@
|
|||
-Atests/run/lib
|
||||
-lfib.scm
|
||||
-p(fib 5)
|
1
tests/run/test19-l.res
Normal file
1
tests/run/test19-l.res
Normal file
|
@ -0,0 +1 @@
|
|||
8
|
Loading…
Add table
Reference in a new issue