Add unit tests for bignum bug
parent
50bf922832
commit
127f9b3578
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue