PostGIS  2.1.10dev-r@@SVN_REVISION@@
cu_pgsql2shp.c
Go to the documentation of this file.
1 /**********************************************************************
2  * $Id: cu_pgsql2shp.c 5674 2010-06-03 02:04:15Z mleslie $
3  *
4  * PostGIS - Spatial Types for PostgreSQL
5  * http://postgis.net
6  * Copyright 2010 LISAsoft Pty Ltd
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 #include "cu_pgsql2shp.h"
14 #include "cu_tester.h"
15 #include "../pgsql2shp-core.h"
16 
17 /* Test functions */
18 void test_ShpDumperCreate(void);
19 void test_ShpDumperDestroy(void);
20 
23 
24 /*
25 ** Called from test harness to register the tests in this file.
26 */
27 CU_pSuite register_pgsql2shp_suite(void)
28 {
29  CU_pSuite pSuite;
30  pSuite = CU_add_suite("Shapefile Loader File pgsql2shp Test", init_pgsql2shp_suite, clean_pgsql2shp_suite);
31  if (NULL == pSuite)
32  {
33  CU_cleanup_registry();
34  return NULL;
35  }
36 
37  if (
38  (NULL == CU_add_test(pSuite, "test_ShpDumperCreate()", test_ShpDumperCreate)) ||
39  (NULL == CU_add_test(pSuite, "test_ShpDumperDestroy()", test_ShpDumperDestroy))
40  )
41  {
42  CU_cleanup_registry();
43  return NULL;
44  }
45  return pSuite;
46 }
47 
48 /*
49 ** The suite initialization function.
50 ** Create any re-used objects.
51 */
53 {
54  return 0;
55 }
56 
57 /*
58 ** The suite cleanup function.
59 ** Frees any global objects.
60 */
62 {
63  return 0;
64 }
65 
67 {
68  dumper_config = (SHPDUMPERCONFIG*)calloc(1, sizeof(SHPDUMPERCONFIG));
69  set_dumper_config_defaults(dumper_config);
70  dumper_state = ShpDumperCreate(dumper_config);
71  CU_ASSERT_PTR_NOT_NULL(dumper_state);
72  CU_ASSERT_EQUAL(dumper_state->config->fetchsize, 100);
73 }
74 
76 {
77  ShpDumperDestroy(dumper_state);
78 }
int init_pgsql2shp_suite(void)
Definition: cu_pgsql2shp.c:52
void test_ShpDumperCreate(void)
Definition: cu_pgsql2shp.c:66
SHPDUMPERCONFIG * config
SHPDUMPERSTATE * ShpDumperCreate(SHPDUMPERCONFIG *config)
void set_dumper_config_defaults(SHPDUMPERCONFIG *config)
SHPDUMPERSTATE * dumper_state
Definition: cu_pgsql2shp.c:22
void ShpDumperDestroy(SHPDUMPERSTATE *state)
int clean_pgsql2shp_suite(void)
Definition: cu_pgsql2shp.c:61
void test_ShpDumperDestroy(void)
Definition: cu_pgsql2shp.c:75
SHPDUMPERCONFIG * dumper_config
Definition: cu_pgsql2shp.c:21
CU_pSuite register_pgsql2shp_suite(void)
Definition: cu_pgsql2shp.c:27