static void run_one_fatal(test_fatal_func_t *fatal_function)
{
- static int index = 0;
+ static unsigned int index = 0;
for (;;) {
volatile int jumped = setjmp(fatal_jmpbuf);
if (jumped == 0) {
is increased by 1. The idea is that each stage would be running an
individual test that is supposed to crash. The function is called until
FATAL_TEST_FINISHED or FATAL_TEST_ABORT is returned. */
-typedef enum fatal_test_state test_fatal_func_t(int stage);
+typedef enum fatal_test_state test_fatal_func_t(unsigned int stage);
struct named_fatal {
const char *name;
int test_run_named_with_fatals(const char *match, struct named_test tests[],
struct named_fatal fatals[]);
-#define FATAL_DECL(x) enum fatal_test_state x(int);
+#define FATAL_DECL(x) enum fatal_test_state x(unsigned int);
#define FATAL_NAMELESS(x) x, /* Were you to want to use the X trick but not name the tests */
#define FATAL_NAMED(x) { .name = #x , .func = x },
test_array_swap();
}
-enum fatal_test_state fatal_array(int stage)
+enum fatal_test_state fatal_array(unsigned int stage)
{
double tmpd[2] = { 42., -42. };
short tmps[8] = {1,2,3,4,5,6,7,8};
test_end();
/* Forces the compiler to check the value of useless_ptr, so that it
must call array_idx (which is marked as pure, and gcc was desperate
- to optimise out. Of course, gcc is unaware stage is never -1.*/
- return (useless_ptr != NULL && stage == -1)
+ to optimise out. Of course, gcc is unaware stage is never UINT_MAX.*/
+ return (useless_ptr != NULL && stage == UINT_MAX)
? FATAL_TEST_FAILURE : FATAL_TEST_FINISHED;
}
test_ds_recursive(20, 80);
}
-enum fatal_test_state fatal_data_stack(int stage)
+enum fatal_test_state fatal_data_stack(unsigned int stage)
{
#ifdef DEBUG
#define NONEXISTENT_STACK_FRAME_ID (data_stack_frame_t)999999999
test_end();
}
-enum fatal_test_state fatal_mempool(int stage)
+enum fatal_test_state fatal_mempool(unsigned int stage)
{
static pool_t pool;
}
/* Want to test the panics too? go for it! */
-enum fatal_test_state fatal_printf_format_fix(int stage)
+enum fatal_test_state fatal_printf_format_fix(unsigned int stage)
{
static const char *fatals[] = {
"no no no %n's",
"definitely can't have a tailing %",
};
- if((unsigned int)stage >= N_ELEMENTS(fatals)) {
+ if(stage >= N_ELEMENTS(fatals)) {
test_end();
return FATAL_TEST_FINISHED;
}