clipping bench: validate per geom

This commit is contained in:
Dane Springmeyer 2015-02-15 12:59:55 -08:00
parent 1ebd6afd9c
commit e1941f87f0

View file

@ -115,9 +115,10 @@ public:
{
throw std::runtime_error("Failed to parse WKT");
}
unsigned count = 0;
bool valid = true;
for (unsigned i=0;i<iterations_;++i)
{
unsigned count = 0;
for (mapnik::geometry_type const& geom : paths)
{
mapnik::vertex_adapter va(geom);
@ -133,12 +134,11 @@ public:
count++;
}
}
}
// TODO - sometimes this is 310001: what is causing that?
unsigned expected_count = 310002;
bool valid = (count == expected_count);
if (!valid) {
std::clog << "test1: clipping failed: processed " << count << " verticies but expected " << expected_count << "\n";
unsigned expected_count = 31;
if (count != expected_count) {
std::clog << "test1: clipping failed: processed " << count << " verticies but expected " << expected_count << "\n";
valid = false;
}
}
return valid;
}
@ -215,9 +215,10 @@ public:
ps.line_to(extent_.maxx(), extent_.maxy());
ps.line_to(extent_.maxx(), extent_.miny());
ps.close_polygon();
unsigned count = 0;
bool valid = true;
for (unsigned i=0;i<iterations_;++i)
{
unsigned count = 0;
for (mapnik::geometry_type const& geom : paths)
{
mapnik::vertex_adapter va(geom);
@ -233,11 +234,11 @@ public:
count++;
}
}
}
unsigned expected_count = 290000;
bool valid = (count == expected_count);
if (!valid) {
std::clog << "test2: clipping failed: processed " << count << " verticies but expected " << expected_count << "\n";
unsigned expected_count = 29;
if (count != expected_count) {
std::clog << "test1: clipping failed: processed " << count << " verticies but expected " << expected_count << "\n";
valid = false;
}
}
return valid;
}
@ -297,9 +298,10 @@ public:
{
throw std::runtime_error("Failed to parse WKT");
}
unsigned count = 0;
bool valid = true;
for (unsigned i=0;i<iterations_;++i)
{
unsigned count = 0;
for ( mapnik::geometry_type const& geom : paths)
{
mapnik::vertex_adapter va(geom);
@ -310,11 +312,11 @@ public:
count++;
}
}
}
unsigned expected_count = 310000;
bool valid = (count == expected_count);
if (!valid) {
std::clog << "test3: clipping failed: processed " << count << " verticies but expected " << expected_count << "\n";
unsigned expected_count = 31;
if (count != expected_count) {
std::clog << "test1: clipping failed: processed " << count << " verticies but expected " << expected_count << "\n";
valid = false;
}
}
return valid;
}