refuse a comparison of other than two operands
(< a b c) reached C as C's own chain, which compares a boolean with c.
This commit is contained in:
@@ -771,6 +771,18 @@ whitespace aside, THEN?"
|
||||
(test-assert "and every qualifier between them"
|
||||
(emits? (in-fn "(var q (* const * union u))") "union u* const * q;")))
|
||||
|
||||
;; Operands past what an operator takes were written as they came:
|
||||
;; (< a b c) as C's own chain, which compares a boolean with c
|
||||
(test-group "operator arity"
|
||||
(test-assert "a comparison takes two operands"
|
||||
(reports? (in-fn "(var x bool (< a b a))") "a comparison takes two operands"))
|
||||
(test-assert "equality too"
|
||||
(reports? (in-fn "(var x bool (== a b a))") "a comparison takes two operands"))
|
||||
(test-assert "and not one"
|
||||
(reports? (in-fn "(var x bool (>= a))") "a comparison takes two operands"))
|
||||
(test-assert "two is a comparison"
|
||||
(emits? (in-fn "(var x bool (<= a b))") "x = a <= b;")))
|
||||
|
||||
;; An array bound was taken only when it was an integer literal, so a
|
||||
;; symbolic one fell into the type: `[int N]' came out `int N a[]'.
|
||||
(test-group "array bounds"
|
||||
|
||||
Reference in New Issue
Block a user