3 echo ' ()' | cat $($(dirname $0)/../scripts/include.mes $0) $0 /dev/stdin | $(dirname $0)/../scripts/mes "$@"
10 ;;; Mes --- Maxwell Equations of Software
11 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
13 ;;; base.test: This file is part of Mes.
15 ;;; Mes is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; Mes is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with Mes. If not, see <http://www.gnu.org/licenses/>.
28 (mes-use-module (mes base-0))
29 (mes-use-module (mes base))
30 (mes-use-module (mes test))
32 (pass-if "first dummy" #t)
33 (pass-if-not "second dummy" #f)
36 (pass-if "begin" (seq? (begin 'a 'b (+ 1 2)) 3))
37 (pass-if "lambda" (symbol? 'lambda))
39 (begin (define *top-begin-a* '*top-begin-a*))
40 (pass-if "top begin " (seq? *top-begin-a* '*top-begin-a*))
42 (pass-if "if" (seq? (if #t 'true) 'true))
43 (pass-if "if 2" (seq? (if #f #f) *unspecified*))
44 (pass-if "if 3" (seq? (if (seq? 0 '0) 'true 'false) 'true))
45 (pass-if "if 4" (seq? (if (= 1 2) 'true 'false) 'false))
47 ;;(pass-if ">=" (seq? (>= 3 2 1) #t))
51 (pass-if "cond" (seq? (cond (#f #f) (#t #t)) #t))
52 (pass-if "cond" (seq? (cond (#t)) #t))
53 (pass-if "cond 2" (seq? (cond (#f)) *unspecified*))
54 (pass-if "cond 3" (seq? (cond (#t 0)) 0))
55 (pass-if "cond 3" (seq? (cond (#f 1) (#t 0)) 0)))
58 (pass-if "and" (seq? (and 1) 1))
59 (pass-if "and 2" (seq? (and 1 (= 0 1) #f) #f))
60 (pass-if "or" (seq? (or) #f))
61 (pass-if "or 2" (seq? (or 1) 1))
62 (pass-if "or 3" (seq? (or #f (= 0 1) 3) 3))
63 (pass-if "or 4" (seq? (or (= 0 0) (= 0 1)) #t))
64 (pass-if "or 5" (seq? (or (= 0 1) (= 0 0)) #t))
65 (pass-if "let" (seq? (let () 0) 0))
66 (pass-if "let 2" (seq? (let ((x 0)) x) 0))
67 (pass-if "let 3" (seq? (let ((p 5) (q 6)) (+ p q)) 11))
69 (pass-if "apply" (sequal? (apply list '(1)) '(1)))
70 (pass-if "apply 2" (sequal? (apply list 1 '(2)) '(1 2)))
71 (pass-if "apply 3" (sequal? (apply list 1 2 '(3)) '(1 2 3)))
74 (define local-answer 41))
75 (pass-if-equal "begin 2" 41 (begin local-answer))
78 (pass-if-equal "load" 42 (begin (load "tests/data/load.scm") the-answer)))