|
1 | 1 | module Test.Main where
|
2 | 2 |
|
| 3 | +import Prelude |
3 | 4 | import Data.Array.NonEmpty (cons')
|
4 | 5 | import Data.Foldable (fold)
|
5 | 6 | import Data.Maybe (Maybe(..), fromMaybe)
|
6 | 7 | import Debug (spy)
|
7 | 8 | import Effect (Effect)
|
8 | 9 | import Effect.Console (log)
|
9 |
| -import Js.BigInt.BigInt (BigInt, and, fromInt, fromString, fromTLInt, not, or, pow, shl, shr, toString, xor, even, odd, parity, toStringAs, binary, octal) |
| 10 | +import JS.BigInt (BigInt, and, fromInt, fromString, fromTLInt, not, or, pow, shl, shr, toString, xor, even, odd, parity, toInt, toStringAs, binary, octal) |
10 | 11 | import Prelude (class CommutativeRing, class Eq, class EuclideanRing, class Ord, class Ring, class Semiring, Unit, bind, compare, discard, identity, map, mod, negate, one, pure, show, zero, ($), (*), (+), (-), (/), (<$>), (<<<), (==))
|
11 | 12 | import Test.Assert (assert)
|
12 | 13 | import Test.QuickCheck (quickCheck)
|
@@ -127,15 +128,11 @@ main = do
|
127 | 128 | -- Data.checkEuclideanRing prxBigInt
|
128 | 129 |
|
129 | 130 | log "Converting BigInt to Int"
|
130 |
| - -- assert $ (fromString "0" <#> asIntN 64) == Just 0 |
131 |
| - -- assert $ (fromString "2137" <#> asIntN 64) == Just 2137 |
132 |
| - -- assert $ (fromString "-2137" <#> asIntN 64) == Just (-2137) |
133 |
| - -- assert $ (fromString "2147483647" <#> asIntN 64) == Just 2147483647 |
134 |
| - -- assert $ (fromString "2147483648" <#> asIntN 64) == Nothing |
135 |
| - -- assert $ (fromString "-2147483648" <#> asIntN 64) == Just (-2147483648) |
136 |
| - -- assert $ (fromString "-2147483649" <#> asIntN 64) == Nothing |
137 |
| - -- assert $ (fromString "921231231322337203685124775809" <#> asIntN 64) == Nothing |
138 |
| - -- assert $ (fromString "-922337203612312312312854775809" <#> asIntN 64) == Nothing |
| 131 | + assert $ (fromString "0" >>= toInt) == Just 0 |
| 132 | + assert $ (fromString "2137" >>= toInt) == Just 2137 |
| 133 | + assert $ (fromString "-2137" >>= toInt) == Just (-2137) |
| 134 | + assert $ (fromString "921231231322337203685124775809" >>= toInt) == Nothing |
| 135 | + assert $ (fromString "-922337203612312312312854775809" >>= toInt) == Nothing |
139 | 136 | -- quickCheck (\a b c ->
|
140 | 137 | -- let x = add (fromInt a) (add (fromInt b) (fromInt c))
|
141 | 138 | -- in case asIntN 64 x of
|
|
0 commit comments