comparison tests/test-verify.c @ 6276:62463caf0009

Test case for verify.h.
author Bruno Haible <bruno@clisp.org>
date Fri, 23 Sep 2005 13:42:08 +0000
parents
children acd7756857ea
comparison
equal deleted inserted replaced
6275:fd0ccce602e4 6276:62463caf0009
1 #include "verify.h"
2
3 int x;
4 enum { a, b, c };
5
6 verify (x >= 0); /* should give ERROR: non-constant expression */
7 verify (c == 2); /* should be ok */
8 verify (1 + 1 == 3); /* should give ERROR */
9 verify (1 == 1); verify (1 == 1); /* should be ok */
10
11 int function (int n)
12 {
13 verify (n >= 0); /* should give ERROR: non-constant expression */
14 verify (c == 2); /* should be ok */
15 verify (1 + 1 == 3); /* should give ERROR */
16 verify (1 == 1); verify (1 == 1); /* should be ok */
17
18 if (n)
19 return (verify_expr (1 == 1), verify_expr (1 == 1), 7); /* should be ok */
20 else
21 return (verify_expr (1 == 2), 5); /* should give ERROR */
22 }