small unit test fix; was broken only in non-assertion, non-CLN builds
authorMorgan Deters <mdeters@gmail.com>
Mon, 25 Apr 2011 07:59:57 +0000 (07:59 +0000)
committerMorgan Deters <mdeters@gmail.com>
Mon, 25 Apr 2011 07:59:57 +0000 (07:59 +0000)
test/unit/util/integer_black.h

index 66e29a01b78d64fee52e6e81d5e04c30dacde646..5b8397f66dd2b6174a9f15c2439fa739ae9aca9f 100644 (file)
@@ -300,11 +300,25 @@ public:
     unsigned long ul = numeric_limits<unsigned long>::max();
     Integer i(ul);
     TS_ASSERT(i.getUnsignedLong() == ul);
+#if defined(CVC4_ASSERTIONS) || defined(CVC4_CLN_IMP)
+    // CLN comes with exceptions built-in, and in assertion-enabled
+    // GMP builds, we check it
     TS_ASSERT_THROWS_ANYTHING(i.getLong());
+#else /* CVC4_ASSERTIONS || CVC4_CLN_IMP */
+    // otherwise we look for the expected overflow; if it doesn't
+    // happen, something's fishy...
+    TS_ASSERT( Integer(i.getLong()) != i );
+#endif /* CVC4_ASSERTIONS || CVC4_CLN_IMP */
     unsigned long ulplus1 = ul + 1;
     TS_ASSERT(ulplus1 == 0);
     i = i + 1;
+#if defined(CVC4_ASSERTIONS) || defined(CVC4_CLN_IMP)
+    // again, CLN || assertions will throw...
     TS_ASSERT_THROWS_ANYTHING(i.getUnsignedLong());
+#else /* CVC4_ASSERTIONS || CVC4_CLN_IMP */
+    // otherwise expect the overflow
+    TS_ASSERT( Integer(i.getUnsignedLong()) != i );
+#endif /* CVC4_ASSERTIONS || CVC4_CLN_IMP */
   }
 
   void testTestBit() {