[geos-commits] [SCM] GEOS branch master updated. 667f220f02cdecfafda46a0ba315fe542590d527

git at osgeo.org git at osgeo.org
Wed Dec 4 17:46:26 PST 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, master has been updated
       via  667f220f02cdecfafda46a0ba315fe542590d527 (commit)
      from  a921e178f7556fcdca466186b152c4e46a43da96 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 667f220f02cdecfafda46a0ba315fe542590d527
Author: Daniel Baston <dbaston at gmail.com>
Date:   Wed Dec 4 20:46:08 2019 -0500

    Add TopologyLocation tests

diff --git a/tests/unit/geomgraph/TopologyLocationTest.cpp b/tests/unit/geomgraph/TopologyLocationTest.cpp
new file mode 100644
index 0000000..6fa0e32
--- /dev/null
+++ b/tests/unit/geomgraph/TopologyLocationTest.cpp
@@ -0,0 +1,102 @@
+//
+// Test Suite for geos::geomgraph::TopologyLocation class.
+
+// tut
+#include <tut/tut.hpp>
+// geos
+#include <geos/geomgraph/TopologyLocation.h>
+#include <geos/geom/Location.h>
+// std
+#include <memory>
+#include <string>
+#include <vector>
+
+using TopologyLocation = geos::geomgraph::TopologyLocation;
+using Location = geos::geom::Location;
+
+namespace tut {
+//
+// Test Group
+//
+
+// Common data used by tests
+struct test_topologylocation_data {
+
+    test_topologylocation_data() {}
+};
+
+typedef test_group<test_topologylocation_data> group;
+typedef group::object object;
+
+group test_topologylocation_group("geos::geomgraph::TopologyLocation");
+
+//
+// Test Cases
+//
+
+// test constructors
+template<>
+template<>
+void object::test<1>
+()
+{
+    TopologyLocation a(Location::INTERIOR);
+    ensure(a.isLine());
+    ensure_equals(a.get(0), Location::INTERIOR);
+
+    TopologyLocation b(Location::EXTERIOR, Location::INTERIOR, Location::BOUNDARY);
+    ensure(b.isArea());
+    ensure_equals(b.get(0), Location::EXTERIOR);
+    ensure_equals(b.get(1), Location::INTERIOR);
+    ensure_equals(b.get(2), Location::BOUNDARY);
+}
+
+// test basic setters
+template<>
+template<>
+void object::test<2>
+()
+{
+    TopologyLocation b(Location::EXTERIOR, Location::INTERIOR, Location::BOUNDARY);
+
+    ensure_equals(b.get(0), Location::EXTERIOR);
+    ensure_equals(b.get(1), Location::INTERIOR);
+    ensure_equals(b.get(2), Location::BOUNDARY);
+
+    b.setLocation(0, Location::INTERIOR);
+    b.setLocation(1, Location::BOUNDARY);
+    b.setLocation(2, Location::EXTERIOR);
+
+    ensure_equals(b.get(0), Location::INTERIOR);
+    ensure_equals(b.get(1), Location::BOUNDARY);
+    ensure_equals(b.get(2), Location::EXTERIOR);
+}
+
+// test setAllLocations()
+template<>
+template<>
+void object::test<3>
+()
+{
+    TopologyLocation b(Location::EXTERIOR, Location::INTERIOR, Location::BOUNDARY);
+
+    b.setAllLocations(Location::UNDEF);
+
+    ensure_equals(b.get(0), Location::UNDEF);
+    ensure_equals(b.get(1), Location::UNDEF);
+    ensure_equals(b.get(2), Location::UNDEF);
+
+    b.setLocation(0, Location::BOUNDARY);
+
+    ensure_equals(b.get(0), Location::BOUNDARY);
+    ensure_equals(b.get(1), Location::UNDEF);
+    ensure_equals(b.get(2), Location::UNDEF);
+
+    b.setAllLocationsIfNull(Location::EXTERIOR);
+
+    ensure_equals(b.get(0), Location::BOUNDARY);
+    ensure_equals(b.get(1), Location::EXTERIOR);
+    ensure_equals(b.get(2), Location::EXTERIOR);
+}
+
+} // namespace tut

-----------------------------------------------------------------------

Summary of changes:
 tests/unit/geomgraph/TopologyLocationTest.cpp | 102 ++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 tests/unit/geomgraph/TopologyLocationTest.cpp


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list