*
**********************************************************************/
-#include "cu_algorithm.h"
-
-/*
-** Called from test harness to register the tests in this file.
-*/
-CU_pSuite register_cg_suite(void)
-{
- CU_pSuite pSuite;
- pSuite = CU_add_suite("PostGIS Computational Geometry Suite", init_cg_suite, clean_cg_suite);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
-
- if (
- (NULL == CU_add_test(pSuite, "test_lw_segment_side()", test_lw_segment_side)) ||
- (NULL == CU_add_test(pSuite, "test_lw_segment_intersects()", test_lw_segment_intersects)) ||
- (NULL == CU_add_test(pSuite, "test_lwline_crossing_short_lines()", test_lwline_crossing_short_lines)) ||
- (NULL == CU_add_test(pSuite, "test_lwline_crossing_long_lines()", test_lwline_crossing_long_lines)) ||
- (NULL == CU_add_test(pSuite, "test_lwline_crossing_bugs()", test_lwline_crossing_bugs)) ||
- (NULL == CU_add_test(pSuite, "test_lwpoint_set_ordinate()", test_lwpoint_set_ordinate)) ||
- (NULL == CU_add_test(pSuite, "test_lwpoint_get_ordinate()", test_lwpoint_get_ordinate)) ||
- (NULL == CU_add_test(pSuite, "test_lwpoint_interpolate()", test_lwpoint_interpolate)) ||
- (NULL == CU_add_test(pSuite, "test_lwline_clip()", test_lwline_clip)) ||
- (NULL == CU_add_test(pSuite, "test_lwline_clip_big()", test_lwline_clip_big)) ||
- (NULL == CU_add_test(pSuite, "test_lwmline_clip()", test_lwmline_clip)) ||
- (NULL == CU_add_test(pSuite, "test_geohash_point()", test_geohash_point)) ||
- (NULL == CU_add_test(pSuite, "test_geohash_precision()", test_geohash_precision)) ||
- (NULL == CU_add_test(pSuite, "test_geohash()", test_geohash))
- )
- {
- CU_cleanup_registry();
- return NULL;
- }
- return pSuite;
-}
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
+#include "lwalgorithm.h"
+#include "cu_tester.h"
/*
** Global variables used by tests below
}
+/*
+** Used by test harness to register the tests in this file.
+*/
+CU_TestInfo algorithms_tests[] = {
+ PG_TEST(test_lw_segment_side),
+ PG_TEST(test_lw_segment_intersects),
+ PG_TEST(test_lwline_crossing_short_lines),
+ PG_TEST(test_lwline_crossing_long_lines),
+ PG_TEST(test_lwline_crossing_bugs),
+ PG_TEST(test_lwpoint_set_ordinate),
+ PG_TEST(test_lwpoint_get_ordinate),
+ PG_TEST(test_lwpoint_interpolate),
+ PG_TEST(test_lwline_clip),
+ PG_TEST(test_lwline_clip_big),
+ PG_TEST(test_lwmline_clip),
+ PG_TEST(test_geohash_point),
+ PG_TEST(test_geohash_precision),
+ PG_TEST(test_geohash),
+ CU_TEST_INFO_NULL
+};
+CU_SuiteInfo algorithms_suite = {"PostGIS Computational Geometry Suite", init_cg_suite, clean_cg_suite, algorithms_tests};
+++ /dev/null
-/**********************************************************************
- * $Id$
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- * Copyright 2008 Paul Ramsey
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "lwalgorithm.h"
-#include "cu_tester.h"
-
-/***********************************************************************
-** for Computational Geometry Suite
-*/
-
-/* Test functions */
-void test_lw_segment_side(void);
-void test_lw_segment_intersects(void);
-void test_lwline_crossing_short_lines(void);
-void test_lwline_crossing_long_lines(void);
-void test_lwpoint_set_ordinate(void);
-void test_lwpoint_get_ordinate(void);
-void test_lwpoint_interpolate(void);
-void test_lwline_clip(void);
-void test_lwline_clip_big(void);
-void test_lwmline_clip(void);
-void test_geohash_precision(void);
-void test_geohash_point(void);
-void test_geohash(void);
-void test_lwline_crossing_bugs(void);
*
**********************************************************************/
-#include "cu_geodetic.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
-#define RANDOM_TEST 0
-
-/*
-** Called from test harness to register the tests in this file.
-*/
-CU_pSuite register_geodetic_suite(void)
-{
- CU_pSuite pSuite;
- pSuite = CU_add_suite("Geodetic Suite", init_geodetic_suite, clean_geodetic_suite);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
-
- if (
- (NULL == CU_add_test(pSuite, "test_signum()", test_signum)) ||
- (NULL == CU_add_test(pSuite, "test_gbox_from_spherical_coordinates()", test_gbox_from_spherical_coordinates)) ||
- (NULL == CU_add_test(pSuite, "test_gserialized_get_gbox_geocentric()", test_gserialized_get_gbox_geocentric)) ||
- (NULL == CU_add_test(pSuite, "test_clairaut()", test_clairaut)) ||
- (NULL == CU_add_test(pSuite, "test_edge_intersection()", test_edge_intersection)) ||
- (NULL == CU_add_test(pSuite, "test_edge_distance_to_point()", test_edge_distance_to_point)) ||
- (NULL == CU_add_test(pSuite, "test_edge_distance_to_edge()", test_edge_distance_to_edge)) ||
- (NULL == CU_add_test(pSuite, "test_lwgeom_distance_sphere()", test_lwgeom_distance_sphere)) ||
- (NULL == CU_add_test(pSuite, "test_lwgeom_check_geodetic()", test_lwgeom_check_geodetic)) ||
- (NULL == CU_add_test(pSuite, "test_gbox_calculation()", test_gbox_calculation)) ||
- (NULL == CU_add_test(pSuite, "test_gserialized_from_lwgeom()", test_gserialized_from_lwgeom)) ||
- (NULL == CU_add_test(pSuite, "test_spheroid_distance()", test_spheroid_distance)) ||
- (NULL == CU_add_test(pSuite, "test_spheroid_area()", test_spheroid_area)) ||
- (NULL == CU_add_test(pSuite, "test_lwpoly_covers_point2d()", test_lwpoly_covers_point2d)) ||
- (NULL == CU_add_test(pSuite, "test_ptarray_point_in_ring()", test_ptarray_point_in_ring))
- )
- {
- CU_cleanup_registry();
- return NULL;
- }
- return pSuite;
-}
-
-/*
-** The suite initialization function.
-** Create any re-used objects.
-*/
-int init_geodetic_suite(void)
-{
- return 0;
-}
-
-/*
-** The suite cleanup function.
-** Frees any global objects.
-*/
-int clean_geodetic_suite(void)
-{
- return 0;
-}
+#include "lwgeodetic.h"
+#include "cu_tester.h"
+#define RANDOM_TEST 0
/**
* Convert an edge from degrees to radians.
}
+
+/*
+** Used by test harness to register the tests in this file.
+*/
+CU_TestInfo geodetic_tests[] = {
+ PG_TEST(test_signum),
+ PG_TEST(test_gbox_from_spherical_coordinates),
+ PG_TEST(test_gserialized_get_gbox_geocentric),
+ PG_TEST(test_clairaut),
+ PG_TEST(test_edge_intersection),
+ PG_TEST(test_edge_distance_to_point),
+ PG_TEST(test_edge_distance_to_edge),
+ PG_TEST(test_lwgeom_distance_sphere),
+ PG_TEST(test_lwgeom_check_geodetic),
+ PG_TEST(test_gbox_calculation),
+ PG_TEST(test_gserialized_from_lwgeom),
+ PG_TEST(test_spheroid_distance),
+ PG_TEST(test_spheroid_area),
+ PG_TEST(test_lwpoly_covers_point2d),
+ PG_TEST(test_ptarray_point_in_ring),
+ CU_TEST_INFO_NULL
+};
+CU_SuiteInfo geodetic_suite = {"Geodetic Suite", NULL, NULL, geodetic_tests};
+++ /dev/null
-/**********************************************************************
- * $Id$
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "lwgeodetic.h"
-#include "cu_tester.h"
-
-/***********************************************************************
-** For new geography library lwgeodetic.h
-*/
-
-
-/* Test functions */
-void test_signum(void);
-void test_gbox_from_spherical_coordinates(void);
-void test_gserialized_get_gbox_geocentric(void);
-void test_clairaut(void);
-void test_gbox_calculation(void);
-void test_edge_intersection(void);
-void test_edge_distance_to_point(void);
-void test_edge_distance_to_edge(void);
-void test_ptarray_point_in_ring_winding(void);
-void test_lwgeom_distance_sphere(void);
-void test_ptarray_point_in_ring(void);
-void test_spheroid_distance(void);
-void test_spheroid_area(void);
-void test_lwpoly_covers_point2d(void);
-void test_gbox_calculation(void);
-void test_lwgeom_check_geodetic(void);
-void test_gserialized_from_lwgeom(void);
*
**********************************************************************/
-#include "cu_homogenize.h"
-
-/*
-** Called from test harness to register the tests in this file.
-*/
-CU_pSuite register_homogenize_suite(void)
-{
- CU_pSuite pSuite;
- pSuite = CU_add_suite("Homogenize Suite", init_homogenize_suite, clean_homogenize_suite);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
-
- if ( (NULL == CU_add_test(pSuite, "test_coll_point()", test_coll_point)) ||
- (NULL == CU_add_test(pSuite, "test_coll_line()", test_coll_line)) ||
- (NULL == CU_add_test(pSuite, "test_coll_poly()", test_coll_poly)) ||
- (NULL == CU_add_test(pSuite, "test_coll_coll()", test_coll_coll)) ||
- (NULL == CU_add_test(pSuite, "test_geom()", test_geom))
- )
- {
- CU_cleanup_registry();
- return NULL;
- }
- return pSuite;
-}
-
-/*
-** The suite initialization function.
-** Create any re-used objects.
-*/
-int init_homogenize_suite(void)
-{
- return 0;
-}
-
-/*
-** The suite cleanup function.
-** Frees any global objects.
-*/
-int clean_homogenize_suite(void)
-{
- return 0;
-}
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
+#include "libgeom.h"
+#include "cu_tester.h"
static void do_geom_test(char * in, char * out)
{
do_geom_test("POINT(1 2 3 4)",
"POINT(1 2 3 4)");
}
+
+/*
+** Used by test harness to register the tests in this file.
+*/
+CU_TestInfo homogenize_tests[] = {
+ PG_TEST(test_coll_point),
+ PG_TEST(test_coll_line),
+ PG_TEST(test_coll_poly),
+ PG_TEST(test_coll_coll),
+ PG_TEST(test_geom),
+ CU_TEST_INFO_NULL
+};
+CU_SuiteInfo homogenize_suite = {"Homogenize Suite", NULL, NULL, homogenize_tests};
+++ /dev/null
-/**********************************************************************
- * $Id:$
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- * Copyright 2009 Olivier Courtin <olivier.courtin@oslandia.com>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "libgeom.h"
-#include "cu_tester.h"
-
-/**********************************************************************/
-
-
-/* Test functions */
-void test_coll_point(void);
-void test_coll_line(void);
-void test_coll_poly(void);
-void test_coll_coll(void);
-void test_geom(void);
*
**********************************************************************/
-#include "cu_libgeom.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
-/*
-** Called from test harness to register the tests in this file.
-*/
-CU_pSuite register_libgeom_suite(void)
-{
- CU_pSuite pSuite;
- pSuite = CU_add_suite("LibGeom Suite", init_libgeom_suite, clean_libgeom_suite);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
-
- if (
- (NULL == CU_add_test(pSuite, "test_typmod_macros()", test_typmod_macros)) ||
- (NULL == CU_add_test(pSuite, "test_flags_macros()", test_flags_macros)) ||
- (NULL == CU_add_test(pSuite, "test_serialized_srid()", test_serialized_srid)) ||
- (NULL == CU_add_test(pSuite, "test_gserialized_from_lwgeom_size()", test_gserialized_from_lwgeom_size)) ||
- (NULL == CU_add_test(pSuite, "test_gbox_serialized_size()", test_gbox_serialized_size)) ||
- (NULL == CU_add_test(pSuite, "test_lwgeom_from_gserialized()", test_lwgeom_from_gserialized)) ||
- (NULL == CU_add_test(pSuite, "test_lwgeom_count_vertices()", test_lwgeom_count_vertices)) ||
- (NULL == CU_add_test(pSuite, "test_on_gser_lwgeom_count_vertices()", test_on_gser_lwgeom_count_vertices)) ||
- (NULL == CU_add_test(pSuite, "test_geometry_type_from_string()", test_geometry_type_from_string)) ||
- (NULL == CU_add_test(pSuite, "test_lwcollection_extract()", test_lwcollection_extract)) ||
- (NULL == CU_add_test(pSuite, "test_lwgeom_free()", test_lwgeom_free))
-
- )
- {
- CU_cleanup_registry();
- return NULL;
- }
- return pSuite;
-}
-
-/*
-** The suite initialization function.
-** Create any re-used objects.
-*/
-int init_libgeom_suite(void)
-{
- return 0;
-}
-
-/*
-** The suite cleanup function.
-** Frees any global objects.
-*/
-int clean_libgeom_suite(void)
-{
- return 0;
-}
+#include "libgeom.h"
+#include "cu_tester.h"
void test_typmod_macros(void)
{
lwgeom_free(geom);
}
+
+/*
+** Used by test harness to register the tests in this file.
+*/
+CU_TestInfo libgeom_tests[] = {
+ PG_TEST(test_typmod_macros),
+ PG_TEST(test_flags_macros),
+ PG_TEST(test_serialized_srid),
+ PG_TEST(test_gserialized_from_lwgeom_size),
+ PG_TEST(test_gbox_serialized_size),
+ PG_TEST(test_lwgeom_from_gserialized),
+ PG_TEST(test_lwgeom_count_vertices),
+ PG_TEST(test_on_gser_lwgeom_count_vertices),
+ PG_TEST(test_geometry_type_from_string),
+ PG_TEST(test_lwcollection_extract),
+ PG_TEST(test_lwgeom_free),
+ CU_TEST_INFO_NULL
+};
+CU_SuiteInfo libgeom_suite = {"LibGeom Suite", NULL, NULL, libgeom_tests};
+++ /dev/null
-/**********************************************************************
- * $Id$
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "libgeom.h"
-#include "cu_tester.h"
-
-/***********************************************************************
-** For new geometry library libgeom.h
-*/
-
-
-/* Test functions */
-void test_typmod_macros(void);
-void test_flags_macros(void);
-void test_serialized_srid(void);
-void test_gserialized_from_lwgeom_size(void);
-void test_lwgeom_from_gserialized(void);
-void test_geometry_type_from_string(void);
-void test_gbox_serialized_size(void);
-void test_lwcollection_extract(void);
-void test_lwgeom_count_vertices(void);
-void test_on_gser_lwgeom_count_vertices(void);
-void test_lwgeom_free(void);
*
**********************************************************************/
-#include "cu_measures.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
-/*
-** Called from test harness to register the tests in this file.
-*/
-CU_pSuite register_measures_suite(void)
-{
- CU_pSuite pSuite;
- pSuite = CU_add_suite("PostGIS Measures Suite", init_measures_suite, clean_measures_suite);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
-
- if (
- (NULL == CU_add_test(pSuite, "test_mindistance2d_tolerance()", test_mindistance2d_tolerance)) ||
- (NULL == CU_add_test(pSuite, "test_rect_tree_contains_point()", test_rect_tree_contains_point)) ||
- (NULL == CU_add_test(pSuite, "test_rect_tree_intersects_tree()", test_rect_tree_intersects_tree))
- )
- {
- CU_cleanup_registry();
- return NULL;
- }
- return pSuite;
-}
-
-/*
-** The suite initialization function.
-** Create any re-used objects.
-*/
-int init_measures_suite(void)
-{
- return 0;
-}
-
-/*
-** The suite cleanup function.
-** Frees any global objects.
-*/
-int clean_measures_suite(void)
-{
- return 0;
-}
+#include "liblwgeom.h"
+#include "cu_tester.h"
+#include "measures.h"
+#include "lwtree.h"
void test_mindistance2d_tolerance(void)
{
}
+
+/*
+** Used by test harness to register the tests in this file.
+*/
+CU_TestInfo measures_tests[] = {
+ PG_TEST(test_mindistance2d_tolerance),
+ PG_TEST(test_rect_tree_contains_point),
+ PG_TEST(test_rect_tree_intersects_tree),
+ CU_TEST_INFO_NULL
+};
+CU_SuiteInfo measures_suite = {"PostGIS Measures Suite", NULL, NULL, measures_tests};
+++ /dev/null
-/**********************************************************************
- * $Id$
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "liblwgeom.h"
-#include "cu_tester.h"
-#include "measures.h"
-#include "lwtree.h"
-
-/***********************************************************************
-** for Computational Geometry Suite
-*/
-
-
-
-/* Test functions */
-void test_mindistance2d_tolerance(void);
-void test_rect_tree_contains_point(void);
-void test_rect_tree_intersects_tree(void);
-
*
**********************************************************************/
-#include "cu_out_geojson.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
-/*
-** Called from test harness to register the tests in this file.
-*/
-CU_pSuite register_out_geojson_suite(void)
-{
- CU_pSuite pSuite;
- pSuite = CU_add_suite("GeoJson Out Suite", init_out_geojson_suite, clean_out_geojson_suite);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
-
- if (
- (NULL == CU_add_test(pSuite, "test_precision()", out_geojson_test_precision)) ||
- (NULL == CU_add_test(pSuite, "test_dims()", out_geojson_test_dims)) ||
- (NULL == CU_add_test(pSuite, "test_srid()", out_geojson_test_srid)) ||
- (NULL == CU_add_test(pSuite, "test_bbox()", out_geojson_test_bbox)) ||
- (NULL == CU_add_test(pSuite, "test_geoms()", out_geojson_test_geoms))
- )
- {
- CU_cleanup_registry();
- return NULL;
- }
- return pSuite;
-}
-
-/*
-** The suite initialization function.
-** Create any re-used objects.
-*/
-int init_out_geojson_suite(void)
-{
- return 0;
-}
-
-/*
-** The suite cleanup function.
-** Frees any global objects.
-*/
-int clean_out_geojson_suite(void)
-{
- return 0;
-}
+#include "libgeom.h"
+#include "cu_tester.h"
static void do_geojson_test(char * in, char * out, char * srs, int precision, int has_bbox)
{
"MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0)),((7 8,10 10,6 14,4 11,7 8)))",
"lwgeom_to_geojson: 'MultiSurface' geometry type not supported");
}
+
+/*
+** Used by test harness to register the tests in this file.
+*/
+CU_TestInfo out_geojson_tests[] = {
+ PG_TEST(out_geojson_test_precision),
+ PG_TEST(out_geojson_test_dims),
+ PG_TEST(out_geojson_test_srid),
+ PG_TEST(out_geojson_test_bbox),
+ PG_TEST(out_geojson_test_geoms),
+ CU_TEST_INFO_NULL
+};
+CU_SuiteInfo out_geojson_suite = {"GeoJson Out Suite", NULL, NULL, out_geojson_tests};
+++ /dev/null
-/**********************************************************************
- * $Id:$
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- * Copyright 2010 Olivier Courtin <olivier.courtin@oslandia.com>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "libgeom.h"
-#include "cu_tester.h"
-
-/**********************************************************************/
-
-
-/* Test functions */
-void out_geojson_test_precision(void);
-void out_geojson_test_geoms(void);
-void out_geojson_test_dims(void);
-void out_geojson_test_srid(void);
-void out_geojson_test_bbox(void);
*
**********************************************************************/
-#include "cu_out_gml.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
-/*
-** Called from test harness to register the tests in this file.
-*/
-CU_pSuite register_out_gml_suite(void)
-{
- CU_pSuite pSuite;
- pSuite = CU_add_suite("GML Out Suite", init_out_gml_suite, clean_out_gml_suite);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
-
- if (
- (NULL == CU_add_test(pSuite, "test_precision()", out_gml_test_precision)) ||
- (NULL == CU_add_test(pSuite, "test_srid()", out_gml_test_srid)) ||
- (NULL == CU_add_test(pSuite, "test_dims()", out_gml_test_dims)) ||
- (NULL == CU_add_test(pSuite, "test_geodetic()", out_gml_test_geodetic)) ||
- (NULL == CU_add_test(pSuite, "test_geoms()", out_gml_test_geoms))
- )
- {
- CU_cleanup_registry();
- return NULL;
- }
- return pSuite;
-}
-
-/*
-** The suite initialization function.
-** Create any re-used objects.
-*/
-int init_out_gml_suite(void)
-{
- return 0;
-}
-
-/*
-** The suite cleanup function.
-** Frees any global objects.
-*/
-int clean_out_gml_suite(void)
-{
- return 0;
-}
+#include "libgeom.h"
+#include "cu_tester.h"
static void do_gml2_test(char * in, char * out, char * srs, int precision)
{
"MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0)),((7 8,10 10,6 14,4 11,7 8)))",
"lwgeom_to_gml3: 'MultiSurface' geometry type not supported");
}
+
+/*
+** Used by test harness to register the tests in this file.
+*/
+CU_TestInfo out_gml_tests[] = {
+ PG_TEST(out_gml_test_precision),
+ PG_TEST(out_gml_test_srid),
+ PG_TEST(out_gml_test_dims),
+ PG_TEST(out_gml_test_geodetic),
+ PG_TEST(out_gml_test_geoms),
+ CU_TEST_INFO_NULL
+};
+CU_SuiteInfo out_gml_suite = {"GML Out Suite", NULL, NULL, out_gml_tests};
+++ /dev/null
-/**********************************************************************
- * $Id:$
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- * Copyright 2010 Olivier Courtin <olivier.courtin@oslandia.com>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "libgeom.h"
-#include "cu_tester.h"
-
-/**********************************************************************/
-
-
-/* Test functions */
-void out_gml_test_precision(void);
-void out_gml_test_srid(void);
-void out_gml_test_geodetic(void);
-void out_gml_test_geoms(void);
-void out_gml_test_dims(void);
*
**********************************************************************/
-#include "cu_out_kml.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
-/*
-** Called from test harness to register the tests in this file.
-*/
-CU_pSuite register_out_kml_suite(void)
-{
- CU_pSuite pSuite;
- pSuite = CU_add_suite("KML Out Suite", init_out_kml_suite, clean_out_kml_suite);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
-
- if (
- (NULL == CU_add_test(pSuite, "test_precision()", out_kml_test_precision)) ||
- (NULL == CU_add_test(pSuite, "test_dims()", out_kml_test_dims)) ||
- (NULL == CU_add_test(pSuite, "test_geoms()", out_kml_test_geoms))
- )
- {
- CU_cleanup_registry();
- return NULL;
- }
- return pSuite;
-}
-
-/*
-** The suite initialization function.
-** Create any re-used objects.
-*/
-int init_out_kml_suite(void)
-{
- return 0;
-}
-
-/*
-** The suite cleanup function.
-** Frees any global objects.
-*/
-int clean_out_kml_suite(void)
-{
- return 0;
-}
+#include "libgeom.h"
+#include "cu_tester.h"
static void do_kml_test(char * in, char * out, int precision)
{
"MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0)),((7 8,10 10,6 14,4 11,7 8)))",
"lwgeom_to_kml2: 'MultiSurface' geometry type not supported");
}
+
+/*
+** Used by test harness to register the tests in this file.
+*/
+CU_TestInfo out_kml_tests[] = {
+ PG_TEST(out_kml_test_precision),
+ PG_TEST(out_kml_test_dims),
+ PG_TEST(out_kml_test_geoms),
+ CU_TEST_INFO_NULL
+};
+CU_SuiteInfo out_kml_suite = {"KML Out Suite", NULL, NULL, out_kml_tests};
+++ /dev/null
-/**********************************************************************
- * $Id:$
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- * Copyright 2010 Olivier Courtin <olivier.courtin@oslandia.com>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "libgeom.h"
-#include "cu_tester.h"
-
-/**********************************************************************/
-
-
-/* Test functions */
-void out_kml_test_precision(void);
-void out_kml_test_geoms(void);
-void out_kml_test_dims(void);
*
**********************************************************************/
-#include "cu_out_svg.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
-/*
-** Called from test harness to register the tests in this file.
-*/
-CU_pSuite register_out_svg_suite(void)
-{
- CU_pSuite pSuite;
- pSuite = CU_add_suite("SVG Out Suite", init_out_svg_suite, clean_out_svg_suite);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
-
- if (
- (NULL == CU_add_test(pSuite, "test_precision()", out_svg_test_precision)) ||
- (NULL == CU_add_test(pSuite, "test_dims()", out_svg_test_dims)) ||
- (NULL == CU_add_test(pSuite, "test_relative()", out_svg_test_relative)) ||
- (NULL == CU_add_test(pSuite, "test_geoms()", out_svg_test_geoms)) ||
- (NULL == CU_add_test(pSuite, "test_srid()", out_svg_test_srid))
- )
- {
- CU_cleanup_registry();
- return NULL;
- }
- return pSuite;
-}
-
-/*
-** The suite initialization function.
-** Create any re-used objects.
-*/
-int init_out_svg_suite(void)
-{
- return 0;
-}
-
-/*
-** The suite cleanup function.
-** Frees any global objects.
-*/
-int clean_out_svg_suite(void)
-{
- return 0;
-}
+#include "libgeom.h"
+#include "cu_tester.h"
static void do_svg_test(char * in, char * out, int precision, int relative)
{
"M 0 -1 l 2 -2",
0, 1);
}
+
+/*
+** Used by test harness to register the tests in this file.
+*/
+CU_TestInfo out_svg_tests[] = {
+ PG_TEST(out_svg_test_precision),
+ PG_TEST(out_svg_test_dims),
+ PG_TEST(out_svg_test_relative),
+ PG_TEST(out_svg_test_geoms),
+ PG_TEST(out_svg_test_srid),
+ CU_TEST_INFO_NULL
+};
+CU_SuiteInfo out_svg_suite = {"SVG Out Suite", NULL, NULL, out_svg_tests};
+++ /dev/null
-/**********************************************************************
- * $Id:$
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- * Copyright 2010 Olivier Courtin <olivier.courtin@oslandia.com>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "libgeom.h"
-#include "cu_tester.h"
-
-/**********************************************************************/
-
-
-/* Test functions */
-void out_svg_test_precision(void);
-void out_svg_test_geoms(void);
-void out_svg_test_dims(void);
-void out_svg_test_srid(void);
-void out_svg_test_relative(void);
*
**********************************************************************/
-#include "cu_print.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
-/*
-** Called from test harness to register the tests in this file.
-*/
-CU_pSuite register_print_suite(void)
-{
- CU_pSuite pSuite;
- pSuite = CU_add_suite("PostGIS Print Suite", init_print_suite, clean_print_suite);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
-
- if (
- (NULL == CU_add_test(pSuite, "test_lwprint_default_format()", test_lwprint_default_format)) ||
- (NULL == CU_add_test(pSuite, "test_lwprint_format_order()", test_lwprint_format_order)) ||
- (NULL == CU_add_test(pSuite, "test_lwprint_format_optional()", test_lwprint_format_optional)) ||
- (NULL == CU_add_test(pSuite, "test_lwprint_oddball_format()", test_lwprint_oddball_format)) ||
- (NULL == CU_add_test(pSuite, "test_lwprint_bad_formats()", test_lwprint_bad_formats))
- )
- {
- CU_cleanup_registry();
- return NULL;
- }
- return pSuite;
-}
-
-
-/*
-** The suite initialization function.
-** Create any re-used objects.
-*/
-int init_print_suite(void)
-{
- return 0;
-}
+#include "liblwgeom.h"
+#include "cu_tester.h"
-/*
-** The suite cleanup function.
-** Frees any global objects.
-*/
-int clean_print_suite(void)
-{
- return 0;
-}
static void test_lwprint_assert_format(char * point_wkt, const char * format, const char * expected)
{
/*
* Test all possible combinations of the orders of the parameters.
*/
-void test_lwprint_format_order(void)
+void test_lwprint_format_orders(void)
{
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "C DD MM SS", "S 12 20 44 W 45 27 16");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "C DD SS MM", "S 12 44 20 W 45 16 27");
/*
* Test with and without the optional parameters.
*/
-void test_lwprint_format_optional(void)
+void test_lwprint_optional_format(void)
{
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD", "-12.346 -45.455");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD C", "12.346 S 45.455 W");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD MM.MMM SS.SSS C", "12.000 20.000 44.412 S 45.000 27.000 16.200 W");
}
-void test_lwprint_oddball_format(void)
+void test_lwprint_oddball_formats(void)
{
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DD.DDDMM.MMMSS.SSSC", "12.00020.00044.412S 45.00027.00016.200W");
test_lwprint_assert_format("POINT(-45.4545 -12.34567)", "DDMM.MMM", "-1220.740 -4527.270");
test_lwprint_assert_error("POINT(1.23456 7.89012)", "DD.DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD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jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
}
+
+/*
+** Used by the test harness to register the tests in this file.
+*/
+CU_TestInfo print_tests[] = {
+ PG_TEST(test_lwprint_default_format),
+ PG_TEST(test_lwprint_format_orders),
+ PG_TEST(test_lwprint_optional_format),
+ PG_TEST(test_lwprint_oddball_formats),
+ PG_TEST(test_lwprint_bad_formats),
+ CU_TEST_INFO_NULL
+};
+CU_SuiteInfo print_suite = {"print_suite", NULL, NULL, print_tests };
+++ /dev/null
-/**********************************************************************
- * $Id: cu_print.h 4786 2009-11-11 19:02:19Z pramsey $
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- * Copyright 2008 Paul Ramsey
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "liblwgeom.h"
-#include "cu_tester.h"
-
-/***********************************************************************
-** for Print Suite
-*/
-
-/* Test functions */
-void test_lwprint_default_format(void);
-void test_lwprint_format_order(void);
-void test_lwprint_format_optional(void);
-void test_lwprint_bad_formats(void);
-void test_lwprint_oddball_format(void);
#include "liblwgeom.h"
#include "cu_tester.h"
-
-/**
- * CUnit error handler
- * Log message in a global var instead of printing in stderr
- *
- * CAUTION: Not stop execution on lwerror case !!!
- */
-static void
-cu_errorreporter(const char *fmt, va_list ap)
-{
- char *msg;
-
- /** This is a GNU extension.
- * Dunno how to handle errors here.
- */
- if (!lw_vasprintf (&msg, fmt, ap))
- {
- va_end (ap);
- return;
- }
-
- strncpy(cu_error_msg, msg, MAX_CUNIT_ERROR_LENGTH);
-}
-
-void
-cu_error_msg_reset()
-{
- memset(cu_error_msg, '\0', MAX_CUNIT_ERROR_LENGTH);
-}
-
-/*CU_named_suite *
-cu_create_suite(const char *name, CU_InitializeFunc init_func, CU_CleanupFunc clean_func) {
- CU_pSuite pSuite = CU_add_suite(name, init_func, clean_func);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
- num_suites++;
-}
-void cu_add_named_test(CU_named_suite *nSuite, const char *name, CU_TestFunc test_func) {
- strcpy(nSuite->tests[nSuite->num_tests].name, name);
- nSuite->tests[nSuite->num_tests].test_func = CU_add_test(nSuite->cu_suite, name, test_func);
- if (NULL == nSuite->tests[nSuite->num_tests].test_func) {
- CU_cleanup_registry();
- return NULL;
- }
- nSuite->num_tests++;
-}*/
-
-/*
-** Set up liblwgeom to run in stand-alone mode using the
-** usual system memory handling functions.
-*/
-void lwgeom_init_allocators(void)
-{
- lwalloc_var = default_allocator;
- lwrealloc_var = default_reallocator;
- lwfree_var = default_freeor;
- lwnotice_var = default_noticereporter;
- lwerror_var = cu_errorreporter;
-}
+/* ADD YOUR SUITE HERE (1 of 2) */
+extern CU_SuiteInfo print_suite;
+extern CU_SuiteInfo algorithms_suite;
+extern CU_SuiteInfo measures_suite;
+extern CU_SuiteInfo wkt_suite;
+extern CU_SuiteInfo libgeom_suite;
+extern CU_SuiteInfo geodetic_suite;
+extern CU_SuiteInfo homogenize_suite;
+extern CU_SuiteInfo out_gml_suite;
+extern CU_SuiteInfo out_kml_suite;
+extern CU_SuiteInfo out_geojson_suite;
+extern CU_SuiteInfo out_svg_suite;
/*
** The main() function for setting up and running the tests.
*/
int main(int argc, char *argv[])
{
+ /* ADD YOUR SUITE HERE (2 of 2) */
+ CU_SuiteInfo suites[] = {
+ print_suite,
+ algorithms_suite,
+ measures_suite,
+ wkt_suite,
+ libgeom_suite,
+ geodetic_suite,
+ homogenize_suite,
+ out_gml_suite,
+ out_kml_suite,
+ out_geojson_suite,
+ out_svg_suite,
+ CU_SUITE_INFO_NULL
+ };
+
int index;
char *suite_name;
CU_pSuite suite_to_run;
int num_failed;
/* initialize the CUnit test registry */
- if (CUE_SUCCESS != CU_initialize_registry())
- return CU_get_error();
-
- /* Add the algorithms suite to the registry */
- if (NULL == register_cg_suite())
- {
- CU_cleanup_registry();
- return CU_get_error();
+ if (CUE_SUCCESS != CU_initialize_registry()) {
+ errCode = CU_get_error();
+ printf(" Error attempting to initialize registry: %d. See CUError.h for error code list.\n", errCode);
+ return errCode;
}
- /* Add the measures suite to the registry */
- if (NULL == register_measures_suite())
- {
- CU_cleanup_registry();
- return CU_get_error();
- }
-
- /* Add the wkt suite to the registry */
- if (NULL == register_wkt_suite())
- {
- CU_cleanup_registry();
- return CU_get_error();
- }
-
- /* Add the libgeom suite to the registry */
- if (NULL == register_libgeom_suite())
- {
- CU_cleanup_registry();
- return CU_get_error();
- }
-
- /* Add the geodetic suite to the registry */
- if (NULL == register_geodetic_suite())
- {
- CU_cleanup_registry();
- return CU_get_error();
- }
-
- /* Add the print suite to the registry */
- if (NULL == register_print_suite())
- {
- CU_cleanup_registry();
- return CU_get_error();
- }
-
- /* Add the homogenize suite to the registry */
- if (NULL == register_homogenize_suite())
- {
- CU_cleanup_registry();
- return CU_get_error();
- }
-
- /* Add the gml suite to the registry */
- if (NULL == register_out_gml_suite())
- {
- CU_cleanup_registry();
- return CU_get_error();
- }
-
- /* Add the kml suite to the registry */
- if (NULL == register_out_kml_suite())
- {
- CU_cleanup_registry();
- return CU_get_error();
- }
-
- /* Add the geojson suite to the registry */
- if (NULL == register_out_geojson_suite())
- {
- CU_cleanup_registry();
- return CU_get_error();
- }
-
- /* Add the svg suite to the registry */
- if (NULL == register_out_svg_suite())
- {
- CU_cleanup_registry();
- return CU_get_error();
+ /* Register all the test suites. */
+ if (CUE_SUCCESS != CU_register_suites(suites)) {
+ errCode = CU_get_error();
+ printf(" Error attempting to register test suites: %d. See CUError.h for error code list.\n", errCode);
+ return errCode;
}
/* Run all tests using the CUnit Basic interface */
CU_cleanup_registry();
return CU_get_error();
}
+/**
+ * CUnit error handler
+ * Log message in a global var instead of printing in stderr
+ *
+ * CAUTION: Not stop execution on lwerror case !!!
+ */
+static void
+cu_errorreporter(const char *fmt, va_list ap)
+{
+ char *msg;
+
+ /** This is a GNU extension.
+ * Dunno how to handle errors here.
+ */
+ if (!lw_vasprintf (&msg, fmt, ap))
+ {
+ va_end (ap);
+ return;
+ }
+
+ strncpy(cu_error_msg, msg, MAX_CUNIT_ERROR_LENGTH);
+}
+
+void
+cu_error_msg_reset()
+{
+ memset(cu_error_msg, '\0', MAX_CUNIT_ERROR_LENGTH);
+}
+
+/*
+** Set up liblwgeom to run in stand-alone mode using the
+** usual system memory handling functions.
+*/
+void lwgeom_init_allocators(void)
+{
+ lwalloc_var = default_allocator;
+ lwrealloc_var = default_reallocator;
+ lwfree_var = default_freeor;
+ lwnotice_var = default_noticereporter;
+ lwerror_var = cu_errorreporter;
+}
+
+#define PG_TEST(test_func) { #test_func, test_func }
#define MAX_CUNIT_ERROR_LENGTH 512
char cu_error_msg[MAX_CUNIT_ERROR_LENGTH+1];
void cu_error_msg_reset();
-CU_pSuite register_measures_suite(void);
-CU_pSuite register_geodetic_suite(void);
-CU_pSuite register_libgeom_suite(void);
-CU_pSuite register_cg_suite(void);
-CU_pSuite register_print_suite(void);
-CU_pSuite register_wkt_suite(void);
-CU_pSuite register_homogenize_suite(void);
-CU_pSuite register_out_gml_suite(void);
-CU_pSuite register_out_kml_suite(void);
-CU_pSuite register_out_geojson_suite(void);
-CU_pSuite register_out_svg_suite(void);
-
-int init_measures_suite(void);
-int init_geodetic_suite(void);
-int init_libgeom_suite(void);
-int init_cg_suite(void);
-int init_print_suite(void);
-int init_wkt_suite(void);
-int init_homogenize_suite(void);
-int init_out_gml_suite(void);
-int init_out_kml_suite(void);
-int init_out_geojson_suite(void);
-int init_out_svg_suite(void);
-
-int clean_measures_suite(void);
-int clean_geodetic_suite(void);
-int clean_libgeom_suite(void);
-int clean_cg_suite(void);
-int clean_print_suite(void);
-int clean_wkt_suite(void);
-int clean_homogenize_suite(void);
-int clean_out_gml_suite(void);
-int clean_out_kml_suite(void);
-int clean_out_geojson_suite(void);
-int clean_out_svg_suite(void);
-
*
**********************************************************************/
-#include "cu_wkt.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "CUnit/Basic.h"
-/*
-** Called from test harness to register the tests in this file.
-*/
-CU_pSuite register_wkt_suite(void)
-{
- CU_pSuite pSuite;
- pSuite = CU_add_suite("WKT Suite", init_wkt_suite, clean_wkt_suite);
- if (NULL == pSuite)
- {
- CU_cleanup_registry();
- return NULL;
- }
-
- if (
- (NULL == CU_add_test(pSuite, "test_wkt_point()", test_wkt_point)) ||
- (NULL == CU_add_test(pSuite, "test_wkt_linestring()", test_wkt_linestring)) ||
- (NULL == CU_add_test(pSuite, "test_wkt_polygon()", test_wkt_polygon)) ||
- (NULL == CU_add_test(pSuite, "test_wkt_multipoint()", test_wkt_multipoint)) ||
- (NULL == CU_add_test(pSuite, "test_wkt_multilinestring()", test_wkt_multilinestring)) ||
- (NULL == CU_add_test(pSuite, "test_wkt_multipolygon()", test_wkt_multipolygon)) ||
- (NULL == CU_add_test(pSuite, "test_wkt_collection()", test_wkt_collection)) ||
- (NULL == CU_add_test(pSuite, "test_wkt_circularstring()", test_wkt_circularstring)) ||
- (NULL == CU_add_test(pSuite, "test_wkt_compoundcurve()", test_wkt_compoundcurve)) ||
- (NULL == CU_add_test(pSuite, "test_wkt_curvpolygon()", test_wkt_curvpolygon)) ||
- (NULL == CU_add_test(pSuite, "test_wkt_multicurve()", test_wkt_multicurve)) ||
- (NULL == CU_add_test(pSuite, "test_wkt_multisurface()", test_wkt_multisurface))
- )
- {
- CU_cleanup_registry();
- return NULL;
- }
- return pSuite;
-}
+#include "libgeom.h"
+#include "cu_tester.h"
/*
** Global variable to hold WKT strings
}
+/*
+** Used by test harness to register the tests in this file.
+*/
+CU_TestInfo wkt_tests[] = {
+ PG_TEST(test_wkt_point),
+ PG_TEST(test_wkt_linestring),
+ PG_TEST(test_wkt_polygon),
+ PG_TEST(test_wkt_multipoint),
+ PG_TEST(test_wkt_multilinestring),
+ PG_TEST(test_wkt_multipolygon),
+ PG_TEST(test_wkt_collection),
+ PG_TEST(test_wkt_circularstring),
+ PG_TEST(test_wkt_compoundcurve),
+ PG_TEST(test_wkt_curvpolygon),
+ PG_TEST(test_wkt_multicurve),
+ PG_TEST(test_wkt_multisurface),
+ CU_TEST_INFO_NULL
+};
+CU_SuiteInfo wkt_suite = {"WKT Suite", init_wkt_suite, clean_wkt_suite, wkt_tests};
+++ /dev/null
-/**********************************************************************
- * $Id:$
- *
- * PostGIS - Spatial Types for PostgreSQL
- * http://postgis.refractions.net
- * Copyright 2010 Olivier Courtin <olivier.courtin@oslandia.com>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "libgeom.h"
-#include "cu_tester.h"
-
-/**********************************************************************/
-
-
-/* Test functions */
-void test_wkt_point(void);
-void test_wkt_linestring(void);
-void test_wkt_polygon(void);
-void test_wkt_multipoint(void);
-void test_wkt_multilinestring(void);
-void test_wkt_multipolygon(void);
-void test_wkt_collection(void);
-void test_wkt_circularstring(void);
-void test_wkt_compoundcurve(void);
-void test_wkt_curvpolygon(void);
-void test_wkt_multicurve(void);
-void test_wkt_multisurface(void);