1- (defun main (args )
2- (System.Console.WriteLine "Naggum test suite" )
1+ (defun test-funcall (test-arg )
2+ (System.Console.WriteLine test-arg) )
33
4- (System.Console.WriteLine "Conditionals")
4+ (defun test-conditionals ()
5+ (System.Console.WriteLine "Conditionals:")
56 (if 1 (System.Console.WriteLine "Reduced if: OK"))
67 (if 1
78 (System.Console.WriteLine "Full if (true branch): OK")
8- (System.Console.WriteLine "Full if (true branch): FAILURE"))
9+ (System.Console.WriteLine "Full if (true branch): FAILURE"))
910 (if 0
1011 (System.Console.WriteLine "Full if (false branch): FAILURE")
11- (System.Console.WriteLine "Full if (false branch): OK"))
12-
12+ (System.Console.WriteLine "Full if (false branch): OK")))
13+
14+ (defun test-let ()
1315 (System.Console.Write "Let: ")
1416 (let ((ok "OK"))
15- (System.Console.WriteLine ok))
16-
17+ (System.Console.WriteLine ok)))
18+
19+ (defun test-quote ()
1720 (System.Console.WriteLine "Quoting:")
1821 (System.Console.Write "Symbol: ") (System.Console.WriteLine (quote OK))
19- (System.Console.Write "List: ") (System.Console.WriteLine (quote (OK)))
22+ (System.Console.Write "List: ") (System.Console.WriteLine (quote (OK))))
2023
24+ (defun test-new ()
2125 (System.Console.Write "Object construction: ")
2226 (let ((ok-sym (new Naggum.Runtime.Symbol "OK")))
23- (System.Console.WriteLine ok-sym))
24-
27+ (System.Console.WriteLine ok-sym)))
28+
29+ (defun test-cons ()
2530 (System.Console.WriteLine "Cons:")
2631 (let ((test-car (new Naggum.Runtime.Cons "OK" "FAILURE"))
2732 (test-cdr (new Naggum.Runtime.Cons "FAILURE" "OK")))
2833 (System.Console.Write "CAR: ") (System.Console.WriteLine (Naggum.Runtime.Cons.Car test-car))
29- (System.Console.Write "CDR: ") (System.Console.WriteLine (Naggum.Runtime.Cons.Cdr test-cdr)))
30-
34+ (System.Console.Write "CDR: ") (System.Console.WriteLine (Naggum.Runtime.Cons.Cdr test-cdr))))
35+
36+ (defun test-math ()
3137 (System.Console.WriteLine "Math:")
38+ (System.Console.WriteLine "Integers:")
3239 (System.Console.Write "2+2=") (System.Console.WriteLine (+ 2 2))
3340 (System.Console.Write "2-2=") (System.Console.WriteLine (- 2 2))
3441 (System.Console.Write "2*3=") (System.Console.WriteLine (* 2 3))
35- (System.Console.Write "2/2=") (System.Console.WriteLine (/ 2 2)))
42+ (System.Console.Write "2/2=") (System.Console.WriteLine (/ 2 2))
43+
44+ (System.Console.WriteLine "Floats")
45+ (System.Console.Write "2.0 + 0.5=") (System.Console.WriteLine (+ 2.0 0.5))
46+ (System.Console.Write "3.0 - 1.5=") (System.Console.WriteLine (- 3.0 1.5))
47+ (System.Console.Write "2.0 * 0.7=") (System.Console.WriteLine (* 2.0 0.7))
48+ (System.Console.Write "3.0 / 2.0=") (System.Console.WriteLine (/ 3.0 2.0)))
49+
50+ (System.Console.WriteLine "Naggum test suite")
51+
52+ (System.Console.Write "Functions: ")
53+ (test-funcall "OK")
54+
55+ (test-conditionals)
56+ (test-let)
57+ (test-quote)
58+ (test-new)
59+ (test-cons)
60+ (test-math)
0 commit comments