Mercurial > hg > octave-lojdl > gnulib-hg
diff 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 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/tests/test-verify.c @@ -0,0 +1,22 @@ +#include "verify.h" + +int x; +enum { a, b, c }; + +verify (x >= 0); /* should give ERROR: non-constant expression */ +verify (c == 2); /* should be ok */ +verify (1 + 1 == 3); /* should give ERROR */ +verify (1 == 1); verify (1 == 1); /* should be ok */ + +int function (int n) +{ + verify (n >= 0); /* should give ERROR: non-constant expression */ + verify (c == 2); /* should be ok */ + verify (1 + 1 == 3); /* should give ERROR */ + verify (1 == 1); verify (1 == 1); /* should be ok */ + + if (n) + return (verify_expr (1 == 1), verify_expr (1 == 1), 7); /* should be ok */ + else + return (verify_expr (1 == 2), 5); /* should give ERROR */ +}