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