tests.l 915 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. (def foo (fn "foo"))
  2. (foo)
  3. (cons 1 2)
  4. (cons "foo" 1)
  5. (cons 1 "foo")
  6. (cons "a" (cons "b" "c"))
  7. (def test (fn tn tx (cons (cons "test " tn) (if tx "OK" "FAIL"))))
  8. (def = (fn a b (if (- a b) 0 1)))
  9. (def not (fn a (if a 0 1)))
  10. (test 1 (= 1 1))
  11. (test 2 (= 2 2))
  12. (test 3 (not (= 1 0)))
  13. (test 4 (not (= 0 1)))
  14. (test 5 (not (= "hello" "hello")))
  15. (test 6 (= + +))
  16. (test 7 (= (+ 1 2) (+ 2 1)))
  17. (test 8 (def a 1))
  18. (test 9 (not (= a (def b (+ a 1)))))
  19. (test 10 (= a a))
  20. (test 11 (= b 2))
  21. (test 12 (= 4 (do 1 2 "foo" 4)))
  22. (test 13 (= 3 (size (do 1 2 "foo"))))
  23. ;(def fib (fn n (if (lt n 3)
  24. ; 1
  25. ; (+ (fib (- n 1)) (fib (- n 2))) )))
  26. (test 14 (= (fib 10) 55))
  27. (def foo (fn a b (+ a b)))
  28. (test 15 (do (def a 5) (def b 6) (= (foo (+ a 1) (- b 2)) 10)))
  29. (def func-a (fn xx yy (* (+ xx 1) (+ yy 1))))
  30. (def func-b (fn x y (func-a x y)))
  31. (def tst (fn a b (blit-mono unifont a b 0 0 0 0 0 0)))