]> granicus.if.org Git - postgis/commitdiff
A few more WKB unit tests.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 5 Mar 2010 02:35:16 +0000 (02:35 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 5 Mar 2010 02:35:16 +0000 (02:35 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5375 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/cunit/cu_wkb.c

index a29c913471f38e7afb21ccc89f3402d60ba4381b..6ab54136e98ceb8255d4cf3d85f62c3ed30cea1d 100644 (file)
@@ -63,33 +63,54 @@ static void test_wkb_point(void)
        cu_wkb("POINT(0 0 0 0)");
        CU_ASSERT_STRING_EQUAL(s, t);
 
+       cu_wkb("SRID=4;POINTM(1 1 1)");
+       CU_ASSERT_STRING_EQUAL(s, t);
+
+       //printf("new: %s\nold: %s\n",s,t);
+}
+
+static void test_wkb_linestring(void)
+{
        cu_wkb("LINESTRING(0 0,1 1)");
        CU_ASSERT_STRING_EQUAL(s, t);
 
-       cu_wkb("SRID=4;POLYGON((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0))");
+       cu_wkb("LINESTRING(0 0 1,1 1 2,2 2 3)");
        CU_ASSERT_STRING_EQUAL(s, t);
+}
 
-       cu_wkb("SRID=14;GEOMETRYCOLLECTION(POLYGON((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),POINT(1 1 1))");
+static void test_wkb_polygon(void)
+{
+       cu_wkb("SRID=4;POLYGON((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0))");
        CU_ASSERT_STRING_EQUAL(s, t);
 
-       cu_wkb("SRID=14;MULTIPOLYGON(((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),((-1 -1 0,-1 2 0,2 2 0,2 -1 0,-1 -1 0),(0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)))");
+       cu_wkb("SRID=14;POLYGON((0 0 0 1,0 1 0 2,1 1 0 3,1 0 0 4,0 0 0 5))");
        CU_ASSERT_STRING_EQUAL(s, t);
 
-//     printf("new: %s\nold: %s\n",s,t);
+       cu_wkb("SRID=4;POLYGON((0 0 0 1,0 1 0 2,1 1 0 3,1 0 0 4,0 0 0 5))");
+       CU_ASSERT_STRING_EQUAL(s, t);
 
+       cu_wkb("POLYGON EMPTY");
+       CU_ASSERT_STRING_EQUAL(s, t);
 }
 
-static void test_wkb_linestring(void){}
-
-static void test_wkb_polygon(void){}
-
 static void test_wkb_multipoint(void){}
 
 static void test_wkb_multilinestring(void){}
 
-static void test_wkb_multipolygon(void){}
+static void test_wkb_multipolygon(void)
+{
+       cu_wkb("SRID=14;MULTIPOLYGON(((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),((-1 -1 0,-1 2 0,2 2 0,2 -1 0,-1 -1 0),(0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)))");
+       CU_ASSERT_STRING_EQUAL(s, t);
+}
+
+static void test_wkb_collection(void)
+{
+       cu_wkb("SRID=14;GEOMETRYCOLLECTION(POLYGON((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),POINT(1 1 1))");
+       CU_ASSERT_STRING_EQUAL(s, t);
 
-static void test_wkb_collection(void){}
+       cu_wkb("GEOMETRYCOLLECTION EMPTY");
+       CU_ASSERT_STRING_EQUAL(s, t);
+}
 
 static void test_wkb_circularstring(void){}