From f4c7b0224f8d17149633dd826f6e506f796b6999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 20 Jul 2020 03:23:40 +0200 Subject: Add preliminary tests for cpp. --- tests/cpp.scm | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/cpp.scm 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")) + -- cgit v1.2.3