bool isEqual(const Geom& a, const Geom& b) { using std::cout; using std::endl; GeomPtr a2 = normalize(a); GeomPtr b2 = normalize(b); bool eq = a2->equalsExact(b2.get()); if ( ! eq ) { cout << "OBTAINED: " << wktwriter.write(b2.get()) << endl; } return eq; }
bool isEqual(const Geom& a, const Geom& b, double tolerance=0) { using std::cout; using std::endl; bool eq; // TODO: use HausdorffDistance ? GeomPtr a2 = normalize(a); GeomPtr b2 = normalize(b); eq = a2->equalsExact(b2.get(), tolerance); if ( ! eq ) { cout << "OBTAINED: " << wktwriter.write(b2.get()) << endl; } return eq; }
bool compare( T& ex, S& ob) { using std::cout; using std::endl; if ( ex.size() != ob.size() ) { cout << "Expected " << ex.size() << " polygons, obtained " << ob.size() << endl; return false; } for (typename T::iterator i=ex.begin(), e=ex.end(); i!=e; ++i) { if ( ! contains(ob, *i) ) { cout << "Expected " << wktwriter.write(*i) << " not found" << endl; return false; } } return true; }
void checkExpected(Geometry* result, const Geometry* expected) { bool isEqual = result->equalsExact(expected, 1.0e-5); ensure_equals("Expect: "+writer.write(expected)+" Obtained: "+writer.write(result), isEqual, true); }