diff options
author | Daniel Cerqueira <dan.git@lispclub.com> | 2025-05-28 12:37:55 +0100 |
---|---|---|
committer | Daniel Cerqueira <dan.git@lispclub.com> | 2025-05-28 12:37:55 +0100 |
commit | 1c217ee6ac5aacd2f37b1d0e69a71ac94afd5acd (patch) | |
tree | a808042b0a0c4ea180c128cc49e2198bb29850a4 /test |
Init lali programming language.
Diffstat (limited to 'test')
-rw-r--r-- | test/main.lali | 40 | ||||
-rwxr-xr-x | test/other/executables/emacs.el | 3 | ||||
-rwxr-xr-x | test/other/executables/empty.lisp | 0 | ||||
-rwxr-xr-x | test/other/executables/script.lali | 4 | ||||
-rw-r--r-- | test/other/lexical.lali | 15 | ||||
-rw-r--r-- | test/other/mundo.lali | 4 | ||||
-rw-r--r-- | test/other/ola.lali | 3 | ||||
-rw-r--r-- | test/other/universal.lali | 1 |
8 files changed, 70 insertions, 0 deletions
diff --git a/test/main.lali b/test/main.lali new file mode 100644 index 0000000..a3e4b9a --- /dev/null +++ b/test/main.lali @@ -0,0 +1,40 @@ +(defun test (test-expr res) + (princ + (list (fill + ((differ (eval test-expr) res) 'ok) + ('f 'fail)) + '--> test-expr)) + (newline)) + +;; atom +(test '(atom 'a) t) +(test '(atom '(x . a)) f) +;(test '(atom 'a) undef) + +;; dif +(test '(dif 'a 'b) t) +(test '(dif 'a 'a) f) +(test '(dif 'a '(b . c)) t) +(test '(dif '(b . c) '(b . c)) t) + +;; car +(test '(car '(a . b)) 'a) +(test '(car '((a . b) . c)) '(a . b)) +;(test '(car 'a) undef) + +;; cdr +(test '(cdr '(a . b)) 'b) +(test '(cdr '((a . b) . c)) 'c) +;(test '(cdr 'a) undef) + +;; cons +(test '(cons 'a 'b) '(a . b)) +(test '(cons '(a . b) 'c) '((a . b) . c)) + +;; or +(test '(or t (car 'a)) t) +;(test '(or (car 'a) t) undef) + +;; and +(test '(and f (car 'a)) f) +;(test '(and (car 'a) f) undef) diff --git a/test/other/executables/emacs.el b/test/other/executables/emacs.el new file mode 100755 index 0000000..e7e2efc --- /dev/null +++ b/test/other/executables/emacs.el @@ -0,0 +1,3 @@ +#!/usr/local/bin/emacs --script + +(princ 'i) diff --git a/test/other/executables/empty.lisp b/test/other/executables/empty.lisp new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/test/other/executables/empty.lisp diff --git a/test/other/executables/script.lali b/test/other/executables/script.lali new file mode 100755 index 0000000..934323d --- /dev/null +++ b/test/other/executables/script.lali @@ -0,0 +1,4 @@ +#!/home/guest/me/programming/desktop/lisp/interpreter/lali/lali -c + +(princ "ola") +(newline) diff --git a/test/other/lexical.lali b/test/other/lexical.lali new file mode 100644 index 0000000..d8d94e2 --- /dev/null +++ b/test/other/lexical.lali @@ -0,0 +1,15 @@ +(set 'a '1) + +(defun j () + (princ a) + (set 'a (+ a 1))) + +(j) +(j) +(princ a) + +(defun i () + (set 'b 9)) + +(i) +(princ b) diff --git a/test/other/mundo.lali b/test/other/mundo.lali new file mode 100644 index 0000000..19756fe --- /dev/null +++ b/test/other/mundo.lali @@ -0,0 +1,4 @@ +(princ 'proc) +(princ (list a 'ola)) +(print "mundo") +(print '(ate breve)) diff --git a/test/other/ola.lali b/test/other/ola.lali new file mode 100644 index 0000000..d62a537 --- /dev/null +++ b/test/other/ola.lali @@ -0,0 +1,3 @@ +(princ "ola") +(newline) +(set 'a 1) diff --git a/test/other/universal.lali b/test/other/universal.lali new file mode 100644 index 0000000..6b38b19 --- /dev/null +++ b/test/other/universal.lali @@ -0,0 +1 @@ +(princ 'i) |