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