]> granicus.if.org Git - postgis/commitdiff
#2396: liblwgeom CUnit tests fail on big-endian architectures.
authorRegina Obe <lr@pcorp.us>
Thu, 8 Aug 2013 21:19:41 +0000 (21:19 +0000)
committerRegina Obe <lr@pcorp.us>
Thu, 8 Aug 2013 21:19:41 +0000 (21:19 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11749 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/cunit/cu_libgeom.c

index 44d7cbffda67cf231a5d2dd1cce4044b9c692f58..ae0e319f528311ee342ddd70a5f81dffaf976cb8 100644 (file)
@@ -694,6 +694,7 @@ static void test_lwgeom_clone(void)
 static void test_lwgeom_force_clockwise(void)
 {
        LWGEOM *geom;
+       LWGEOM *geom2;
        char *in_ewkt, *out_ewkt;
 
        /* counterclockwise, must be reversed */
@@ -744,13 +745,14 @@ static void test_lwgeom_force_clockwise(void)
        /* NOTE: this is a narrow ring, see ticket #1302 */
        in_ewkt  = "0103000000010000000500000000917E9BA468294100917E9B8AEA2841C976BE1FA4682941C976BE9F8AEA2841B39ABE1FA46829415ACCC29F8AEA284137894120A4682941C976BE9F8AEA284100917E9BA468294100917E9B8AEA2841";
        geom = lwgeom_from_hexwkb(in_ewkt, LW_PARSER_CHECK_NONE);
-       lwgeom_force_clockwise(geom);
-       out_ewkt = lwgeom_to_hexwkb(geom, WKB_ISO, NULL);
-       if (strcmp(in_ewkt, out_ewkt))
-               fprintf(stderr, "\nExp:   %s\nObt:   %s\n", in_ewkt, out_ewkt);
-       CU_ASSERT_STRING_EQUAL(in_ewkt, out_ewkt);
-       lwfree(out_ewkt);
+       geom2 = lwgeom_from_hexwkb(in_ewkt, LW_PARSER_CHECK_NONE);
+       lwgeom_force_clockwise(geom2);
+       
+       /** use same check instead of strcmp to account 
+         for difference in endianness **/
+       CU_ASSERT( lwgeom_same(geom, geom2) );
        lwgeom_free(geom);
+       lwgeom_free(geom2);
 }
 
 /*