PostGIS  2.2.7dev-r@@SVN_REVISION@@
liblwgeom/cunit/cu_tester.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * PostGIS - Spatial Types for PostgreSQL
4  * http://postgis.net
5  *
6  * Copyright (C) 2009 Paul Ramsey <pramsey@cleverelephant.ca>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU General Public Licence. See the COPYING file.
10  *
11  **********************************************************************/
12 
13 #define MAX_CUNIT_ERROR_LENGTH 512
14 
15 #define PG_ADD_TEST(suite, testfunc) CU_add_test(suite, #testfunc, testfunc)
16 
17 /* Contains the most recent error message generated by lwerror. */
19 
20 /* Resets cu_error_msg back to blank. */
21 void cu_error_msg_reset(void);
22 
23 /* Our internal callback to register Suites with the main tester */
24 typedef void (*PG_SuiteSetup)(void);
25 
26 #define ASSERT_DOUBLE_EQUAL(o,e) do { \
27  if ( o != e ) \
28  fprintf(stderr, "[%s:%d]\n Expected: %g\n Obtained: %g\n", __FILE__, __LINE__, (double)(e), (o)); \
29  CU_ASSERT_EQUAL(o,(double)e); \
30 } while (0);
31 
32 #define ASSERT_INT_EQUAL(o,e) do { \
33  if ( o != e ) \
34  fprintf(stderr, "[%s:%d]\n Expected: %d\n Obtained: %d\n", __FILE__, __LINE__, (e), (o)); \
35  CU_ASSERT_EQUAL(o,e); \
36 } while (0);
37 
38 #define ASSERT_STRING_EQUAL(o,e) do { \
39  if ( strcmp(o,e) != 0 ) \
40  fprintf(stderr, "[%s:%d]\n Expected: %s\n Obtained: %s\n", __FILE__, __LINE__, (e), (o)); \
41  CU_ASSERT_STRING_EQUAL(o,e); \
42 } while (0);
43 
void cu_error_msg_reset(void)
void(* PG_SuiteSetup)(void)
#define MAX_CUNIT_ERROR_LENGTH
char cu_error_msg[MAX_CUNIT_ERROR_LENGTH+1]