# HG changeset patch # User Bruno Haible # Date 1127482928 0 # Node ID 62463caf0009adde96ba77cc8544f25b9c7b4b94 # Parent fd0ccce602e438e44cec8b14ef5167f68865b4cf Test case for verify.h. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-09-23 Bruno Haible + + * tests/test-verify.c: New file. + 2005-09-22 Paul Eggert Sync from coreutils. diff --git a/tests/test-verify.c b/tests/test-verify.c 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 */ +}