diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-29 14:30:35 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-07 21:17:22 +0200 |
commit | 561c7a3ea6c5153cde6be6d1792cda5af1202881 (patch) | |
tree | 406d99680a1d4ec2f532434a2fa3e1c4a4511490 /tests/test/cpp.scm | |
parent | Add split-by-one-of. (diff) | |
download | calp-561c7a3ea6c5153cde6be6d1792cda5af1202881.tar.gz calp-561c7a3ea6c5153cde6be6d1792cda5af1202881.tar.xz |
Fix C order of operations.
Diffstat (limited to 'tests/test/cpp.scm')
-rw-r--r-- | tests/test/cpp.scm | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/test/cpp.scm b/tests/test/cpp.scm index f3b9ff72..8a53ecce 100644 --- a/tests/test/cpp.scm +++ b/tests/test/cpp.scm @@ -13,6 +13,17 @@ ;; So changing the lexer test cases isn't a problem ;; but don't change the parser test cases +;; Strings aren't yet implemented +(test-skip "Strings") +;; __asm__ always has strings as arguments +(test-skip "__asm__") +;; not implemented +(test-skip "Token concatenation") +;; not implemented +(test-skip "Floating point numbers") +;; order of operation is wrong, leading to an incorrect result +(test-skip "Cast with operation") + (define run (compose parse-lexeme-tree lex)) (define-syntax let-group @@ -108,11 +119,6 @@ -(test-skip "Strings") -(test-skip "__asm__") -(test-skip "Token concatenation") -(test-skip "Floating point numbers") - ;; Hand picked forms from output of `cpp -dM /usr/include/termios.h` on ;; FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64 ;; 2022-06-28 @@ -175,8 +181,8 @@ (test-equal '(ternary (and (>= x #x61) (<= x #x7A)) - (- x (+ #x61 1)) - (bitand (- x (+ #x61 1)) 127)) + (+ (- x #x61) 1) + (bitand (+ (- x #x61) 1) 127)) (run form))) (let ((form "((x) & ~(IOCPARM_MASK << 16))")) @@ -350,7 +356,8 @@ (group (variable "num"))))))) (lex form)) (test-equal '(as-type (unsigned long) - (bitor (<< (bitand len IOCPARM_MASK) 16) + (bitor inout + (<< (bitand len IOCPARM_MASK) 16) (<< group 8) num)) (run form)))) |