ifw-odp  2.0.0-alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
clipm_testlib_base.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  * E.S.O. - VLT project
4  *
5  * "@(#) $Id: clipm_testlib_base.h 168459 2008-06-04 17:21:13Z hlorch $"
6  *
7  * Commonly used functions for clipm tests
8  *
9  * who when what
10  * -------- ---------- ----------------------------------------------
11  * hlorch 2006-05-04 created
12  */
13 
14 #ifndef CLIPM_TESTLIB_BASE_H
15 #define CLIPM_TESTLIB_BASE_H
16 
17 /*-----------------------------------------------------------------------------
18  Includes
19  -----------------------------------------------------------------------------*/
20 
21 #include <clipm.h>
22 #include <clipm_priv_error.h>
23 
24 /*-----------------------------------------------------------------------------
25  Declaration Block
26  -----------------------------------------------------------------------------*/
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /*-----------------------------------------------------------------------------
33  Defines
34  -----------------------------------------------------------------------------*/
35 
36 #if CLIPM_GET_INSTALLED_CPL_VERSION >= 4
37 
38  #define clipm_testlib_call_testfunction(func) \
39  do { \
40  cpl_errorstate errstat = cpl_errorstate_get(); \
41  _clipm_testlib_call_testfunction( func, \
42  #func); \
43  if (errstat != cpl_errorstate_get()) \
44  cpl_error_set_where(__func__); \
45  } while (0)
46 
47 #else
48 
49  #define clipm_testlib_call_testfunction(func) \
50  _clipm_testlib_call_testfunction( func, \
51  #func)
52 
53 #endif
54 
55 /*-----------------------------------------------------------------------------
56  Prototypes
57  -----------------------------------------------------------------------------*/
58 
59 void clipm_testlib_init( int argc,
60  char **argv);
61 
62 int clipm_testlib_end( void);
63 
64 #if CLIPM_GET_INSTALLED_CPL_VERSION >= 4
65 void clipm_testlib_errorstate_dump_one( unsigned self,
66  unsigned first,
67  unsigned last);
68 #endif
69 
70 int clipm_testlib_is_verbose(void);
71 
72 void clipm_testlib_msg_error(const char *format, ...)
73  #ifdef __GNUC__
74  __attribute__((format (printf, 1, 2)))
75  #endif
76  ;
77 
78 void clipm_testlib_msg_warning(const char *format, ...)
79  #ifdef __GNUC__
80  __attribute__((format (printf, 1, 2)))
81  #endif
82  ;
83 
84 void clipm_testlib_msg_info(const char *format, ...)
85  #ifdef __GNUC__
86  __attribute__((format (printf, 1, 2)))
87  #endif
88  ;
89 
90 void clipm_testlib_msg_debug(const char *format, ...)
91  #ifdef __GNUC__
92  __attribute__((format (printf, 1, 2)))
93  #endif
94  ;
95 
96 /*-----------------------------------------------------------------------------
97  Private Prototypes
98  -----------------------------------------------------------------------------*/
99 
100 void _clipm_testlib_call_testfunction( void (*testfunc)(void),
101  const char *name);
102 
103 /*----------------------------------------------------------------------------*/
104 
105 #ifdef __cplusplus
106 } /* extern "C" */
107 #endif
108 
109 #endif /* CLIPM_TESTLIB_BASE_H */
void clipm_testlib_msg_debug(const char *format,...)
Display a debug message.
Definition: clipm_testlib_base.c:360
void clipm_testlib_msg_warning(const char *format,...)
Display a warning message.
Definition: clipm_testlib_base.c:316
void _clipm_testlib_call_testfunction(void(*testfunc)(void), const char *name)
Definition: clipm_testlib_base.c:373
int clipm_testlib_end(void)
Shuts down CPL and logging etc.
Definition: clipm_testlib_base.c:139
void clipm_testlib_init(int argc, char **argv)
Initializes CPL and message levels.
Definition: clipm_testlib_base.c:76
int clipm_testlib_is_verbose(void)
Return whether verbose mode is set.
Definition: clipm_testlib_base.c:278
void clipm_testlib_msg_info(const char *format,...)
Display an information message.
Definition: clipm_testlib_base.c:338
void clipm_testlib_msg_error(const char *format,...)
Display an error message.
Definition: clipm_testlib_base.c:294