]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/infra/testsuite/cyginfra/tassert8.cxx
Initial revision
[karo-tx-redboot.git] / tools / src / infra / testsuite / cyginfra / tassert8.cxx
1 //==========================================================================
2 //
3 //      tassert8.cxx
4 //
5 //      Assertion test case                                                                
6 //
7 //==========================================================================
8 //####COPYRIGHTBEGIN####
9 //                                                                          
10 // ----------------------------------------------------------------------------
11 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
12 //
13 // This file is part of the eCos host tools.
14 //
15 // This program is free software; you can redistribute it and/or modify it 
16 // under the terms of the GNU General Public License as published by the Free 
17 // Software Foundation; either version 2 of the License, or (at your option) 
18 // any later version.
19 // 
20 // This program is distributed in the hope that it will be useful, but WITHOUT 
21 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
22 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
23 // more details.
24 // 
25 // You should have received a copy of the GNU General Public License along with
26 // this program; if not, write to the Free Software Foundation, Inc., 
27 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28 //
29 // ----------------------------------------------------------------------------
30 //                                                                          
31 //####COPYRIGHTEND####
32 //==========================================================================
33 //#####DESCRIPTIONBEGIN####                                             
34 //
35 // Author(s):           bartv
36 // Contributors:        bartv
37 // Date:                1998-12-23
38 // Purpose:
39 // Description:         This routine causes a basic assertion, including a
40 //                      number of callbacks. It is up to the test driver
41 //                      to analyse the results of this and take appropriate
42 //                      action.
43 //
44 //####DESCRIPTIONEND####
45 //==========================================================================
46
47 #define CYG_DECLARE_HOST_ASSERTION_SUPPORT
48 #define CYGDBG_USE_ASSERTS
49 #define CYGDBG_INFRA_DEBUG_PRECONDITIONS
50 #define CYGDBG_INFRA_DEBUG_POSTCONDITIONS
51 #define CYGDBG_INFRA_DEBUG_LOOP_INVARIANTS
52 #define CYGDBG_INFRA_DEBUG_INVARIANTS
53
54 #include <cyg/infra/testcase.h>
55 #include <cyg/infra/cyg_ass.h>
56
57 extern "C"
58 void
59 callback1(void (*outputfn)(const char*))
60 {
61     // This callback does nothing
62 }
63
64 extern "C"
65 void
66 callback2(void (*outputfn)(const char*))
67 {
68     // This callback outputs a number of lines of data.
69     for (int i = 0; i < 10; i++) {
70         (*outputfn)("callback2 output\n");
71     }
72 }
73
74 int
75 main(int argc, char** argv)
76 {
77     cyg_assert_install_failure_callback("callback1", &callback1);
78     cyg_assert_install_failure_callback("callback2", &callback2);
79     CYG_FAIL("it seemed like a good idea at the time");
80 }
81