File: cu_pgsql2shp.c

package info (click to toggle)
postgis 2.3.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 58,660 kB
  • ctags: 10,181
  • sloc: ansic: 132,858; sql: 131,148; xml: 46,460; sh: 4,832; perl: 4,476; makefile: 2,749; python: 1,198; yacc: 442; lex: 131
file content (77 lines) | stat: -rw-r--r-- 1,783 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/**********************************************************************
 *
 * PostGIS - Spatial Types for PostgreSQL
 * http://postgis.net
 * Copyright 2010 LISAsoft Pty Ltd
 *
 * This is free software; you can redistribute and/or modify it under
 * the terms of the GNU General Public Licence. See the COPYING file.
 *
 **********************************************************************/

#include "cu_pgsql2shp.h"
#include "cu_tester.h"
#include "../pgsql2shp-core.h"

/* Test functions */
void test_ShpDumperCreate(void);
void test_ShpDumperDestroy(void);

SHPDUMPERCONFIG *dumper_config;
SHPDUMPERSTATE *dumper_state;

/*
** Called from test harness to register the tests in this file.
*/
CU_pSuite register_pgsql2shp_suite(void)
{
	CU_pSuite pSuite;
	pSuite = CU_add_suite("Shapefile Loader File pgsql2shp Test", init_pgsql2shp_suite, clean_pgsql2shp_suite);
	if (NULL == pSuite)
	{
		CU_cleanup_registry();
		return NULL;
	}

	if (
	    (NULL == CU_add_test(pSuite, "test_ShpDumperCreate()", test_ShpDumperCreate)) ||
	    (NULL == CU_add_test(pSuite, "test_ShpDumperDestroy()", test_ShpDumperDestroy))
	)
	{
		CU_cleanup_registry();
		return NULL;
	}
	return pSuite;
}

/*
** The suite initialization function.
** Create any re-used objects.
*/
int init_pgsql2shp_suite(void)
{
	return 0;
}

/*
** The suite cleanup function.
** Frees any global objects.
*/
int clean_pgsql2shp_suite(void)
{
	return 0;
}

void test_ShpDumperCreate(void)
{	
	dumper_config = (SHPDUMPERCONFIG*)calloc(1, sizeof(SHPDUMPERCONFIG));
	set_dumper_config_defaults(dumper_config);
	dumper_state = ShpDumperCreate(dumper_config);
	CU_ASSERT_PTR_NOT_NULL(dumper_state);
	CU_ASSERT_EQUAL(dumper_state->config->fetchsize, 100);
}

void test_ShpDumperDestroy(void)
{
	ShpDumperDestroy(dumper_state);
}