Skip to content
Browse files

Add tests for _t-univ.scm back-end.

  • Loading branch information...
1 parent 62bedea commit 5da10a799ebd22cdc9c0955c81a988951e773a9d @feeley committed Jun 5, 2012
Showing with 542 additions and 74 deletions.
  1. +6 −0 gsc/tests/0-fixnum/README
  2. +5 −0 gsc/tests/0-fixnum/if.scm
  3. +0 −7 gsc/tests/{ → 0-fixnum}/println.scm
  4. +11 −0 gsc/tests/1-boolean/README
  5. +33 −0 gsc/tests/1-boolean/and.scm
  6. +10 −0 gsc/tests/1-boolean/if.scm
  7. +12 −0 gsc/tests/1-boolean/not.scm
  8. +33 −0 gsc/tests/1-boolean/or.scm
  9. +7 −0 gsc/tests/1-boolean/println.scm
  10. +13 −0 gsc/tests/2-string/README
  11. +29 −0 gsc/tests/2-string/and.scm
  12. +15 −0 gsc/tests/2-string/eq.scm
  13. +10 −0 gsc/tests/2-string/if.scm
  14. +10 −0 gsc/tests/2-string/not.scm
  15. +29 −0 gsc/tests/2-string/or.scm
  16. +2 −0 gsc/tests/2-string/println.scm
  17. +27 −0 gsc/tests/3-fxprim/README
  18. +15 −0 gsc/tests/3-fxprim/fixnum.scm
  19. 0 gsc/tests/{ → 3-fxprim}/fxadd.scm
  20. +6 −0 gsc/tests/3-fxprim/fxaddp.scm
  21. +18 −0 gsc/tests/3-fxprim/fxeq.scm
  22. 0 gsc/tests/{ → 3-fxprim}/fxfib.scm
  23. +18 −0 gsc/tests/3-fxprim/fxge.scm
  24. +18 −0 gsc/tests/3-fxprim/fxgt.scm
  25. +18 −0 gsc/tests/3-fxprim/fxle.scm
  26. +18 −0 gsc/tests/3-fxprim/fxlt.scm
  27. +6 −0 gsc/tests/3-fxprim/fxmul.scm
  28. +6 −0 gsc/tests/3-fxprim/fxsub.scm
  29. +6 −0 gsc/tests/3-fxprim/fxsubp.scm
  30. +6 −0 gsc/tests/3-fxprim/fxwrapadd.scm
  31. +6 −0 gsc/tests/3-fxprim/fxwrapmul.scm
  32. +6 −0 gsc/tests/3-fxprim/fxwrapsub.scm
  33. +14 −0 gsc/tests/4-strprim/README
  34. +3 −0 gsc/tests/4-strprim/makestr.scm
  35. +5 −0 gsc/tests/4-strprim/strref.scm
  36. +7 −0 gsc/tests/4-strprim/strset.scm
  37. +29 −0 gsc/tests/5-flonum/and.scm
  38. +15 −0 gsc/tests/5-flonum/eq.scm
  39. +10 −0 gsc/tests/5-flonum/if.scm
  40. +10 −0 gsc/tests/5-flonum/not.scm
  41. +29 −0 gsc/tests/5-flonum/or.scm
  42. +2 −0 gsc/tests/5-flonum/println.scm
  43. +17 −0 gsc/tests/6-flprim/flonum.scm
  44. +0 −26 gsc/tests/eq.scm
  45. +0 −11 gsc/tests/fixnum.scm
  46. +0 −11 gsc/tests/flonum.scm
  47. +0 −17 gsc/tests/not.scm
  48. +2 −2 include/stamp.h
View
6 gsc/tests/0-fixnum/README
@@ -0,0 +1,6 @@
+This directory contains extremely basic tests of the compiler.
+
+The only data type required by these tests is fixnum integers.
+
+The only primitive procedure required by these tests is
+println which is always used to print a single fixnum.
View
5 gsc/tests/0-fixnum/if.scm
@@ -0,0 +1,5 @@
+(define (test x)
+ (println (if x 11 22)))
+
+(test 0)
+(test 123)
View
7 gsc/tests/println.scm → gsc/tests/0-fixnum/println.scm
@@ -3,10 +3,3 @@
(println -1)
(println 123456789)
(println -123456789)
-
-(println #t)
-(println #f)
-
-(println "hello")
-
-(println 1.5)
View
11 gsc/tests/1-boolean/README
@@ -0,0 +1,11 @@
+This directory contains very basic tests of the compiler.
+
+The only data types required by these tests are:
+
+- fixnum integers
+- booleans
+
+The only primitive procedures required by these tests are:
+
+- println: which is always used to print a single fixnum or boolean
+- ##not
View
33 gsc/tests/1-boolean/and.scm
@@ -0,0 +1,33 @@
+(declare (extended-bindings))
+
+(define f (##not 123))
+(define t (##not f))
+
+(define (test2 x y)
+ (println (and x y))
+ (println (if (and x y) 11 22))
+ (println (and (##not x) y))
+ (println (if (and (##not x) y) 11 22))
+ (println (and x (##not y)))
+ (println (if (and x (##not y)) 11 22))
+ (println (and (##not x) (##not y)))
+ (println (if (and (##not x) (##not y)) 11 22))
+ (println (##not (and x y)))
+ (println (if (##not (and x y)) 11 22))
+ (println (##not (and (##not x) y)))
+ (println (if (##not (and (##not x) y)) 11 22))
+ (println (##not (and x (##not y))))
+ (println (if (##not (and x (##not y))) 11 22))
+ (println (##not (and (##not x) (##not y))))
+ (println (if (##not (and (##not x) (##not y))) 11 22)))
+
+(define (test x)
+ (test2 x f)
+ (test2 x t)
+ (test2 x 0)
+ (test2 x 1))
+
+(test f)
+(test t)
+(test 0)
+(test 1)
View
10 gsc/tests/1-boolean/if.scm
@@ -0,0 +1,10 @@
+(declare (extended-bindings))
+
+(define f (##not 123))
+(define t (##not f))
+
+(define (test x)
+ (println (if x 11 22)))
+
+(test f)
+(test t)
View
12 gsc/tests/1-boolean/not.scm
@@ -0,0 +1,12 @@
+(declare (extended-bindings))
+
+(define f (##not 123))
+(define t (##not f))
+
+(define (test x)
+ (println (if (##not x) 11 22)))
+
+(test 0)
+(test 1)
+(test f)
+(test t)
View
33 gsc/tests/1-boolean/or.scm
@@ -0,0 +1,33 @@
+(declare (extended-bindings))
+
+(define f (##not 123))
+(define t (##not f))
+
+(define (test2 x y)
+ (println (or x y))
+ (println (if (or x y) 11 22))
+ (println (or (##not x) y))
+ (println (if (or (##not x) y) 11 22))
+ (println (or x (##not y)))
+ (println (if (or x (##not y)) 11 22))
+ (println (or (##not x) (##not y)))
+ (println (if (or (##not x) (##not y)) 11 22))
+ (println (##not (or x y)))
+ (println (if (##not (or x y)) 11 22))
+ (println (##not (or (##not x) y)))
+ (println (if (##not (or (##not x) y)) 11 22))
+ (println (##not (or x (##not y))))
+ (println (if (##not (or x (##not y))) 11 22))
+ (println (##not (or (##not x) (##not y))))
+ (println (if (##not (or (##not x) (##not y))) 11 22)))
+
+(define (test x)
+ (test2 x f)
+ (test2 x t)
+ (test2 x 0)
+ (test2 x 1))
+
+(test f)
+(test t)
+(test 0)
+(test 1)
View
7 gsc/tests/1-boolean/println.scm
@@ -0,0 +1,7 @@
+(declare (extended-bindings))
+
+(define f (##not 123))
+(define t (##not f))
+
+(println f)
+(println t)
View
13 gsc/tests/2-string/README
@@ -0,0 +1,13 @@
+This directory contains basic tests of the compiler.
+
+The only data types required by these tests are:
+
+- fixnum integers
+- booleans
+- strings
+
+The only primitive procedures required by these tests are:
+
+- println: which is always used to print a single fixnum, boolean or string
+- ##not
+- ##eq?
View
29 gsc/tests/2-string/and.scm
@@ -0,0 +1,29 @@
+(declare (extended-bindings))
+
+(define s1 "")
+(define s2 "hello")
+
+(define (test2 x y)
+ (println (and x y))
+ (println (if (and x y) 11 22))
+ (println (and (##not x) y))
+ (println (if (and (##not x) y) 11 22))
+ (println (and x (##not y)))
+ (println (if (and x (##not y)) 11 22))
+ (println (and (##not x) (##not y)))
+ (println (if (and (##not x) (##not y)) 11 22))
+ (println (##not (and x y)))
+ (println (if (##not (and x y)) 11 22))
+ (println (##not (and (##not x) y)))
+ (println (if (##not (and (##not x) y)) 11 22))
+ (println (##not (and x (##not y))))
+ (println (if (##not (and x (##not y))) 11 22))
+ (println (##not (and (##not x) (##not y))))
+ (println (if (##not (and (##not x) (##not y))) 11 22)))
+
+(define (test x)
+ (test2 x s1)
+ (test2 x s2))
+
+(test s1)
+(test s2)
View
15 gsc/tests/2-string/eq.scm
@@ -0,0 +1,15 @@
+(declare (extended-bindings))
+
+(define s1 "")
+(define s2 "hello")
+
+(define (test2 x y)
+ (println (##eq? x y))
+ (println (if (##eq? x y) 11 22)))
+
+(define (test x)
+ (test2 x s1)
+ (test2 x s2))
+
+(test s1)
+(test s2)
View
10 gsc/tests/2-string/if.scm
@@ -0,0 +1,10 @@
+(declare (extended-bindings))
+
+(define s1 "")
+(define s2 "hello")
+
+(define (test x)
+ (println (if x 11 22)))
+
+(test s1)
+(test s2)
View
10 gsc/tests/2-string/not.scm
@@ -0,0 +1,10 @@
+(declare (extended-bindings))
+
+(define s1 "")
+(define s2 "hello")
+
+(define (test x)
+ (println (if (##not x) 11 22)))
+
+(test s1)
+(test s2)
View
29 gsc/tests/2-string/or.scm
@@ -0,0 +1,29 @@
+(declare (extended-bindings))
+
+(define s1 "")
+(define s2 "hello")
+
+(define (test2 x y)
+ (println (or x y))
+ (println (if (or x y) 11 22))
+ (println (or (##not x) y))
+ (println (if (or (##not x) y) 11 22))
+ (println (or x (##not y)))
+ (println (if (or x (##not y)) 11 22))
+ (println (or (##not x) (##not y)))
+ (println (if (or (##not x) (##not y)) 11 22))
+ (println (##not (or x y)))
+ (println (if (##not (or x y)) 11 22))
+ (println (##not (or (##not x) y)))
+ (println (if (##not (or (##not x) y)) 11 22))
+ (println (##not (or x (##not y))))
+ (println (if (##not (or x (##not y))) 11 22))
+ (println (##not (or (##not x) (##not y))))
+ (println (if (##not (or (##not x) (##not y))) 11 22)))
+
+(define (test x)
+ (test2 x s1)
+ (test2 x s2))
+
+(test s1)
+(test s2)
View
2 gsc/tests/2-string/println.scm
@@ -0,0 +1,2 @@
+(println "")
+(println "hello")
View
27 gsc/tests/3-fxprim/README
@@ -0,0 +1,27 @@
+This directory contains basic tests of the compiler.
+
+The only data types required by these tests are:
+
+- fixnum integers
+- booleans
+- strings
+
+The only primitive procedures required by these tests are:
+
+- println: which is always used to print a single fixnum, boolean or string
+- ##not
+- ##fixnum?
+- ##fx+: which is only used with 2 fixnum parameters
+- ##fx+?: which is only used with 2 fixnum parameters
+- ##fxwrap+: which is only used with 2 fixnum parameters
+- ##fx-: which is only used with 2 fixnum parameters
+- ##fx-?: which is only used with 2 fixnum parameters
+- ##fxwrap-: which is only used with 2 fixnum parameters
+- ##fx*: which is only used with 2 fixnum parameters
+- ##fx*?: which is only used with 2 fixnum parameters
+- ##fxwrap*: which is only used with 2 fixnum parameters
+- ##fx=: which is only used with 2 fixnum parameters
+- ##fx<: which is only used with 2 fixnum parameters
+- ##fx>: which is only used with 2 fixnum parameters
+- ##fx<=: which is only used with 2 fixnum parameters
+- ##fx>=: which is only used with 2 fixnum parameters
View
15 gsc/tests/3-fxprim/fixnum.scm
@@ -0,0 +1,15 @@
+(declare (extended-bindings))
+
+(define f (##not 123))
+(define t (##not f))
+(define s "")
+
+(define (test x)
+ (println (##fixnum? x))
+ (println (if (##fixnum? x) 11 22)))
+
+(test 0)
+(test 1)
+(test f)
+(test t)
+(test s)
View
0 gsc/tests/fxadd.scm → gsc/tests/3-fxprim/fxadd.scm
File renamed without changes.
View
6 gsc/tests/3-fxprim/fxaddp.scm
@@ -0,0 +1,6 @@
+(declare (extended-bindings) (not safe))
+
+(println (##fx+? 11 33))
+(println (##fx+? 11 -11))
+(println (##fx+? 11 -33))
+(println (##fx+? -11 33))
View
18 gsc/tests/3-fxprim/fxeq.scm
@@ -0,0 +1,18 @@
+(declare (extended-bindings) (not safe))
+
+(define a 11)
+(define b 11)
+(define c 22)
+
+(define (test2 x y)
+ (println (##fx= x y))
+ (println (if (##fx= x y) 11 22)))
+
+(define (test x)
+ (test2 x a)
+ (test2 x b)
+ (test2 x c))
+
+(test a)
+(test b)
+(test c)
View
0 gsc/tests/fxfib.scm → gsc/tests/3-fxprim/fxfib.scm
File renamed without changes.
View
18 gsc/tests/3-fxprim/fxge.scm
@@ -0,0 +1,18 @@
+(declare (extended-bindings) (not safe))
+
+(define a 11)
+(define b 11)
+(define c 22)
+
+(define (test2 x y)
+ (println (##fx>= x y))
+ (println (if (##fx>= x y) 11 22)))
+
+(define (test x)
+ (test2 x a)
+ (test2 x b)
+ (test2 x c))
+
+(test a)
+(test b)
+(test c)
View
18 gsc/tests/3-fxprim/fxgt.scm
@@ -0,0 +1,18 @@
+(declare (extended-bindings) (not safe))
+
+(define a 11)
+(define b 11)
+(define c 22)
+
+(define (test2 x y)
+ (println (##fx> x y))
+ (println (if (##fx> x y) 11 22)))
+
+(define (test x)
+ (test2 x a)
+ (test2 x b)
+ (test2 x c))
+
+(test a)
+(test b)
+(test c)
View
18 gsc/tests/3-fxprim/fxle.scm
@@ -0,0 +1,18 @@
+(declare (extended-bindings) (not safe))
+
+(define a 11)
+(define b 11)
+(define c 22)
+
+(define (test2 x y)
+ (println (##fx<= x y))
+ (println (if (##fx<= x y) 11 22)))
+
+(define (test x)
+ (test2 x a)
+ (test2 x b)
+ (test2 x c))
+
+(test a)
+(test b)
+(test c)
View
18 gsc/tests/3-fxprim/fxlt.scm
@@ -0,0 +1,18 @@
+(declare (extended-bindings) (not safe))
+
+(define a 11)
+(define b 11)
+(define c 22)
+
+(define (test2 x y)
+ (println (##fx< x y))
+ (println (if (##fx< x y) 11 22)))
+
+(define (test x)
+ (test2 x a)
+ (test2 x b)
+ (test2 x c))
+
+(test a)
+(test b)
+(test c)
View
6 gsc/tests/3-fxprim/fxmul.scm
@@ -0,0 +1,6 @@
+(declare (extended-bindings) (not safe))
+
+(println (##fx* 11 33))
+(println (##fx* 11 -11))
+(println (##fx* 11 -33))
+(println (##fx* -11 33))
View
6 gsc/tests/3-fxprim/fxsub.scm
@@ -0,0 +1,6 @@
+(declare (extended-bindings) (not safe))
+
+(println (##fx- 11 33))
+(println (##fx- 11 -11))
+(println (##fx- 11 -33))
+(println (##fx- -11 33))
View
6 gsc/tests/3-fxprim/fxsubp.scm
@@ -0,0 +1,6 @@
+(declare (extended-bindings) (not safe))
+
+(println (##fx-? 11 33))
+(println (##fx-? 11 -11))
+(println (##fx-? 11 -33))
+(println (##fx-? -11 33))
View
6 gsc/tests/3-fxprim/fxwrapadd.scm
@@ -0,0 +1,6 @@
+(declare (extended-bindings) (not safe))
+
+(println (##fxwrap+ 11 33))
+(println (##fxwrap+ 11 -11))
+(println (##fxwrap+ 11 -33))
+(println (##fxwrap+ -11 33))
View
6 gsc/tests/3-fxprim/fxwrapmul.scm
@@ -0,0 +1,6 @@
+(declare (extended-bindings) (not safe))
+
+(println (##fxwrap* 11 33))
+(println (##fxwrap* 11 -11))
+(println (##fxwrap* 11 -33))
+(println (##fxwrap* -11 33))
View
6 gsc/tests/3-fxprim/fxwrapsub.scm
@@ -0,0 +1,6 @@
+(declare (extended-bindings) (not safe))
+
+(println (##fxwrap- 11 33))
+(println (##fxwrap- 11 -11))
+(println (##fxwrap- 11 -33))
+(println (##fxwrap- -11 33))
View
14 gsc/tests/4-strprim/README
@@ -0,0 +1,14 @@
+This directory contains basic tests of the compiler.
+
+The only data types required by these tests are:
+
+- fixnum integers
+- booleans
+- strings
+
+The only primitive procedures required by these tests are:
+
+- println: which is always used to print a single fixnum, boolean or string
+- ##make-string
+- ##string-ref
+- ##string-set!
View
3 gsc/tests/4-strprim/makestr.scm
@@ -0,0 +1,3 @@
+(declare (extended-bindings) (not safe))
+
+(println (##make-string 5 #\!))
View
5 gsc/tests/4-strprim/strref.scm
@@ -0,0 +1,5 @@
+(declare (extended-bindings) (not safe))
+
+(define s "abcdef")
+
+(println (##string-ref s 3))
View
7 gsc/tests/4-strprim/strset.scm
@@ -0,0 +1,7 @@
+(declare (extended-bindings) (not safe))
+
+(define s (##make-string 5 #\!))
+
+(##string-set! s 3 #\x)
+
+(println s)
View
29 gsc/tests/5-flonum/and.scm
@@ -0,0 +1,29 @@
+(declare (extended-bindings))
+
+(define a 0.0)
+(define b -2.7)
+
+(define (test2 x y)
+ (println (and x y))
+ (println (if (and x y) 11 22))
+ (println (and (##not x) y))
+ (println (if (and (##not x) y) 11 22))
+ (println (and x (##not y)))
+ (println (if (and x (##not y)) 11 22))
+ (println (and (##not x) (##not y)))
+ (println (if (and (##not x) (##not y)) 11 22))
+ (println (##not (and x y)))
+ (println (if (##not (and x y)) 11 22))
+ (println (##not (and (##not x) y)))
+ (println (if (##not (and (##not x) y)) 11 22))
+ (println (##not (and x (##not y))))
+ (println (if (##not (and x (##not y))) 11 22))
+ (println (##not (and (##not x) (##not y))))
+ (println (if (##not (and (##not x) (##not y))) 11 22)))
+
+(define (test x)
+ (test2 x a)
+ (test2 x b))
+
+(test a)
+(test b)
View
15 gsc/tests/5-flonum/eq.scm
@@ -0,0 +1,15 @@
+(declare (extended-bindings))
+
+(define a 0.0)
+(define b -2.7)
+
+(define (test2 x y)
+ (println (##eq? x y))
+ (println (if (##eq? x y) 11 22)))
+
+(define (test x)
+ (test2 x a)
+ (test2 x b))
+
+(test a)
+(test b)
View
10 gsc/tests/5-flonum/if.scm
@@ -0,0 +1,10 @@
+(declare (extended-bindings))
+
+(define a 0.0)
+(define b -2.7)
+
+(define (test x)
+ (println (if x 11 22)))
+
+(test a)
+(test b)
View
10 gsc/tests/5-flonum/not.scm
@@ -0,0 +1,10 @@
+(declare (extended-bindings))
+
+(define a 0.0)
+(define b -2.7)
+
+(define (test x)
+ (println (if (##not x) 11 22)))
+
+(test a)
+(test b)
View
29 gsc/tests/5-flonum/or.scm
@@ -0,0 +1,29 @@
+(declare (extended-bindings))
+
+(define a 0.0)
+(define b -2.7)
+
+(define (test2 x y)
+ (println (or x y))
+ (println (if (or x y) 11 22))
+ (println (or (##not x) y))
+ (println (if (or (##not x) y) 11 22))
+ (println (or x (##not y)))
+ (println (if (or x (##not y)) 11 22))
+ (println (or (##not x) (##not y)))
+ (println (if (or (##not x) (##not y)) 11 22))
+ (println (##not (or x y)))
+ (println (if (##not (or x y)) 11 22))
+ (println (##not (or (##not x) y)))
+ (println (if (##not (or (##not x) y)) 11 22))
+ (println (##not (or x (##not y))))
+ (println (if (##not (or x (##not y))) 11 22))
+ (println (##not (or (##not x) (##not y))))
+ (println (if (##not (or (##not x) (##not y))) 11 22)))
+
+(define (test x)
+ (test2 x a)
+ (test2 x b))
+
+(test a)
+(test b)
View
2 gsc/tests/5-flonum/println.scm
@@ -0,0 +1,2 @@
+(println 0.0)
+(println -2.7)
View
17 gsc/tests/6-flprim/flonum.scm
@@ -0,0 +1,17 @@
+(declare (extended-bindings))
+
+(define f (##not 123))
+(define t (##not f))
+(define s "")
+(define x 1.5)
+
+(define (test x)
+ (println (##flonum? x))
+ (println (if (##flonum? x) 11 22)))
+
+(test 0)
+(test 1)
+(test f)
+(test t)
+(test s)
+(test x)
View
26 gsc/tests/eq.scm
@@ -1,26 +0,0 @@
-(declare (extended-bindings))
-
-(define str "")
-(define fl0 0.0)
-(define fl1 1.0)
-
-(define (test2 x y)
- (println (##eq? x y))
- (println (if (##eq? x y) "yes" "no")))
-
-(define (test x)
- (test2 x #t)
- (test2 x #f)
- (test2 x 0)
- (test2 x 1)
- (test2 x str)
- (test2 x fl0)
- (test2 x fl1))
-
-(test #t)
-(test #f)
-(test 0)
-(test 1)
-(test str)
-(test fl0)
-(test fl1)
View
11 gsc/tests/fixnum.scm
@@ -1,11 +0,0 @@
-(declare (extended-bindings))
-
-(define (test x)
- (println (##fixnum? x))
- (println (if (##fixnum? x) "yes" "no")))
-
-(test #t)
-(test #f)
-(test 0)
-(test 1)
-(test "")
View
11 gsc/tests/flonum.scm
@@ -1,11 +0,0 @@
-(declare (extended-bindings))
-
-(define (test x)
- (println (##flonum? x))
- (println (if (##flonum? x) "yes" "no")))
-
-(test #t)
-(test #f)
-(test 0)
-(test 1)
-(test "")
View
17 gsc/tests/not.scm
@@ -1,17 +0,0 @@
-(declare (extended-bindings))
-
-(define str "")
-(define fl0 0.0)
-(define fl1 1.0)
-
-(define (test x)
- (println (##not x))
- (println (if (##not x) "yes" "no")))
-
-(test #t)
-(test #f)
-(test 0)
-(test 1)
-(test str)
-(test fl0)
-(test fl1)
View
4 include/stamp.h
@@ -2,5 +2,5 @@
* Time stamp of last source code repository commit.
*/
-#define ___STAMP_YMD 20120602
-#define ___STAMP_HMS 184525
+#define ___STAMP_YMD 20120605
+#define ___STAMP_HMS 155306

0 comments on commit 5da10a7

Please sign in to comment.
Something went wrong with that request. Please try again.