1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
//
// Test Suite for C-API GEOSConcaveHull
#include <tut/tut.hpp>
// geos
#include <geos_c.h>
// std
#include "capi_test_utils.h"
namespace tut {
//
// Test Group
//
// Common data used in test cases.
struct test_capigeosconcavehull_data : public capitest::utility {
};
typedef test_group<test_capigeosconcavehull_data> group;
typedef group::object object;
group test_capigeosconcavehull_group("capi::GEOSConcaveHull");
//
// Test Cases
//
template<>
template<>
void object::test<1>()
{
input_ = fromWKT("MULTIPOINT ((10 90), (10 10), (90 10), (90 90), (40 40), (60 30), (30 70), (40 60), (60 50), (60 72), (47 66), (90 60))");
expected_ = fromWKT("POLYGON ((30 70, 10 90, 60 72, 90 90, 90 60, 90 10, 60 30, 10 10, 40 40, 60 50, 47 66, 40 60, 30 70))");
result_ = GEOSConcaveHull(input_, 0, 0);
ensure(nullptr != result_);
ensure(0 == GEOSisEmpty(result_));
ensure_geometry_equals(result_, expected_);
}
template<>
template<>
void object::test<2>()
{
input_ = fromWKT("MULTIPOINT ((10 90), (10 10), (90 10), (90 90), (40 40), (60 30), (30 70), (40 60), (60 50), (60 72), (47 66), (90 60))");
expected_ = fromWKT("POLYGON ((30 70, 10 90, 60 72, 90 90, 90 60, 90 10, 60 30, 10 10, 40 40, 30 70))");
result_ = GEOSConcaveHullByLength(input_, 50, 0);
ensure(nullptr != result_);
ensure(0 == GEOSisEmpty(result_));
ensure_geometry_equals(result_, expected_);
}
template<>
template<>
void object::test<3>()
{
input_ = fromWKT("CIRCULARSTRING (0 0, 1 1, 2 0)");
ensure(input_ != nullptr);
result_ = GEOSConcaveHull(input_, 0, 0);
ensure(result_ == nullptr);
}
} // namespace tut
|