Committing tests to potentially discover an obscure CLN library issue on 32 bit platf...
authorTim King <taking@cs.nyu.edu>
Fri, 30 Nov 2012 22:28:46 +0000 (22:28 +0000)
committerTim King <taking@cs.nyu.edu>
Fri, 30 Nov 2012 22:28:46 +0000 (22:28 +0000)
test/unit/util/integer_white.h
test/unit/util/rational_white.h

index 5a6e437825a7bb2dca5555c9d980933aad2d4f5a..19281d74571926bea9c00f90f45c1d6e01d7303d 100644 (file)
@@ -24,6 +24,7 @@ using namespace std;
 
 const char* largeVal = "4547897890548754897897897897890789078907890";
 
+
 class IntegerWhite : public CxxTest::TestSuite {
 public:
 
@@ -39,4 +40,15 @@ public:
     TS_ASSERT_THROWS_NOTHING(fits_in_16_bytes.hash());
     TS_ASSERT_THROWS_NOTHING(large.hash());
   }
+
+  //Make sure we can properly handle:
+  //http://www.ginac.de/CLN/cln_3.html#SEC15
+  const int i_above2tothe29 = (1 << 29) + 1;
+  const unsigned int u_above2tothe29 = (1 << 29) + 1;
+  void testConstruction(){
+    TS_ASSERT_EQUALS(Integer(i_above2tothe29), Integer((long)i_above2tothe29));
+    TS_ASSERT_EQUALS(Integer(u_above2tothe29),
+                     Integer((unsigned long)u_above2tothe29));
+
+  }
 };
index bcd3d56e40143f155a946a5c8c66c0f885015594..63b4e18435a8af46923556c39dba3bdd4e7a1e09 100644 (file)
@@ -430,4 +430,15 @@ public:
 //     TS_ASSERT_EQUALS(large.hash(),
 //                      (large.getNumerator().hash()) xor (large.getDenominator().hash()));
 //   }
+
+  //Make sure we can properly handle:
+  //http://www.ginac.de/CLN/cln_3.html#SEC15
+  const int i_above2tothe29 = (1 << 29) + 1;
+  const unsigned int u_above2tothe29 = (1 << 29) + 1;
+  void testConstruction(){
+    TS_ASSERT_EQUALS(Rational(i_above2tothe29), Rational((long)i_above2tothe29));
+    TS_ASSERT_EQUALS(Rational(u_above2tothe29),
+                     Rational((unsigned long)u_above2tothe29));
+
+  }
 };