aboutsummaryrefslogtreecommitdiff
path: root/tests/cpp.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cpp.scm')
-rw-r--r--tests/cpp.scm36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/cpp.scm b/tests/cpp.scm
new file mode 100644
index 00000000..1d4e62f3
--- /dev/null
+++ b/tests/cpp.scm
@@ -0,0 +1,36 @@
+(define run (compose parse-lexeme-tree lex))
+
+(test-equal
+ '(+ (post-increment (dereference C)) 3)
+ (run "(*C)++ + 3"))
+
+
+(test-equal
+ '(+ (post-increment (dereference C)) 3)
+ (run "*C++ + 3"))
+
+(test-equal
+ '(post-increment (dereference C))
+ (run "*C++"))
+
+(test-equal
+ '(+ (post-increment C) (post-increment C))
+ (run "C++ + C++"))
+
+(test-equal
+ '(+ (pre-increment C) (pre-increment C))
+ (run "++C + ++C"))
+
+
+(test-equal
+ '(+ 2 (* 2 2))
+ (run "2 + 2 * 2"))
+
+(test-equal
+ '(+ (* 2 2) 2)
+ (run "2 * 2 + 2"))
+
+(test-equal
+ '(+ 2 2 2)
+ (run "2+2+2"))
+