Skip to content

Commit

Permalink
Remove our dependency on the random package.
Browse files Browse the repository at this point in the history
Instead, directly use the generators defined in `tf-random`.
This changes the generation algorithm for some types, so we
need to update the tests that depend on those concrete values.

Fixes #1102
  • Loading branch information
robdockins committed Apr 7, 2021
1 parent c2ef506 commit 5898f12
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 13 deletions.
1 change: 0 additions & 1 deletion cabal.GHC-8.10.2.config
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ constraints: any.Cabal ==3.2.0.0,
any.primitive ==0.7.0.1,
any.process ==1.6.9.0,
any.profunctors ==5.5.2,
any.random ==1.1,
any.reflection ==2.1.6,
reflection -slow +template-haskell,
any.regex-base ==0.94.0.0,
Expand Down
1 change: 0 additions & 1 deletion cabal.GHC-8.10.3.config
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ constraints: any.Cabal ==3.2.1.0,
any.psqueues ==0.2.7.2,
any.quickcheck-instances ==0.3.25.1,
quickcheck-instances -bytestring-builder,
any.random ==1.1,
any.reflection ==2.1.6,
reflection -slow +template-haskell,
any.regex-base ==0.94.0.0,
Expand Down
1 change: 0 additions & 1 deletion cabal.GHC-8.6.5.config
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ constraints: any.Cabal ==2.4.0.1,
any.primitive ==0.7.0.1,
any.process ==1.6.5.0,
any.profunctors ==5.5.2,
any.random ==1.1,
any.reflection ==2.1.5,
reflection -slow +template-haskell,
any.regex-base ==0.94.0.0,
Expand Down
1 change: 0 additions & 1 deletion cabal.GHC-8.8.4.config
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ constraints: any.Cabal ==3.0.1.0,
any.primitive ==0.7.0.1,
any.process ==1.6.9.0,
any.profunctors ==5.5.2,
any.random ==1.1,
any.reflection ==2.1.5,
reflection -slow +template-haskell,
any.regex-base ==0.94.0.0,
Expand Down
1 change: 0 additions & 1 deletion cryptol.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ library
parameterized-utils >= 2.0.2,
pretty >= 1.1,
process >= 1.2,
random >= 1.0.1,
sbv >= 8.6 && < 8.14,
simple-smt >= 0.7.1,
stm >= 2.4,
Expand Down
3 changes: 2 additions & 1 deletion src/Cryptol/Testing/Random.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import Data.Bits
import Data.List (unfoldr, genericTake, genericIndex, genericReplicate)
import qualified Data.Sequence as Seq

import System.Random (RandomGen, split, random, randomR)
import System.Random.TF.Gen
import System.Random.TF.Instances

import Cryptol.Backend (Backend(..), SRational(..))
import Cryptol.Backend.FloatHelpers (floatFromBits)
Expand Down
12 changes: 6 additions & 6 deletions tests/issues/issue152.icry.stdout
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Loading module Cryptol
0xf7e937b5
[0xd4d4cc91cd7a9857, 0x4f3d263304e8ca85, 0x6723eafdcc46836f,
0x20e6c946662f2183, 0x6a760db62889b212, ...]
0x81db39d7
[0xdc6e05468ab90545, 0x3fd683aabbf9b928, 0x724f3408ce5a7745,
0xf5d53aa68de0ae45, 0xd8fc296263590e98, ...]
[[0x01, 0x83, 0x5f, 0x2e, 0xd1, 0x1a, 0x00, 0x1f, 0xfe, 0x55, 0xc8,
0x96, 0xcd, 0xe5, 0x9e, 0xca, 0xd9, 0xaa, 0x8a, 0x89, 0x06, 0xbd,
0x70, 0x40, 0xa7, 0x3b, 0xad, 0x8e, 0x8b, 0xe8, 0x6b, 0x5f],
Expand Down Expand Up @@ -50,7 +50,7 @@ Loading module Cryptol
[0xfc, 0xc1, 0x39, 0x4c, 0xa6, 0xb4, 0x5e, 0x57, 0xe4, 0x6b, 0xd3,
0x3d, 0x2f, 0x71, 0x71, 0x75, 0xdc, 0x5e, 0xdd, 0x7a, 0xbb, 0x77,
0xe0, 0x2e, 0x85, 0xd7, 0xc8, 0x26, 0x81, 0x93, 0xb4, 0x79]]
(0xf7e937b5, 0x2b34)
{x = 0x5a314507, y = 0x83aa}
(0x81db39d7, 0x6c18)
{x = 0xdc6e0546, y = 0x0545}
0x00000000
0xfb6686b9c4f59cf7b40ee8b5e1978175f59b0d83b1b401df99f4d8f0a0a4a011
0x2b65aa25c7f5cf4614e51e04d631c619687a3094a1d7111a13859c275da192e7
2 changes: 1 addition & 1 deletion tests/issues/issue364.cry
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ x : [64]
x = random 123

x_val : [64]
x_val = 0x80b483887be1a6e5
x_val = 0xe4f7c1740def67df

property x_eval = x == x_val
property x_distinct = ~ (x == zero)
Expand Down

0 comments on commit 5898f12

Please sign in to comment.