Skip to content
Browse files

adding more testing files and fixing hand

  • Loading branch information...
1 parent 18cf5ec commit 219c1abea0cf3ce68a350cb4a143459d026cf9a4 Molly Mattis committed Mar 29, 2012
View
37 compiler/hand.rkt
@@ -6,27 +6,46 @@
"base.rkt"
"helpers.rkt")
+(define-check (check-files f1 f2)
+ (check-equal?
+ (file->list f1)
+ (file->list f2)))
(test-suite
"hand-written tests for CS420"
(test-case
"(+ 3 5)"
(compile '(+ 3 5) "foo.hack")
- (check-equal?
- (file->list "foo.hack")
- (file->list "one.hack")))
+ (check-files "foo.hack" "testingFiles/one.hack")
(test-case
"(- 9 1)"
(compile '(- 9 1) "foo.hack")
- (check-equal?
- (file->list "foo.hack")
- (file->list "two.hack")))
+ (check-files "foo.hack" "testingFiles/two.hack")
(test-case
"(+ 3(- 5 2)"
(compile '(+ 3(- 5 2)) "foo.hack")
- (check-equal?
- (file->list "foo.hack")
- (file->list "three.hack")))
+ (check-files "foo.hack" "testingFiles/three.hack")
+(test-case
+ "(- 3(+ 5 2)"
+ (compile '(- 3(+ 5 2)) "foo.hack")
+ (check-files "foo.hack" "testingFiles/four.hack")
+(test-case
+ "(- 3(+ 5 2)"
+ (compile '(- 3(+ 5 2)) "foo.hack")
+ (check-files "foo.hack" "testingFiles/four.hack")
+(test-case
+ "(+(+ 1 2)(- 4 3))"
+ (compile '(+(+ 1 2)(- 4 3)) "foo.hack")
+ (check-files "foo.hack" "testingFiles/five.hack")
+(test-case
+ "(-(- 8 1)(+ 1 3))"
+ (compile '(+(+ 1 2)(- 4 3)) "foo.hack")
+ (check-files "foo.hack" "testingFiles/six.hack")
+(test-case
+ "(+(+ 3 5) 5)"
+ (compile '(+(+ 1 2)(- 4 3)) "foo.hack")
+ (check-files "foo.hack" "testingFiles/seven.hack")
+
(define actual1
View
13 compiler/testingFiles/five.hack
@@ -0,0 +1,13 @@
+@4
+D=A
+@3
+D=D-A
+@rand1
+M=D
+@1
+D=A
+@2
+D=D+A
+@rand1
+D=D+M
+(END)
View
11 compiler/testingFiles/four.hack
@@ -0,0 +1,11 @@
+@5
+D=A
+@2
+D=D+A
+@rand1
+M=D
+@3
+D=A
+@rand1
+D=D+M
+(END)
View
11 compiler/testingFiles/seven.hack
@@ -0,0 +1,11 @@
+@3
+D=A
+@5
+D=D+A
+@rand1
+M=D
+@5
+D=A
+@rand1
+D=M+D
+(END)
View
13 compiler/testingFiles/six.hack
@@ -0,0 +1,13 @@
+@1
+D=A
+@3
+D=D+A
+@rand1
+M=D
+@8
+D=A
+@1
+D=D-A
+@rand1
+D=D-M
+(END)

0 comments on commit 219c1ab

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