OSDN Git Service

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