PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_lwgeom_same ( void  )
static

Definition at line 845 of file cu_libgeom.c.

References LW_PARSER_CHECK_NONE, lwgeom_add_bbox(), lwgeom_free(), lwgeom_from_wkt(), and lwgeom_same().

Referenced by libgeom_suite_setup().

846 {
847  LWGEOM *geom, *geom2;
848 
849  geom = lwgeom_from_wkt("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))", LW_PARSER_CHECK_NONE);
850  CU_ASSERT( lwgeom_same(geom, geom) );
851  lwgeom_add_bbox(geom);
852  CU_ASSERT( lwgeom_same(geom, geom) );
853  lwgeom_free(geom);
854 
855  geom = lwgeom_from_wkt("MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0)))", LW_PARSER_CHECK_NONE);
856  CU_ASSERT( lwgeom_same(geom, geom) );
857  lwgeom_add_bbox(geom);
858  CU_ASSERT( lwgeom_same(geom, geom) );
859  lwgeom_free(geom);
860 
861  geom = lwgeom_from_wkt("LINESTRING(0 0, 2 0)", LW_PARSER_CHECK_NONE);
862  CU_ASSERT( lwgeom_same(geom, geom) );
863  lwgeom_add_bbox(geom);
864  CU_ASSERT( lwgeom_same(geom, geom) );
865  lwgeom_free(geom);
866 
867  geom = lwgeom_from_wkt("MULTILINESTRING((0 0, 2 0))", LW_PARSER_CHECK_NONE);
868  CU_ASSERT( lwgeom_same(geom, geom) );
869  lwgeom_add_bbox(geom);
870  CU_ASSERT( lwgeom_same(geom, geom) );
871  lwgeom_free(geom);
872 
873  geom = lwgeom_from_wkt("POINT(0 0)", LW_PARSER_CHECK_NONE);
874  CU_ASSERT( lwgeom_same(geom, geom) );
875  lwgeom_add_bbox(geom);
876  CU_ASSERT( lwgeom_same(geom, geom) );
877  lwgeom_free(geom);
878 
879  geom = lwgeom_from_wkt("MULTIPOINT((0 0),(4 5))", LW_PARSER_CHECK_NONE);
880  CU_ASSERT( lwgeom_same(geom, geom) );
881  lwgeom_add_bbox(geom);
882  CU_ASSERT( lwgeom_same(geom, geom) );
883  lwgeom_free(geom);
884 
885  geom = lwgeom_from_wkt("POINT EMPTY", LW_PARSER_CHECK_NONE);
886  CU_ASSERT( lwgeom_same(geom, geom) );
887  lwgeom_add_bbox(geom);
888  CU_ASSERT( lwgeom_same(geom, geom) );
889  lwgeom_free(geom);
890 
891  geom = lwgeom_from_wkt("LINESTRING EMPTY", LW_PARSER_CHECK_NONE);
892  CU_ASSERT( lwgeom_same(geom, geom) );
893  lwgeom_add_bbox(geom);
894  CU_ASSERT( lwgeom_same(geom, geom) );
895  lwgeom_free(geom);
896 
897  geom = lwgeom_from_wkt("POLYGON EMPTY", LW_PARSER_CHECK_NONE);
898  CU_ASSERT( lwgeom_same(geom, geom) );
899  lwgeom_free(geom);
900 
901  geom = lwgeom_from_wkt("MULTIPOINT EMPTY", LW_PARSER_CHECK_NONE);
902  CU_ASSERT( lwgeom_same(geom, geom) );
903  lwgeom_free(geom);
904 
905  geom = lwgeom_from_wkt("MULTILINESTRING EMPTY", LW_PARSER_CHECK_NONE);
906  CU_ASSERT( lwgeom_same(geom, geom) );
907  lwgeom_free(geom);
908 
909  geom = lwgeom_from_wkt("MULTIPOLYGON EMPTY", LW_PARSER_CHECK_NONE);
910  CU_ASSERT( lwgeom_same(geom, geom) );
911  lwgeom_free(geom);
912 
913  geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY, POINT EMPTY, LINESTRING EMPTY, POLYGON EMPTY, MULTIPOINT EMPTY, MULTILINESTRING EMPTY, MULTIPOLYGON EMPTY, GEOMETRYCOLLECTION(MULTIPOLYGON EMPTY))", LW_PARSER_CHECK_NONE);
914  CU_ASSERT( lwgeom_same(geom, geom) );
915  lwgeom_free(geom);
916 
917  geom = lwgeom_from_wkt("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))", LW_PARSER_CHECK_NONE);
918  geom2 = lwgeom_from_wkt("GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY, POINT EMPTY, LINESTRING EMPTY, POLYGON EMPTY, MULTIPOINT EMPTY, MULTILINESTRING EMPTY, MULTIPOLYGON EMPTY, GEOMETRYCOLLECTION(MULTIPOLYGON EMPTY))", LW_PARSER_CHECK_NONE);
919  CU_ASSERT( ! lwgeom_same(geom, geom2) );
920  lwgeom_free(geom);
921  lwgeom_free(geom2);
922 
923  geom = lwgeom_from_wkt("POINT(0 0)", LW_PARSER_CHECK_NONE);
924  geom2 = lwgeom_from_wkt("MULTIPOINT((0 0))", LW_PARSER_CHECK_NONE);
925  CU_ASSERT( ! lwgeom_same(geom, geom2) );
926  lwgeom_free(geom);
927  lwgeom_free(geom2);
928 
929  geom = lwgeom_from_wkt("POINT EMPTY", LW_PARSER_CHECK_NONE);
930  geom2 = lwgeom_from_wkt("POINT Z EMPTY", LW_PARSER_CHECK_NONE);
931  CU_ASSERT( ! lwgeom_same(geom, geom2) );
932  lwgeom_free(geom);
933  lwgeom_free(geom2);
934 
935 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:844
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1706
char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
geom1 same as geom2 iff
Definition: lwgeom.c:451
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
Definition: lwgeom.c:555

Here is the call graph for this function:

Here is the caller graph for this function: