lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* |
| 3 | * Test application for functions defined in ctype.h |
| 4 | * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org> |
| 5 | * |
| 6 | * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
| 7 | */ |
| 8 | |
| 9 | #undef NDEBUG |
| 10 | |
| 11 | #include <stdio.h> |
| 12 | #include <stdlib.h> |
| 13 | #include <assert.h> |
| 14 | #include <signal.h> |
| 15 | #include "../testsuite.h" |
| 16 | |
| 17 | int got_abort; |
| 18 | |
| 19 | static void aborthandler(int junk) |
| 20 | { |
| 21 | got_abort = 1; |
| 22 | } |
| 23 | |
| 24 | int main(int argc, char *argv[]) |
| 25 | { |
| 26 | signal(SIGABRT, aborthandler); |
| 27 | |
| 28 | init_testsuite("Testing functions defined in assert.h:\n\t"); |
| 29 | |
| 30 | got_abort=0; |
| 31 | assert(0 == 0); |
| 32 | TEST_NUMERIC(got_abort, 0); |
| 33 | |
| 34 | #define NDEBUG |
| 35 | got_abort = 0; |
| 36 | printf("Don't worry -- This next test is supposed to print an assert message:\n"); |
| 37 | fprintf(stderr, "\t"); |
| 38 | assert(0 == 1); |
| 39 | TEST_NUMERIC(got_abort, 0); |
| 40 | |
| 41 | #undef NDEBUG |
| 42 | got_abort = 0; |
| 43 | assert(0 == 1); |
| 44 | TEST_NUMERIC(got_abort, 1); |
| 45 | |
| 46 | exit(0); |
| 47 | } |