[postgis-commits] svn - r3435 - in trunk: . liblwgeom liblwgeom/cunit

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Wed Dec 17 10:20:19 PST 2008


Author: pramsey
Date: 2008-12-17 10:20:18 -0800 (Wed, 17 Dec 2008)
New Revision: 3435

Added:
   trunk/STYLE
   trunk/liblwgeom/cunit/
   trunk/liblwgeom/cunit/Makefile
   trunk/liblwgeom/cunit/cu_algorithm.c
   trunk/liblwgeom/cunit/cu_algorithm.h
   trunk/liblwgeom/cunit/cu_tester.c
Removed:
   trunk/cunit/
   trunk/liblwgeom/cunit/Makefile
   trunk/liblwgeom/cunit/cu_algorithm.c
   trunk/liblwgeom/cunit/cu_algorithm.h
   trunk/liblwgeom/cunit/cu_tester.c
Modified:
   trunk/TODO
Log:
Re-locate cunit, add a STYLE guideline draft and some TODO notes.


Added: trunk/STYLE
===================================================================
--- trunk/STYLE	2008-12-17 16:18:41 UTC (rev 3434)
+++ trunk/STYLE	2008-12-17 18:20:18 UTC (rev 3435)
@@ -0,0 +1,58 @@
+Coding Style Guidelines for PostGIS
+-----------------------------------
+
+:Preamble:
+
+PostGIS was created over many years, by many different people, some in a 
+hurry. As a result, the existing coding style is all over the map. We 
+recognize this, and understand it will be the work of many years before
+PostGIS has a consistently named internal set of functions, but, 
+we can dream. 
+
+If new functions follow this guideline, if we do a little rennovation work
+from time to time, we will eventually get there.
+
+
+:Formatting:
+
+All C code should use an ANSI standard formatting with tabs for block 
+indenting. When not block indenting, use spaces. To convert a file
+to the standard format use:
+
+  astyle --style=ansi --indent=tab
+
+Do not get too happy with this command. If you want to re-format a file you
+are working on:
+
+ a) run astyle on it
+ b) commit
+ c) do your work
+ d) commit
+ e) if you are really finicky run astyle again
+ f) commit
+
+The idea is to avoid combining style-only commits and commits that change
+logic, so the logic commits are easier to read.
+
+Macros should be ALL_UPPERCASE. 
+Enumerations should be ALL_UPPERCASE.
+
+
+:Naming:
+
+For liblwgeom:
+
+- Files should be named with an lw prefix.
+- Functions should have an lw prefix (lw_getPoint).
+- Function names should use underscores, not camel case.
+- Function names should indicate the geometry type of inputs
+  if relevant (lwline_split)
+
+For lwgeom:
+
+- C functions called by the back-end directly (function(PG_FUNCTION_ARGS)) 
+  should be named to match their most likely SQL alias. So
+  the SQL ST_Distance(geometry) maps to the C function
+  ST_Distance(PG_FUNCTION_ARG)
+- C utility functions should be prefixed with pgis_ (lower case)
+

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2008-12-17 16:18:41 UTC (rev 3434)
+++ trunk/TODO	2008-12-17 18:20:18 UTC (rev 3435)
@@ -84,3 +84,11 @@
   http://citeseer.ist.psu.edu/roussopoulos95nearest.html
   http://citeseer.ist.psu.edu/91356.html
 
+
+== Breaking Changes ==
+
+* Convert the "default SRID" from -1 to 0
+* Convert the LWGEOM struct(s) to have enough padding that the coordinates
+  are double-aligned and can be accessed directly as doubles on all
+  architectures
+

Copied: trunk/liblwgeom/cunit (from rev 3427, trunk/cunit)

Deleted: trunk/liblwgeom/cunit/Makefile
===================================================================
--- trunk/cunit/Makefile	2008-12-17 00:22:26 UTC (rev 3427)
+++ trunk/liblwgeom/cunit/Makefile	2008-12-17 18:20:18 UTC (rev 3435)
@@ -1,25 +0,0 @@
-
-LWGEOM=../liblwgeom
-LIBCUNIT=/usr/local/lib/libcunit.a
-LIBLWGEOM=$(LWGEOM)/liblwgeom.a
-
-OBJS =	cu_tester.o \
-	cu_algorithm.o
-
-#---------------------------------------------------------------
-
-INCLUDES = -I/usr/local/include -I$(LWGEOM)
-CFLAGS = -g $(MSDEFINES) $(INCLUDES)
-LIBS = $(LIBCUNIT) $(LIBLWGEOM)
-LDFLAGS = 
-
-cu_tester: $(OBJS) $(LIBS)
-
-test: cu_tester
-	./cu_tester
-
-check: test
-
-clean:
-	@rm $(OBJS)
-	@rm cu_tester

Copied: trunk/liblwgeom/cunit/Makefile (from rev 3434, trunk/cunit/Makefile)
===================================================================
--- trunk/cunit/Makefile	2008-12-17 16:18:41 UTC (rev 3434)
+++ trunk/liblwgeom/cunit/Makefile	2008-12-17 18:20:18 UTC (rev 3435)
@@ -0,0 +1,25 @@
+
+LWGEOM=..
+LIBCUNIT=/usr/local/lib/libcunit.a
+LIBLWGEOM=$(LWGEOM)/liblwgeom.a
+
+OBJS =	cu_tester.o \
+	cu_algorithm.o
+
+#---------------------------------------------------------------
+
+INCLUDES = -I/usr/local/include -I$(LWGEOM)
+CFLAGS = -g $(MSDEFINES) $(INCLUDES)
+LIBS = $(LIBCUNIT) $(LIBLWGEOM)
+LDFLAGS = 
+
+cu_tester: $(OBJS) $(LIBS)
+
+test: cu_tester
+	./cu_tester
+
+check: test
+
+clean:
+	@rm $(OBJS)
+	@rm cu_tester

Deleted: trunk/liblwgeom/cunit/cu_algorithm.c
===================================================================
--- trunk/cunit/cu_algorithm.c	2008-12-17 00:22:26 UTC (rev 3427)
+++ trunk/liblwgeom/cunit/cu_algorithm.c	2008-12-17 18:20:18 UTC (rev 3435)
@@ -1,531 +0,0 @@
-
-#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, "testSegmentSide()", testSegmentSide)) ||
-	    (NULL == CU_add_test(pSuite, "testSegmentIntersects()", testSegmentIntersects)) ||
-	    (NULL == CU_add_test(pSuite, "testLineCrossingShortLines()", testLineCrossingShortLines)) ||
-	    (NULL == CU_add_test(pSuite, "testLineCrossingLongLines()", testLineCrossingLongLines)) 
-	)
-	{
-		CU_cleanup_registry();
-		return NULL;
-	}
-	return pSuite;
-}
-
-
-/*
-** Global variables used by tests below
-*/
-POINT2D *p1 = NULL;
-POINT2D *p2 = NULL;
-POINT2D *q1 = NULL;
-POINT2D *q2 = NULL;
-POINT4D *p = NULL;
-/* Two-point objects */
-POINTARRAY *pa21 = NULL;
-POINTARRAY *pa22 = NULL;
-LWLINE *l21 = NULL;
-LWLINE *l22 = NULL;
-/* Five-point objects */
-POINTARRAY *pa51 = NULL;
-POINTARRAY *pa52 = NULL;
-LWLINE *l51 = NULL;
-LWLINE *l52 = NULL;
-
-
-/*
-** The suite initialization function.
-** Create any re-used objects.
-*/
-int init_cg_suite(void)
-{
-	p = lwalloc(sizeof(POINT4D));
-	p1 = lwalloc(sizeof(POINT2D));
-	p2 = lwalloc(sizeof(POINT2D));
-	q1 = lwalloc(sizeof(POINT2D));
-	q2 = lwalloc(sizeof(POINT2D));
-	pa21 = ptarray_construct(0, 0, 2);
-	pa22 = ptarray_construct(0, 0, 2);
-	l21 = lwline_construct(-1, NULL, pa21);
-	l22 = lwline_construct(-1, NULL, pa22);
-	pa51 = ptarray_construct(0, 0, 5);
-	pa52 = ptarray_construct(0, 0, 5);
-	l51 = lwline_construct(-1, NULL, pa51);
-	l52 = lwline_construct(-1, NULL, pa52);
-	return 0;
-}
-
-/*
-** The suite cleanup function.
-** Frees any global objects.
-*/
-int clean_cg_suite(void)
-{
-	lwfree(p);
-	lwfree(p1);
-	lwfree(p2);
-	lwfree(q1);
-	lwfree(q2);
-	lwfree(pa21);
-	lwfree(pa22);
-	lwfree(pa51);
-	lwfree(pa52);
-	lwfree(l21);
-	lwfree(l22);
-	lwfree(l51);
-	lwfree(l52);
-	return 0;
-}
-
-/*
-** Test left/right side.
-*/
-void testSegmentSide(void)
-{
-	double rv = 0.0;
-	POINT2D *q = NULL;
-	q = lwalloc(sizeof(POINT2D));
-	
-	/* Vertical line at x=0 */
-	p1->x = 0.0;
-	p1->y = 0.0;
-	p2->x = 0.0;
-	p2->y = 1.0;
-	
-	/* On the left */
-	q->x = -2.0;
-	q->y = 1.5;
-	rv = segmentSide(p1, p2, q);
-	//printf("left %g\n",rv);
-	CU_ASSERT(rv < 0.0);
-	
-	/* On the right */
-	q->x = 2.0;
-	rv = segmentSide(p1, p2, q);
-	//printf("right %g\n",rv);
-	CU_ASSERT(rv > 0.0);
-	
-	/* On the line */
-	q->x = 0.0;
-	rv = segmentSide(p1, p2, q);
-	//printf("on line %g\n",rv);
-	CU_ASSERT_EQUAL(rv, 0.0);
-	
-	lwfree(q);
-	
-}
-
-/*
-** Test crossings side.
-*/
-void testSegmentIntersects(void)
-{
-	
-	/* P: Vertical line at x=0 */
-	p1->x = 0.0;
-	p1->y = 0.0;
-	p2->x = 0.0;
-	p2->y = 1.0;
-
-	/* Q: Horizontal line crossing left to right */
-	q1->x = -0.5;
-	q1->y = 0.5;
-	q2->x = 0.5;
-	q2->y = 0.5;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_CROSS_RIGHT );
-
-	/* Q: Horizontal line crossing right to left */
-	q1->x = 0.5;
-	q1->y = 0.5;
-	q2->x = -0.5;
-	q2->y = 0.5;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_CROSS_LEFT );
-
-	/* Q: Horizontal line not crossing right to left */
-	q1->x = 0.5;
-	q1->y = 1.5;
-	q2->x = -0.5;
-	q2->y = 1.5;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_NO_INTERSECTION );
-
-	/* Q: Horizontal line crossing at vertex right to left */
-	q1->x = 0.5;
-	q1->y = 1.0;
-	q2->x = -0.5;
-	q2->y = 1.0;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_CROSS_LEFT );
-
-	/* Q: Diagonal line with large range crossing at vertex right to left */
-	q1->x = 0.5;
-	q1->y = 10.0;
-	q2->x = -0.5;
-	q2->y = -10.0;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_CROSS_LEFT );
-
-	/* Q: Diagonal line with large range crossing at vertex right to left */
-	q1->x = 0.5;
-	q1->y = 11.0;
-	q2->x = -0.5;
-	q2->y = -9.0;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_CROSS_LEFT );
-
-	/* Q: Horizontal touching from left */
-	q1->x = -0.5;
-	q1->y = 0.5;
-	q2->x = 0.0;
-	q2->y = 0.5;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_TOUCH_LEFT );
-
-	/* Q: Horizontal touching from right */
-	q1->x = 0.5;
-	q1->y = 0.5;
-	q2->x = 0.0;
-	q2->y = 0.5;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_TOUCH_RIGHT );
-
-	/* Q: Horizontal touching from left and far below*/
-	q1->x = -0.5;
-	q1->y = -10.5;
-	q2->x = 0.0;
-	q2->y = 0.5;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_TOUCH_LEFT );
-
-	/* Q: Horizontal touching from right and far above */
-	q1->x = 0.5;
-	q1->y = 10.5;
-	q2->x = 0.0;
-	q2->y = 0.5;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_TOUCH_RIGHT );
-
-	/* Q: Co-linear from top */
-	q1->x = 0.0;
-	q1->y = 10.0;
-	q2->x = 0.0;
-	q2->y = 0.5;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_COLINEAR );
-
-	/* Q: Co-linear from bottom */
-	q1->x = 0.0;
-	q1->y = -10.0;
-	q2->x = 0.0;
-	q2->y = 0.5;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_COLINEAR );
-
-	/* Q: Co-linear contained */
-	q1->x = 0.0;
-	q1->y = 0.4;
-	q2->x = 0.0;
-	q2->y = 0.5;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_COLINEAR );
-
-	/* Q: Horizontal touching at end point from left */
-	q1->x = -0.5;
-	q1->y = 1.0;
-	q2->x = 0.0;
-	q2->y = 1.0;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_TOUCH_LEFT );
-
-	/* Q: Horizontal touching at end point from right */
-	q1->x = 0.5;
-	q1->y = 1.0;
-	q2->x = 0.0;
-	q2->y = 1.0;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_TOUCH_RIGHT );
-
-	/* Q: Horizontal touching at start point from left */
-	q1->x = -0.5;
-	q1->y = 0.0;
-	q2->x = 0.0;
-	q2->y = 0.0;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_TOUCH_LEFT );
-
-	/* Q: Horizontal touching at start point from right */
-	q1->x = 0.5;
-	q1->y = 0.0;
-	q2->x = 0.0;
-	q2->y = 0.0;
-	CU_ASSERT( segmentIntersects(p1, p2, q1, q2) == SEG_TOUCH_RIGHT );
-
-}
-
-void testLineCrossingShortLines(void) 
-{
-
-	int rv = 0;
-	
-	/*
-	** Simple test, two two-point lines 
-	*/
-
-	/* Vertical line from 0,0 to 1,1 */
-	p->x = 0.0;
-	p->y = 0.0;
-	setPoint4d(pa21, 0, p);
-	p->y = 1.0;
-	setPoint4d(pa21, 1, p);
-	
-	/* Horizontal, crossing mid-segment */
-	p->x = -0.5;
-	p->y = 0.5;
-	setPoint4d(pa22, 0, p);
-	p->x = 0.5;
-	setPoint4d(pa22, 1, p);
-
-	CU_ASSERT( lineCrossingDirection(l21, l22) == LINE_CROSS_RIGHT );
-
-	/* Horizontal, crossing at top end vertex */
-	p->x = -0.5;
-	p->y = 1.0;
-	setPoint4d(pa22, 0, p);
-	p->x = 0.5;
-	setPoint4d(pa22, 1, p);
-
-	CU_ASSERT( lineCrossingDirection(l21, l22) == LINE_CROSS_RIGHT );
-
-	/* Horizontal, crossing at bottom end vertex */
-	p->x = -0.5;
-	p->y = 0.0;
-	setPoint4d(pa22, 0, p);
-	p->x = 0.5;
-	setPoint4d(pa22, 1, p);
-
-	CU_ASSERT( lineCrossingDirection(l21, l22) == LINE_CROSS_RIGHT );
-
-	/* Horizontal, no crossing */
-	p->x = -0.5;
-	p->y = 2.0;
-	setPoint4d(pa22, 0, p);
-	p->x = 0.5;
-	setPoint4d(pa22, 1, p);
-
-	CU_ASSERT( lineCrossingDirection(l21, l22) == LINE_NO_CROSS );
-
-	/* Vertical, no crossing */
-	p->x = -0.5;
-	p->y = 0.0;
-	setPoint4d(pa22, 0, p);
-	p->y = 1.0;
-	setPoint4d(pa22, 1, p);
-
-	CU_ASSERT( lineCrossingDirection(l21, l22) == LINE_NO_CROSS );
-
-}
-	
-void testLineCrossingLongLines(void) 
-{
-
-	/* 
-	** More complex test, longer lines and multiple crossings 
-	*/
-
-	/* Vertical line with vertices at y integers */
-	p->x = 0.0;
-	p->y = 0.0;
-	setPoint4d(pa51, 0, p);
-	p->y = 1.0;
-	setPoint4d(pa51, 1, p);
-	p->y = 2.0;
-	setPoint4d(pa51, 2, p);
-	p->y = 3.0;
-	setPoint4d(pa51, 3, p);
-	p->y = 4.0;
-	setPoint4d(pa51, 4, p);
-
-	/* Two crossings at segment midpoints */
-	p->x = 1.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 0, p);
-	p->x = -1.0;
-	p->y = 1.5;
-	setPoint4d(pa52, 1, p);
-	p->x = 1.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 2, p);
-	p->x = 1.0;
-	p->y = 4.0;
-	setPoint4d(pa52, 3, p);
-	p->x = 1.0;
-	p->y = 5.0;
-	setPoint4d(pa52, 4, p);
-	CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_MULTICROSS_END_SAME_FIRST_LEFT );
-
-	/* One crossing at interior vertex */
-	p->x = 1.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 0, p);
-	p->x = 0.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 1, p);
-	p->x = -1.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 2, p);
-	p->x = -1.0;
-	p->y = 2.0;
-	setPoint4d(pa52, 3, p);
-	p->x = -1.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 4, p);
-	CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_CROSS_LEFT );
-
-	/* Two crossings at interior vertices */
-	p->x = 1.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 0, p);
-	p->x = 0.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 1, p);
-	p->x = -1.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 2, p);
-	p->x = 0.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 3, p);
-	p->x = 1.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 4, p);
-	CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_MULTICROSS_END_SAME_FIRST_LEFT );
-
-	/* Two crossings, one at the first vertex on at interior vertex */
-	p->x = 1.0;
-	p->y = 0.0;
-	setPoint4d(pa52, 0, p);
-	p->x = 0.0;
-	p->y = 0.0;
-	setPoint4d(pa52, 1, p);
-	p->x = -1.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 2, p);
-	p->x = 0.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 3, p);
-	p->x = 1.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 4, p);
-	CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_MULTICROSS_END_SAME_FIRST_LEFT );
-
-	/* Two crossings, one at the first vertex on the next interior vertex */
-	p->x = 1.0;
-	p->y = 0.0;
-	setPoint4d(pa52, 0, p);
-	p->x = 0.0;
-	p->y = 0.0;
-	setPoint4d(pa52, 1, p);
-	p->x = -1.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 2, p);
-	p->x = 0.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 3, p);
-	p->x = 1.0;
-	p->y = 2.0;
-	setPoint4d(pa52, 4, p);
-	CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_MULTICROSS_END_SAME_FIRST_LEFT );
-
-	/* Two crossings, one at the last vertex on the next interior vertex */
-	p->x = 1.0;
-	p->y = 4.0;
-	setPoint4d(pa52, 0, p);
-	p->x = 0.0;
-	p->y = 4.0;
-	setPoint4d(pa52, 1, p);
-	p->x = -1.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 2, p);
-	p->x = 0.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 3, p);
-	p->x = 1.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 4, p);
-	CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_MULTICROSS_END_SAME_FIRST_LEFT );
-
-	/* Three crossings, two at midpoints, one at vertex */
-	p->x = 0.5;
-	p->y = 1.0;
-	setPoint4d(pa52, 0, p);
-	p->x = -1.0;
-	p->y = 0.5;
-	setPoint4d(pa52, 1, p);
-	p->x = 1.0;
-	p->y = 2.0;
-	setPoint4d(pa52, 2, p);
-	p->x = -1.0;
-	p->y = 2.0;
-	setPoint4d(pa52, 3, p);
-	p->x = -1.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 4, p);
-	CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_MULTICROSS_END_LEFT );
-
-	/* One mid-point co-linear crossing */
-	p->x = 1.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 0, p);
-	p->x = 0.0;
-	p->y = 1.5;
-	setPoint4d(pa52, 1, p);
-	p->x = 0.0;
-	p->y = 2.5;
-	setPoint4d(pa52, 2, p);
-	p->x = -1.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 3, p);
-	p->x = -1.0;
-	p->y = 4.0;
-	setPoint4d(pa52, 4, p);
-	CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_CROSS_LEFT );
-
-	/* One on-vertices co-linear crossing */
-	p->x = 1.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 0, p);
-	p->x = 0.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 1, p);
-	p->x = 0.0;
-	p->y = 2.0;
-	setPoint4d(pa52, 2, p);
-	p->x = -1.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 3, p);
-	p->x = -1.0;
-	p->y = 4.0;
-	setPoint4d(pa52, 4, p);
-	CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_CROSS_LEFT );
-
-	/* No crossing, but end on a co-linearity. */
-	p->x = 1.0;
-	p->y = 1.0;
-	setPoint4d(pa52, 0, p);
-	p->x = 1.0;
-	p->y = 2.0;
-	setPoint4d(pa52, 1, p);
-	p->x = 1.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 2, p);
-	p->x = 0.0;
-	p->y = 3.0;
-	setPoint4d(pa52, 3, p);
-	p->x = 0.0;
-	p->y = 4.0;
-	setPoint4d(pa52, 4, p);
-	CU_ASSERT( lineCrossingDirection(l51, l52) == LINE_NO_CROSS );
-
-
-}
-

Copied: trunk/liblwgeom/cunit/cu_algorithm.c (from rev 3434, trunk/cunit/cu_algorithm.c)

Deleted: trunk/liblwgeom/cunit/cu_algorithm.h
===================================================================
--- trunk/cunit/cu_algorithm.h	2008-12-17 00:22:26 UTC (rev 3427)
+++ trunk/liblwgeom/cunit/cu_algorithm.h	2008-12-17 18:20:18 UTC (rev 3435)
@@ -1,23 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "lwalgorithm.h"
-
-/***********************************************************************
-** for Computational Geometry Suite
-*/
-
-/* Set-up / clean-up functions */
-CU_pSuite register_cg_suite(void);
-int init_cg_suite(void);
-int clean_cg_suite(void);
-
-/* Test functions */
-void testSegmentSide(void);
-void testSegmentIntersects(void);
-void testLineCrossingShortLines(void);
-void testLineCrossingLongLines(void);
-
-

Copied: trunk/liblwgeom/cunit/cu_algorithm.h (from rev 3434, trunk/cunit/cu_algorithm.h)

Deleted: trunk/liblwgeom/cunit/cu_tester.c
===================================================================
--- trunk/cunit/cu_tester.c	2008-12-17 00:22:26 UTC (rev 3427)
+++ trunk/liblwgeom/cunit/cu_tester.c	2008-12-17 18:20:18 UTC (rev 3435)
@@ -1,56 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include "CUnit/Basic.h"
-
-#include "cu_algorithm.h"
-
-
-/*
-** Set up liblwgeom to run in stand-alone mode using the 
-** usual system memory handling functions.
-*/
-void cunit_lwerr(const char *fmt, va_list ap) {
-	printf("Got an LWERR.\n");
-}
-
-void cunit_lwnotice(const char *fmt, va_list ap) {
-	printf("Got an LWNOTICE.\n");
-}
-
-void lwgeom_init_allocators(void) {
-        /* liblwgeom callback - install PostgreSQL handlers */
-        lwalloc_var = malloc;
-        lwrealloc_var = realloc;
-        lwfree_var = free;
-        lwerror_var = default_errorreporter;
-        lwnotice_var = default_noticereporter;
-}
-
-/*
-** The main() function for setting up and running the tests.
-** Returns a CUE_SUCCESS on successful running, another
-** CUnit error code on failure.
-*/
-int main()
-{
-
-	/* initialize the CUnit test registry */
-	if (CUE_SUCCESS != CU_initialize_registry())
-		return CU_get_error();
-
-	/* Add the PostGIS suite to the registry */
-	if (NULL == register_cg_suite())
-	{
-		CU_cleanup_registry();
-		return CU_get_error();
-	}
-
-	/* Run all tests using the CUnit Basic interface */
-	CU_basic_set_mode(CU_BRM_VERBOSE);
-	CU_basic_run_tests();
-	CU_cleanup_registry();
-
-	return CU_get_error();
-
-}

Copied: trunk/liblwgeom/cunit/cu_tester.c (from rev 3434, trunk/cunit/cu_tester.c)



More information about the postgis-commits mailing list