From c0238266efec1c30b8873026810736551338e811 Mon Sep 17 00:00:00 2001
From: Andreas Schenk <andreas_schenk@hms.harvard.edu>
Date: Tue, 10 Jul 2012 13:24:27 -0400
Subject: [PATCH] added/extended tests for geom exceptions

---
 modules/geom/tests/test_composite2.cc | 11 +++++++++++
 modules/geom/tests/test_composite3.cc |  8 ++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/modules/geom/tests/test_composite2.cc b/modules/geom/tests/test_composite2.cc
index 5e437a730..acec86fb9 100644
--- a/modules/geom/tests/test_composite2.cc
+++ b/modules/geom/tests/test_composite2.cc
@@ -37,6 +37,17 @@ BOOST_AUTO_TEST_CASE(line_init2)
   BOOST_CHECK_EQUAL(geom::Length(line.GetDirection()), 1.0);
 }
 
+BOOST_AUTO_TEST_CASE(rectangle2)
+{
+  Rectangle2 rect;
+  try{
+    BOOST_CHECK_THROW(rect[2]=geom::Vec2(0,0), OutOfRangeException);
+  }catch(...)
+  {
+    BOOST_ERROR("Failed to catch OutOfRangeException");
+  }
+}
+
 BOOST_AUTO_TEST_CASE(is_on_line2)
 {
   Line2 line(geom::Vec2(0,0), geom::Vec2(1,0));
diff --git a/modules/geom/tests/test_composite3.cc b/modules/geom/tests/test_composite3.cc
index 83cbb5d19..317068280 100644
--- a/modules/geom/tests/test_composite3.cc
+++ b/modules/geom/tests/test_composite3.cc
@@ -151,8 +151,12 @@ BOOST_AUTO_TEST_CASE(func_composite3)
   BOOST_CHECK(Equal(IntersectionPoint(l2,l3), v3));
   
   BOOST_CHECK(!AreIntersecting(l3, l4));
-  
-  BOOST_CHECK_THROW(IntersectionPoint(l3,l4), GeomException);
+  try{
+    BOOST_CHECK_THROW(IntersectionPoint(l3,l4), GeomException);
+  }catch(...)
+  {
+    BOOST_ERROR("Failed to catch GeomException");
+  }
   BOOST_CHECK(Equal(IntersectionPoint(p1,l3), v1));
   BOOST_CHECK(Equal(IntersectionPoint(l3,p1), v1));
   
-- 
GitLab