PostGIS  2.1.10dev-r@@SVN_REVISION@@
cu_shp2pgsql.c
Go to the documentation of this file.
1 /**********************************************************************
2  * $Id: cu_shp2pgsql.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_shp2pgsql.h"
14 #include "cu_tester.h"
15 #include "../shp2pgsql-core.h"
16 
17 /* Test functions */
18 void test_ShpLoaderCreate(void);
19 void test_ShpLoaderDestroy(void);
20 
23 
24 /*
25 ** Called from test harness to register the tests in this file.
26 */
27 CU_pSuite register_shp2pgsql_suite(void)
28 {
29  CU_pSuite pSuite;
30  pSuite = CU_add_suite("Shapefile Loader File shp2pgsql Test", init_shp2pgsql_suite, clean_shp2pgsql_suite);
31  if (NULL == pSuite)
32  {
33  CU_cleanup_registry();
34  return NULL;
35  }
36 
37  if (
38  (NULL == CU_add_test(pSuite, "test_ShpLoaderCreate()", test_ShpLoaderCreate)) ||
39  (NULL == CU_add_test(pSuite, "test_ShpLoaderDestroy()", test_ShpLoaderDestroy))
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  loader_config = (SHPLOADERCONFIG*)calloc(1, sizeof(SHPLOADERCONFIG));
69  set_loader_config_defaults(loader_config);
70  loader_state = ShpLoaderCreate(loader_config);
71  CU_ASSERT_PTR_NOT_NULL(loader_state);
72  CU_ASSERT_STRING_EQUAL(loader_state->config->encoding, ENCODING_DEFAULT);
73 }
74 
76 {
77  ShpLoaderDestroy(loader_state);
78 }
SHPLOADERSTATE * loader_state
Definition: cu_shp2pgsql.c:22
SHPLOADERCONFIG * config
CU_pSuite register_shp2pgsql_suite(void)
Definition: cu_shp2pgsql.c:27
void test_ShpLoaderDestroy(void)
Definition: cu_shp2pgsql.c:75
void ShpLoaderDestroy(SHPLOADERSTATE *state)
void set_loader_config_defaults(SHPLOADERCONFIG *config)
SHPLOADERSTATE * ShpLoaderCreate(SHPLOADERCONFIG *config)
void test_ShpLoaderCreate(void)
Definition: cu_shp2pgsql.c:66
int init_shp2pgsql_suite(void)
Definition: cu_shp2pgsql.c:52
#define ENCODING_DEFAULT
SHPLOADERCONFIG * loader_config
Definition: cu_shp2pgsql.c:21
int clean_shp2pgsql_suite(void)
Definition: cu_shp2pgsql.c:61