autoupdate
[gnulib.git] / tests / test-verify.c
1 #ifdef HAVE_CONFIG_H
2 # include <config.h>
3 #endif
4
5 #include "verify.h"
6
7 int x;
8 enum { a, b, c };
9
10 verify (x >= 0);                  /* should give ERROR: non-constant expression */
11 verify (c == 2);                  /* should be ok */
12 verify (1 + 1 == 3);              /* should give ERROR */
13 verify (1 == 1); verify (1 == 1); /* should be ok */
14
15 enum
16 {
17   item = verify_true (1 == 1) * 0 + 17 /* should be ok */
18 };
19
20 int function (int n)
21 {
22   verify (n >= 0);                  /* should give ERROR: non-constant expression */
23   verify (c == 2);                  /* should be ok */
24   verify (1 + 1 == 3);              /* should give ERROR */
25   verify (1 == 1); verify (1 == 1); /* should be ok */
26
27   if (n)
28     return (verify_true (1 == 1), verify_true (1 == 1), 7); /* should be ok */
29   else
30     return (verify_true (1 == 2), 5); /* should give ERROR */
31 }