]> gitweb.factorcode.org Git - factor.git/commitdiff
Add unit tests for bignum bug
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 23 Feb 2009 01:41:47 +0000 (19:41 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 23 Feb 2009 01:41:47 +0000 (19:41 -0600)
basis/math/bits/bits-tests.factor
basis/math/functions/functions-tests.factor
basis/math/miller-rabin/miller-rabin-tests.factor
core/math/integers/integers-tests.factor

index 0503d27f33c2f572d01db6c99a118d7e35844f36..ed4e8419c965911e3496df60ba19f12b716b9e19 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Daniel Ehrenberg
 ! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test math.bits sequences arrays ;
+USING: tools.test math math.bits sequences arrays ;
 IN: math.bits.tests
 
 [ t ] [ BIN: 111111 3 <bits> second ] unit-test
@@ -14,3 +14,18 @@ IN: math.bits.tests
 [ 2 ] [ -3 make-bits length ] unit-test
 [ 1 ] [ 1 make-bits length ] unit-test
 [ 1 ] [ -1 make-bits length ] unit-test
+
+! Odd bug
+[ t ] [
+    1067811677921310779 make-bits
+    1067811677921310779 >bignum make-bits
+    sequence=
+] unit-test
+
+[ t ] [
+    1067811677921310779 make-bits peek
+] unit-test
+
+[ t ] [
+    1067811677921310779 >bignum make-bits peek
+] unit-test
\ No newline at end of file
index cf0ce5f0bb5642b7f72e84fa6022a50eca9f9473..9f5ce36be1fb593bafc1277b6e7e86f592476539 100644 (file)
@@ -137,3 +137,17 @@ IN: math.functions.tests
 
 [ 6 59967 ] [ 3837888 factor-2s ] unit-test
 [ 6 -59967 ] [ -3837888 factor-2s ] unit-test
+
+[ 1 ] [
+    183009416410801897
+    1067811677921310779
+    2135623355842621559
+    ^mod
+] unit-test
+
+[ 1 ] [
+    183009416410801897
+    1067811677921310779
+    2135623355842621559
+    [ >bignum ] tri@ ^mod
+] unit-test
\ No newline at end of file
index 9ca85ea72c5681a63510afb795d8ee914b2d9ae6..5f1b9835e49c32b9739cfd59663d5f7d06e8fa57 100644 (file)
@@ -7,4 +7,5 @@ IN: math.miller-rabin.tests
 [ f ] [ 36 miller-rabin ] unit-test
 [ t ] [ 37 miller-rabin ] unit-test
 [ 101 ] [ 100 next-prime ] unit-test
-[ 100000000000031 ] [ 100000000000000 next-prime ] unit-test
+[ t ] [ 2135623355842621559 miller-rabin ] unit-test
+[ 100000000000031 ] [ 100000000000000 next-prime ] unit-test
\ No newline at end of file
index 5a649120a02962625aac1d4bbc1a842c15a9c6e1..6bd3e9b094cd1489176021ecd970993c141dba9e 100644 (file)
@@ -91,6 +91,8 @@ unit-test
 [ f ] [ BIN: -1101 >bignum 3 bit? ] unit-test
 [ t ] [ BIN: -1101 >bignum 4 bit? ] unit-test
 
+[ t ] [ 1067811677921310779 >bignum 59 bit? ] unit-test
+
 [ 2 ] [ 0 next-power-of-2 ] unit-test
 [ 2 ] [ 1 next-power-of-2 ] unit-test
 [ 2 ] [ 2 next-power-of-2 ] unit-test