Skip to content

Commit

Permalink
GEOSRelatePattern: Add some tests with invalid patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaston committed May 21, 2024
1 parent 86ca4cb commit 72a731a
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/unit/capi/GEOSRelatePatternTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void object::test<1>()

template<>
template<>
void object::test<11>()
void object::test<2>()
{
geom1_ = fromWKT("CIRCULARSTRING (0 0, 1 1, 2 0)");
geom2_ = fromWKT("LINESTRING (1 0, 2 1)");
Expand All @@ -45,5 +45,26 @@ void object::test<11>()
ensure_equals("curved geometry not supported", GEOSRelatePattern(geom2_, geom1_, "0********"), 2);
}

// invalid DE-9IM
template<>
template<>
void object::test<3>()
{
geom1_ = fromWKT("POINT(1 2)");
geom2_ = fromWKT("POINT(1 2)");

ensure(geom1_);
ensure(geom2_);

// pattern too long
ensure_equals(2, GEOSRelatePattern(geom1_, geom2_, "0FFFFF2120000000000000000000"));

// pattern too short
ensure_equals(2, GEOSRelatePattern(geom1_, geom2_, "0F"));

// pattern has invalid characters
ensure_equals(0, GEOSRelatePattern(geom1_, geom2_, "123456789"));
}

} // namespace tut

0 comments on commit 72a731a

Please # to comment.