Permalink
Browse files

Add very basic test suite

  • Loading branch information...
mwh committed Jun 22, 2011
1 parent 6d5a583 commit ebc803649450e6132dba345481d223e753b3946e
Showing with 349 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +3 −1 Makefile
  3. +1 −0 tests/001-print.out
  4. +1 −0 tests/001-print.test.gc
  5. +3 −0 tests/002-concat.out
  6. +3 −0 tests/002-concat.test.gc
  7. +5 −0 tests/003-arithmetic.out
  8. +5 −0 tests/003-arithmetic.test.gc
  9. +4 −0 tests/004-var.out
  10. +8 −0 tests/004-var.test.gc
  11. +4 −0 tests/005-boolean.out
  12. +4 −0 tests/005-boolean.test.gc
  13. +4 −0 tests/006-dotcall.out
  14. +6 −0 tests/006-dotcall.test.gc
  15. +6 −0 tests/007-precedence.out
  16. +7 −0 tests/007-precedence.test.gc
  17. +2 −0 tests/008-if.out
  18. +10 −0 tests/008-if.test.gc
  19. +3 −0 tests/009-elseif.out
  20. +19 −0 tests/009-elseif.test.gc
  21. +5 −0 tests/010-while.out
  22. +6 −0 tests/010-while.test.gc
  23. 0 tests/011-range.out
  24. +1 −0 tests/011-range.test.gc
  25. +5 −0 tests/012-for.out
  26. +3 −0 tests/012-for.test.gc
  27. +3 −0 tests/013-method.out
  28. +9 −0 tests/013-method.test.gc
  29. +1 −0 tests/014-objectvar.out
  30. +4 −0 tests/014-objectvar.test.gc
  31. +1 −0 tests/015-objectconst.out
  32. +4 −0 tests/015-objectconst.test.gc
  33. +2 −0 tests/016-objectmeth.out
  34. +12 −0 tests/016-objectmeth.test.gc
  35. +2 −0 tests/017-objectvarassign.out
  36. +6 −0 tests/017-objectvarassign.test.gc
  37. +3 −0 tests/018-objectself.out
  38. +10 −0 tests/018-objectself.test.gc
  39. +11 −0 tests/019-equality.out
  40. +17 −0 tests/019-equality.test.gc
  41. +11 −0 tests/020-inequality.out
  42. +17 −0 tests/020-inequality.test.gc
  43. +3 −0 tests/021-ifnothen.fail.test.gc
  44. +5 −0 tests/022-elseifnothen.fail.test.gc
  45. +2 −0 tests/023-precedence.fail.test.gc
  46. +3 −0 tests/024-tab.fail.test.gc
  47. +1 −0 tests/025-controlchar.fail.test.gc
  48. +4 −0 tests/026-unicodewhitespace.fail.test.gc
  49. +1 −0 tests/027-unicodewhitespace.out
  50. +4 −0 tests/027-unicodewhitespace.test.gc
  51. +94 −0 tests/harness
View
@@ -10,3 +10,4 @@ minigrace
UnicodeData.txt
unicodegen.py
misc
+tests/test.log
View
@@ -33,6 +33,8 @@ minigrace: l2/minigrace $(SOURCEFILES) unicode.gso gracelib.o
unicode.gco: unicode.c unicodedata.h
clang -emit-llvm -c -o unicode.gco -DNO_FLAGS= unicode.c
+test: minigrace
+ ./tests/harness "$(shell pwd)/minigrace --gracelib $(shell pwd)/gracelib.o" tests
clean:
rm -f gracelib.o
rm -f unicode.gco unicode.gso
@@ -50,4 +52,4 @@ semiclean:
known-good/%:
cd known-good && $(MAKE) $*
-.PHONY: all clean selfhost-stats selfhost-rec
+.PHONY: all clean selfhost-stats selfhost-rec test
View
@@ -0,0 +1 @@
+Hello, world.
View
@@ -0,0 +1 @@
+print("Hello, world.")
View
@@ -0,0 +1,3 @@
+Hello world.
+Line 2
+3rd line
View
@@ -0,0 +1,3 @@
+print("Hello " ++ "world.")
+print("Line " ++ 2)
+print(3 ++ "rd line")
View
@@ -0,0 +1,5 @@
+1
+2
+3
+4
+5
@@ -0,0 +1,5 @@
+print(2 - 1)
+print(1 + 1)
+print(6 / 2)
+print(2 * 2)
+print(15 % 10)
View
@@ -0,0 +1,4 @@
+Hello
+Hello world.
+3
+4
View
@@ -0,0 +1,8 @@
+var x := "Hello"
+print(x)
+x := x ++ " world."
+print(x)
+var y := 3
+print(y)
+y := y + 1
+print(y)
View
@@ -0,0 +1,4 @@
+true
+false
+true
+false
@@ -0,0 +1,4 @@
+print(true)
+print(false)
+print(true | false)
+print(true & false)
View
@@ -0,0 +1,4 @@
+false
+true
+false
+true
@@ -0,0 +1,6 @@
+print(true.not)
+var x := false
+print(x.not)
+print(x.not.not)
+x := x.not
+print(x & false.not)
View
@@ -0,0 +1,6 @@
+1
+2
+3
+4
+5
+6
@@ -0,0 +1,7 @@
+var x := 4
+print(x / 2 - 1)
+print(x - 2 / 1)
+print(2 * 1 + 4 / x)
+print((x * (6 - 2) - x) /3)
+print(x - 0 + 1)
+print(x * 3 / 2)
View
@@ -0,0 +1,2 @@
+OK 1 then
+OK 2 else
View
@@ -0,0 +1,10 @@
+if (true) then {
+ print("OK 1 then")
+} else {
+ print("Fail 1 then")
+}
+if (false) then {
+ print("Fail 2 else")
+} else {
+ print("OK 2 else")
+}
View
@@ -0,0 +1,3 @@
+OK 1 elseif
+OK 2 elseif2
+OK 3 else
View
@@ -0,0 +1,19 @@
+if (false) then {
+ print("Fail 1 then")
+} elseif (true) then {
+ print("OK 1 elseif")
+}
+if (true.not) then {
+ print("Fail 2 then")
+} elseif (true & false) then {
+ print("Fail 2 elseif1")
+} elseif (false | true) then {
+ print("OK 2 elseif2")
+}
+if (false & false) then {
+ print("Fail 3 then")
+} elseif (false | false) then {
+ print("Fail 3 elseif")
+} else {
+ print("OK 3 else")
+}
View
@@ -0,0 +1,5 @@
+1
+2
+3
+4
+Last: 5
View
@@ -0,0 +1,6 @@
+var x := 1
+while {x < 5} do {
+ print(x)
+ x := x + 1
+}
+print("Last: " ++ x)
View
No changes.
View
@@ -0,0 +1 @@
+var x := 0..10
View
@@ -0,0 +1,5 @@
+1
+2
+3
+4
+5
View
@@ -0,0 +1,3 @@
+for (1..5) do { v ->
+ print(v)
+}
View
@@ -0,0 +1,3 @@
+OK 1
+OK 2
+OK 3
View
@@ -0,0 +1,9 @@
+method foo() {
+ print("OK 1")
+}
+method bar(x) {
+ print("OK " ++ x)
+}
+foo()
+bar(2)
+bar(3)
View
@@ -0,0 +1 @@
+1
@@ -0,0 +1,4 @@
+var x := object {
+ var v := 1
+}
+print(x.v)
@@ -0,0 +1 @@
+Hello
@@ -0,0 +1,4 @@
+var x := object {
+ const c := "Hello"
+}
+print(x.c)
View
@@ -0,0 +1,2 @@
+Hello
+World
@@ -0,0 +1,12 @@
+var x := object {
+ method foo() {
+ print("Hello")
+ }
+}
+x.foo()
+x := object {
+ method bar() {
+ "World"
+ }
+}
+print(x.bar)
@@ -0,0 +1,2 @@
+1
+2
@@ -0,0 +1,6 @@
+var x := object {
+ var val := 1
+}
+print(x.val)
+x.val := 2
+print(x.val)
View
@@ -0,0 +1,3 @@
+1
+2
+3
@@ -0,0 +1,10 @@
+var x := object {
+ var val := 1
+ method foo() {
+ print(self.val)
+ self.val := self.val + 1
+ }
+}
+x.foo()
+x.foo()
+x.foo()
View
@@ -0,0 +1,11 @@
+true
+false
+true
+false
+true
+false
+true
+false
+true
+false
+true
View
@@ -0,0 +1,17 @@
+print(1 == 1)
+print(1 == 2)
+print (2 == (1 + 1))
+print(true == false)
+print(true == true)
+print(false == true)
+print(false == false)
+print("Hello" == "world")
+print("Hello" == "Hello")
+var x := object {
+ var v := 1
+}
+var y := object {
+ var v := 1
+}
+print(x == y)
+print(x == x)
View
@@ -0,0 +1,11 @@
+false
+true
+false
+true
+false
+true
+false
+true
+false
+true
+false
@@ -0,0 +1,17 @@
+print(1 /= 1)
+print(1 /= 2)
+print (2 /= (1 + 1))
+print(true /= false)
+print(true /= true)
+print(false /= true)
+print(false /= false)
+print("Hello" /= "world")
+print("Hello" /= "Hello")
+var x := object {
+ var v := 1
+}
+var y := object {
+ var v := 1
+}
+print(x /= y)
+print(x /= x)
@@ -0,0 +1,3 @@
+if (true) {
+ print("Failure.")
+}
@@ -0,0 +1,5 @@
+if (true) then {
+ print("Here")
+} elseif (true) {
+ print("Failure.")
+}
@@ -0,0 +1,2 @@
+var x := 6 * 3 + 1
+var y := x < 20 & x > 10
@@ -0,0 +1,3 @@
+if (true) then {
+ print("Here")
+}
@@ -0,0 +1 @@
+var x := "Test"
@@ -0,0 +1,4 @@
+// The next line contains U+202F NARROW NO-BREAK SPACE
+if (true) then {
+ print("Here")
+}
@@ -0,0 +1 @@
+Here
@@ -0,0 +1,4 @@
+// The next line contains U+2028 LINE SEPARATOR, a legal character
+if (true) then {

+ print("Here")
+}
Oops, something went wrong.

0 comments on commit ebc8036

Please sign in to comment.