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

Definition at line 853 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().

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

Here is the call graph for this function:

Here is the caller graph for this function: