Mercurial > hg > octave-lyh > gnulib-hg
changeset 6276:62463caf0009
Test case for verify.h.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 23 Sep 2005 13:42:08 +0000 |
parents | fd0ccce602e4 |
children | acd7756857ea |
files | ChangeLog tests/test-verify.c |
diffstat | 2 files changed, 26 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-09-23 Bruno Haible <bruno@clisp.org> + + * tests/test-verify.c: New file. + 2005-09-22 Paul Eggert <eggert@cs.ucla.edu> Sync from coreutils.
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 */ +}