Complete Note#1 in the http://wiki.osgeo.org/wiki/GEOS_Provenance_Review to get out...
[geos.git] / tests / unit / algorithm / InteriorPointAreaTest.cpp
blob7643ebde271b042a004ad19128ccfe5988f54fdf
1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
13 **********************************************************************/
15 //
16 // Test Suite for geos::algorithm::InteriorPointArea
18 #include <tut.hpp>
19 // geos
20 #include <geos/geom/Coordinate.h>
21 #include <geos/algorithm/InteriorPointArea.h>
22 #include <geos/io/WKTReader.h>
23 #include <geos/geom/Geometry.h>
24 // std
25 #include <sstream>
26 #include <string>
27 #include <memory>
29 namespace tut
32 // Test Group
35 // dummy data, not used
36 struct test_interiorpointarea_data {
37 typedef geos::geom::Geometry Geometry;
38 typedef geos::geom::Coordinate Coordinate;
39 typedef geos::algorithm::InteriorPointArea InteriorPointArea;
41 geos::io::WKTReader reader;
42 std::auto_ptr<Geometry> geom;
44 test_interiorpointarea_data()
49 typedef test_group<test_interiorpointarea_data> group;
50 typedef group::object object;
52 group test_interiorpointarea_group("geos::algorithm::InteriorPointArea");
55 // Test Cases
58 // http://trac.osgeo.org/geos/ticket/475
59 // This is a test for a memory leak more than anything else
60 template<>
61 template<>
62 void object::test<1>()
64 Coordinate centroid;
66 // this polygon is a typical hourglass-shape with a self intersection
67 // without a node
68 geom.reset( reader.read("POLYGON((6 54, 15 54, 6 47, 15 47, 6 54))") );
70 bool threw = false;
72 try {
73 InteriorPointArea interior_builder(geom.get());
74 interior_builder.getInteriorPoint(centroid);
76 catch(...) {
77 threw = true;
80 ensure(threw);
83 } // namespace tut