pool_of_entropy 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9282759abb1c13fd70a45b27da5f58030107bc23
4
- data.tar.gz: 88da59e58548d584b72df4640be40be61aef9b37
3
+ metadata.gz: 512c263491f2d05bebe3e96ac23d1a3c0e3d49e9
4
+ data.tar.gz: 9833ccfc16899dc106a5839e739a435bbac3b2b4
5
5
  SHA512:
6
- metadata.gz: b158c97ffc614e6f40c5f769812a5f1441877e96c429e525875639c18f3c1a6f8699341bf81c062981e7eac2a2e986120718029facdb8bfe135e5ad8fc140d7f
7
- data.tar.gz: c68191705fce736800291804d24d30c46e74be13906cde6cae5e46983ae1afaeaeb6d72aa5b4e4cb72110b06d2d9751b32034c3e2424381378f13d8fdf08518a
6
+ metadata.gz: 971e11a66fa0b70be64e5d4a27d72aa6786552fa7dcd4f790bfdc8d8253486102db7cfb668583566951d04303dedf9f6664c0d4ca5b91881c84351ad7d263f61
7
+ data.tar.gz: a481cb8eef794fe07692743c007ac190c68e37d5eebaaec9645f7f52bdfc7c02815068b3672d63ec5468aee1f1e080f8417000e11f244c12c64a7ab371be4ed3
@@ -3,5 +3,9 @@ rvm:
3
3
  - "1.9.3"
4
4
  - "2.0.0"
5
5
  - "2.1.0"
6
+ - "2.1.1"
7
+ - "2.1.4"
8
+ - "2.2.0"
6
9
  - jruby-19mode
7
- - jruby-head
10
+ - jruby
11
+ - "rbx-2.2.9"
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  [![Gem Version](https://badge.fury.io/rb/pool_of_entropy.png)](http://badge.fury.io/rb/pool_of_entropy)
3
3
  [![Build Status](https://travis-ci.org/neilslater/pool_of_entropy.png?branch=master)](http://travis-ci.org/neilslater/pool_of_entropy)
4
4
  [![Coverage Status](https://coveralls.io/repos/neilslater/pool_of_entropy/badge.png?branch=master)](https://coveralls.io/r/neilslater/pool_of_entropy?branch=master)
5
+ [![Inline docs](http://inch-ci.org/github/neilslater/pool_of_entropy.png?branch=master)](http://inch-ci.org/github/neilslater/pool_of_entropy)
5
6
  [![Code Climate](https://codeclimate.com/github/neilslater/pool_of_entropy.png)](https://codeclimate.com/github/neilslater/pool_of_entropy)
6
7
  [![Dependency Status](https://gemnasium.com/neilslater/pool_of_entropy.png)](https://gemnasium.com/neilslater/pool_of_entropy)
7
8
 
@@ -50,7 +50,11 @@ class PoolOfEntropy
50
50
  # Cloning creates a deep copy with identical PRNG state and modifiers
51
51
  # @return [PoolOfEntropy]
52
52
  def clone
53
- Marshal.load( Marshal.dump( self ) )
53
+ copy = super
54
+ copy.instance_variable_set( :@core_prng, @core_prng.clone )
55
+ copy.instance_variable_set( :@fixed_modifier, @fixed_modifier.clone ) if @fixed_modifier
56
+ copy.instance_variable_set( :@next_modifier_queue, @next_modifier_queue.map { |m| m.clone } )
57
+ copy
54
58
  end
55
59
 
56
60
  # Same functionality as Kernel#rand or Random#rand, but using
@@ -1,3 +1,3 @@
1
1
  class PoolOfEntropy
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -6,14 +6,14 @@ describe PoolOfEntropy::CorePRNG do
6
6
  describe "#new" do
7
7
  it "should instantiate a default object" do
8
8
  prng = PoolOfEntropy::CorePRNG.new
9
- prng.should be_a PoolOfEntropy::CorePRNG
10
- prng.size.should == 1
9
+ expect( prng ).to be_a PoolOfEntropy::CorePRNG
10
+ expect( prng.size ).to be 1
11
11
  end
12
12
 
13
13
  it "should allow setting number of blocks in pool" do
14
14
  prng = PoolOfEntropy::CorePRNG.new( 10 )
15
- prng.should be_a PoolOfEntropy::CorePRNG
16
- prng.size.should == 10
15
+ expect( prng ).to be_a PoolOfEntropy::CorePRNG
16
+ expect( prng.size ).to be 10
17
17
  end
18
18
 
19
19
  it "should fail with incorrect block number" do
@@ -29,9 +29,9 @@ describe PoolOfEntropy::CorePRNG do
29
29
 
30
30
  it "should allow setting internal state" do
31
31
  prng = PoolOfEntropy::CorePRNG.new( 1, "\x0" * 64 )
32
- prng.should be_a PoolOfEntropy::CorePRNG
33
- prng.size.should == 1
34
- prng.state.should == "\x0" * 64
32
+ expect( prng ).to be_a PoolOfEntropy::CorePRNG
33
+ expect( prng.size ).to be 1
34
+ expect( prng.state ).to eql "\x0" * 64
35
35
  end
36
36
 
37
37
  it "should fail with bad state data" do
@@ -45,10 +45,10 @@ describe PoolOfEntropy::CorePRNG do
45
45
 
46
46
  it "should allow setting mix_block_id" do
47
47
  prng = PoolOfEntropy::CorePRNG.new( 3, "\x12" * 192, 1 )
48
- prng.should be_a PoolOfEntropy::CorePRNG
49
- prng.size.should == 3
50
- prng.state.should == "\x12" * 192
51
- prng.mix_block_id.should == 1
48
+ expect( prng ).to be_a PoolOfEntropy::CorePRNG
49
+ expect( prng.size ).to eql 3
50
+ expect( prng.state ).to eql "\x12" * 192
51
+ expect( prng.mix_block_id ).to eql 1
52
52
  end
53
53
  end
54
54
  end
@@ -60,15 +60,15 @@ describe PoolOfEntropy::CorePRNG do
60
60
  prng_orig = PoolOfEntropy::CorePRNG.new
61
61
  prng_copy = prng_orig.clone
62
62
 
63
- prng_copy.size.should == prng_orig.size
64
- prng_copy.state.should == prng_orig.state
65
- prng_copy.mix_block_id.should == prng_orig.mix_block_id
63
+ expect( prng_copy.size ).to eql prng_orig.size
64
+ expect( prng_copy.state ).to eql prng_orig.state
65
+ expect( prng_copy.mix_block_id ).to eql prng_orig.mix_block_id
66
66
  end
67
67
 
68
68
  it "should deep clone the internal state string" do
69
69
  prng_orig = PoolOfEntropy::CorePRNG.new
70
70
  prng_copy = prng_orig.clone
71
- prng_copy.state.should_not be prng_orig.state
71
+ expect( prng_copy.state ).to_not be prng_orig.state
72
72
  end
73
73
  end
74
74
 
@@ -77,25 +77,25 @@ describe PoolOfEntropy::CorePRNG do
77
77
  prng = PoolOfEntropy::CorePRNG.new
78
78
  init_state = prng.state.clone
79
79
  prng.update( 'boo' )
80
- prng.state.should_not == init_state
80
+ expect( prng.state ).to_not eql init_state
81
81
  end
82
82
 
83
83
  it "should not change the length of the internal state" do
84
84
  prng = PoolOfEntropy::CorePRNG.new
85
85
  prng.update( 'boo' )
86
- prng.state.length.should == 64
86
+ expect( prng.state.length ).to eql 64
87
87
  prng.update( 'boowgkjwrhqgioueqrhgiue2hguirhqwiughreuioghreuifhqwoifhr3iufghfwrgrwgetdfwd' )
88
- prng.state.length.should == 64
88
+ expect( prng.state.length ).to eql 64
89
89
 
90
90
  prng = PoolOfEntropy::CorePRNG.new( 5 )
91
91
  prng.update( 'boo' )
92
- prng.state.length.should == 5 * 64
92
+ expect( prng.state.length ).to eql 5 * 64
93
93
  prng.update( 'getdfwd' * 1000 )
94
- prng.state.length.should == 5 * 64
94
+ expect( prng.state.length ).to eql 5 * 64
95
95
  prng.update( 'boefewfweo' )
96
- prng.state.length.should == 5 * 64
96
+ expect( prng.state.length ).to eql 5 * 64
97
97
  prng.update( 'geefewftdfwd' * 1000 )
98
- prng.state.length.should == 5 * 64
98
+ expect( prng.state.length ).to eql 5 * 64
99
99
  end
100
100
 
101
101
  it "should only change 64 bytes of state at a time" do
@@ -103,22 +103,22 @@ describe PoolOfEntropy::CorePRNG do
103
103
  init_state = prng.state.clone
104
104
 
105
105
  prng.update( 'boo' )
106
- prng.state[64,4*64].should == init_state[64,4*64]
106
+ expect( prng.state[64,4*64] ).to eql init_state[64,4*64]
107
107
  next_state = prng.state.clone
108
108
 
109
109
  prng.update( 'getdfwd' * 1000 )
110
- prng.state[128,3*64].should == init_state[128,3*64]
111
- prng.state[0,1*64].should == next_state[0,1*64]
110
+ expect( prng.state[128,3*64] ).to eql init_state[128,3*64]
111
+ expect( prng.state[0,1*64] ).to eql next_state[0,1*64]
112
112
  next_state = prng.state.clone
113
113
 
114
114
  prng.update( 'boefewfweo' )
115
- prng.state[192,2*64].should == init_state[192,2*64]
116
- prng.state[0,2*64].should == next_state[0,2*64]
115
+ expect( prng.state[192,2*64] ).to eql init_state[192,2*64]
116
+ expect( prng.state[0,2*64] ).to eql next_state[0,2*64]
117
117
  next_state = prng.state.clone
118
118
 
119
119
  prng.update( 'geefewftdfwd' * 1000 )
120
- prng.state[256,1*64].should == init_state[256,1*64]
121
- prng.state[0,3*64].should == next_state[0,3*64]
120
+ expect( prng.state[256,1*64] ).to eql init_state[256,1*64]
121
+ expect( prng.state[0,3*64] ).to eql next_state[0,3*64]
122
122
  end
123
123
  end
124
124
 
@@ -163,40 +163,40 @@ describe PoolOfEntropy::CorePRNG do
163
163
 
164
164
  describe "#read_bytes" do
165
165
  it "always returns a 16 byte string" do
166
- 100.times { prng.read_bytes.length.should == 16 }
166
+ 100.times { expect( prng.read_bytes.length ).to eql 16 }
167
167
  end
168
168
 
169
169
  it "has a high probability of returning a different string each time" do
170
- Set[ *(1..100).map {prng.read_bytes} ].size.should == 100
170
+ expect( Set[ *(1..100).map {prng.read_bytes} ].size ).to eql 100
171
171
  end
172
172
 
173
173
  describe "with adjustments" do
174
174
  it "always returns a 16 byte string" do
175
- 100.times { prng.read_bytes('654321').length.should == 16 }
175
+ 100.times { expect( prng.read_bytes('654321').length ).to eql 16 }
176
176
  end
177
177
 
178
178
  it "has a high probability of returning a different string each time" do
179
- Set[ *(1..100).map {prng.read_bytes('654321')} ].size.should == 100
179
+ expect( Set[ *(1..100).map {prng.read_bytes('654321')} ].size ).to eql 100
180
180
  end
181
181
 
182
182
  it "changes output, but does not include adjustments in changes to state" do
183
183
  prng_copy = prng.clone
184
184
  10.times do
185
- prng.read_bytes('Hello!').should == prng_copy.read_bytes('Hello!')
186
- prng.state.should == prng_copy.state
187
- prng.read_bytes('Hello!').should_not == prng_copy.read_bytes('Goodbye!')
188
- prng.state.should == prng_copy.state
189
- prng.read_bytes.should_not == prng_copy.read_bytes('Goodbye!')
190
- prng.state.should == prng_copy.state
191
- prng.read_bytes('Hello!').should_not == prng_copy.read_bytes
192
- prng.state.should == prng_copy.state
193
- prng.read_bytes('Hello','Goodbye').should_not == prng_copy.read_bytes
194
- prng.state.should == prng_copy.state
185
+ expect( prng.read_bytes('Hello!') ).to eql prng_copy.read_bytes('Hello!')
186
+ expect( prng.state ).to eql prng_copy.state
187
+ expect( prng.read_bytes('Hello!') ).to_not eql prng_copy.read_bytes('Goodbye!')
188
+ expect( prng.state ).to eql prng_copy.state
189
+ expect( prng.read_bytes ).to_not eql prng_copy.read_bytes('Goodbye!')
190
+ expect( prng.state ).to eql prng_copy.state
191
+ expect( prng.read_bytes('Hello!') ).to_not eql prng_copy.read_bytes
192
+ expect( prng.state ).to eql prng_copy.state
193
+ expect( prng.read_bytes('Hello','Goodbye') ).to_not eql prng_copy.read_bytes
194
+ expect( prng.state ).to eql prng_copy.state
195
195
  # Verify that output remains same for next rolls
196
- prng.read_bytes('Foobar','Wibble').should == prng_copy.read_bytes('Foobar','Wibble')
197
- prng.state.should == prng_copy.state
198
- prng.read_bytes.should == prng_copy.read_bytes
199
- prng.state.should == prng_copy.state
196
+ expect( prng.read_bytes('Foobar','Wibble') ).to eql prng_copy.read_bytes('Foobar','Wibble')
197
+ expect( prng.state ).to eql prng_copy.state
198
+ expect( prng.read_bytes ).to eql prng_copy.read_bytes
199
+ expect( prng.state ).to eql prng_copy.state
200
200
  end
201
201
  end
202
202
  end
@@ -206,46 +206,46 @@ describe PoolOfEntropy::CorePRNG do
206
206
  it "always returns a 32 digit hex string" do
207
207
  100.times do
208
208
  hex = prng.read_hex
209
- hex.length.should == 32
210
- hex.should match /\A[0-9a-f]{32}\z/
209
+ expect( hex.length ).to eql 32
210
+ expect( hex ).to match /\A[0-9a-f]{32}\z/
211
211
  end
212
212
  end
213
213
 
214
214
  it "has a high probability of returning a different string each time" do
215
- Set[ *(1..100).map {prng.read_hex} ].size.should == 100
215
+ expect( Set[ *(1..100).map {prng.read_hex} ].size ).to eql 100
216
216
  end
217
217
 
218
218
  describe "with adjustments" do
219
219
  it "always returns a 32 digit hex string" do
220
220
  100.times do
221
221
  hex = prng.read_hex('QWertyeu')
222
- hex.length.should == 32
223
- hex.should match /\A[0-9a-f]{32}\z/
222
+ expect( hex.length ).to eql 32
223
+ expect( hex ).to match /\A[0-9a-f]{32}\z/
224
224
  end
225
225
  end
226
226
 
227
227
  it "has a high probability of returning a different string each time" do
228
- Set[ *(1..100).map {prng.read_hex('654321')} ].size.should == 100
228
+ expect( Set[ *(1..100).map {prng.read_hex('654321')} ].size ).to eql 100
229
229
  end
230
230
 
231
231
  it "changes output, but does not include adjustments in changes to state" do
232
232
  prng_copy = prng.clone
233
233
  10.times do
234
- prng.read_hex('Hello!').should == prng_copy.read_hex('Hello!')
235
- prng.state.should == prng_copy.state
236
- prng.read_hex('Hello!').should_not == prng_copy.read_hex('Goodbye!')
237
- prng.state.should == prng_copy.state
238
- prng.read_hex.should_not == prng_copy.read_hex('Goodbye!')
239
- prng.state.should == prng_copy.state
240
- prng.read_hex('Hello!').should_not == prng_copy.read_hex
241
- prng.state.should == prng_copy.state
242
- prng.read_hex('Hello','Goodbye').should_not == prng_copy.read_hex
243
- prng.state.should == prng_copy.state
234
+ expect( prng.read_hex('Hello!') ).to eql prng_copy.read_hex('Hello!')
235
+ expect( prng.state ).to eql prng_copy.state
236
+ expect( prng.read_hex('Hello!') ).to_not eql prng_copy.read_hex('Goodbye!')
237
+ expect( prng.state ).to eql prng_copy.state
238
+ expect( prng.read_hex ).to_not eql prng_copy.read_hex('Goodbye!')
239
+ expect( prng.state ).to eql prng_copy.state
240
+ expect( prng.read_hex('Hello!') ).to_not eql prng_copy.read_hex
241
+ expect( prng.state ).to eql prng_copy.state
242
+ expect( prng.read_hex('Hello','Goodbye') ).to_not eql prng_copy.read_hex
243
+ expect( prng.state ).to eql prng_copy.state
244
244
  # Verify that output remains same for next rolls
245
- prng.read_hex('Foobar','Wibble').should == prng_copy.read_hex('Foobar','Wibble')
246
- prng.state.should == prng_copy.state
247
- prng.read_hex.should == prng_copy.read_hex
248
- prng.state.should == prng_copy.state
245
+ expect( prng.read_hex('Foobar','Wibble') ).to eql prng_copy.read_hex('Foobar','Wibble')
246
+ expect( prng.state ).to eql prng_copy.state
247
+ expect( prng.read_hex ).to eql prng_copy.read_hex
248
+ expect( prng.state ).to eql prng_copy.state
249
249
  end
250
250
  end
251
251
  end
@@ -255,46 +255,46 @@ describe PoolOfEntropy::CorePRNG do
255
255
  it "always returns a 128-bit unsigned integer" do
256
256
  100.times do
257
257
  num = prng.read_bignum
258
- num.should >= 0
259
- num.should < 2**128
258
+ expect( num ).to be >= 0
259
+ expect( num ).to be < 2**128
260
260
  end
261
261
  end
262
262
 
263
263
  it "has a high probability of returning a different number each time" do
264
- Set[ *(1..100).map {prng.read_bignum} ].size.should == 100
264
+ expect( Set[ *(1..100).map {prng.read_bignum} ].size ).to eql 100
265
265
  end
266
266
 
267
267
  describe "with adjustments" do
268
268
  it "always returns a 128-bit unsigned integer" do
269
269
  100.times do
270
270
  num = prng.read_bignum( 'Biggest' )
271
- num.should >= 0
272
- num.should < 2**128
271
+ expect( num ).to be >= 0
272
+ expect( num ).to be < 2**128
273
273
  end
274
274
  end
275
275
 
276
276
  it "has a high probability of returning a different number each time" do
277
- Set[ *(1..100).map {prng.read_bignum('654321')} ].size.should == 100
277
+ expect( Set[ *(1..100).map {prng.read_bignum('654321')} ].size ).to eql 100
278
278
  end
279
279
 
280
280
  it "changes output, but does not include adjustments in changes to state" do
281
281
  prng_copy = prng.clone
282
282
  10.times do
283
- prng.read_bignum('Hello!').should == prng_copy.read_bignum('Hello!')
284
- prng.state.should == prng_copy.state
285
- prng.read_bignum('Hello!').should_not == prng_copy.read_bignum('Goodbye!')
286
- prng.state.should == prng_copy.state
287
- prng.read_bignum.should_not == prng_copy.read_bignum('Goodbye!')
288
- prng.state.should == prng_copy.state
289
- prng.read_bignum('Hello!').should_not == prng_copy.read_bignum
290
- prng.state.should == prng_copy.state
291
- prng.read_bignum('Hello','Goodbye').should_not == prng_copy.read_bignum
292
- prng.state.should == prng_copy.state
283
+ expect( prng.read_bignum('Hello!') ).to eql prng_copy.read_bignum('Hello!')
284
+ expect( prng.state ).to eql prng_copy.state
285
+ expect( prng.read_bignum('Hello!') ).to_not eql prng_copy.read_bignum('Goodbye!')
286
+ expect( prng.state ).to eql prng_copy.state
287
+ expect( prng.read_bignum ).to_not eql prng_copy.read_bignum('Goodbye!')
288
+ expect( prng.state ).to eql prng_copy.state
289
+ expect( prng.read_bignum('Hello!') ).to_not eql prng_copy.read_bignum
290
+ expect( prng.state ).to eql prng_copy.state
291
+ expect( prng.read_bignum('Hello','Goodbye') ).to_not eql prng_copy.read_bignum
292
+ expect( prng.state ).to eql prng_copy.state
293
293
  # Verify that output remains same for next rolls
294
- prng.read_bignum('Foobar','Wibble').should == prng_copy.read_bignum('Foobar','Wibble')
295
- prng.state.should == prng_copy.state
296
- prng.read_bignum.should == prng_copy.read_bignum
297
- prng.state.should == prng_copy.state
294
+ expect( prng.read_bignum('Foobar','Wibble') ).to eql prng_copy.read_bignum('Foobar','Wibble')
295
+ expect( prng.state ).to eql prng_copy.state
296
+ expect( prng.read_bignum ).to eql prng_copy.read_bignum
297
+ expect( prng.state ).to eql prng_copy.state
298
298
  end
299
299
  end
300
300
  end
@@ -304,48 +304,48 @@ describe PoolOfEntropy::CorePRNG do
304
304
  it "always returns a Float between 0.0 (inclusive) and 1.0 (exclusive)" do
305
305
  100.times do
306
306
  num = prng.read_float
307
- num.should be_a Float
308
- num.should >= 0.0
309
- num.should < 1.0
307
+ expect( num ).to be_a Float
308
+ expect( num ).to be >= 0.0
309
+ expect( num ).to be < 1.0
310
310
  end
311
311
  end
312
312
 
313
313
  it "has a high probability of returning a different Float each time" do
314
- Set[ *(1..100).map {prng.read_float} ].size.should == 100
314
+ expect( Set[ *(1..100).map {prng.read_float} ].size ).to eql 100
315
315
  end
316
316
 
317
317
  describe "with adjustments" do
318
318
  it "always returns a Float between 0.0 (inclusive) and 1.0 (exclusive)" do
319
319
  100.times do
320
320
  num = prng.read_float('Boom')
321
- num.should be_a Float
322
- num.should >= 0.0
323
- num.should < 1.0
321
+ expect( num ).to be_a Float
322
+ expect( num ).to be >= 0.0
323
+ expect( num ).to be < 1.0
324
324
  end
325
325
  end
326
326
 
327
327
  it "has a high probability of returning a different Float each time" do
328
- Set[ *(1..100).map {prng.read_float('654321')} ].size.should == 100
328
+ expect( Set[ *(1..100).map {prng.read_float('654321')} ].size ).to eql 100
329
329
  end
330
330
 
331
331
  it "changes output, but does not include adjustments in changes to state" do
332
332
  prng_copy = prng.clone
333
333
  10.times do
334
- prng.read_float('Hello!').should == prng_copy.read_float('Hello!')
335
- prng.state.should == prng_copy.state
336
- prng.read_float('Hello!').should_not == prng_copy.read_float('Goodbye!')
337
- prng.state.should == prng_copy.state
338
- prng.read_float.should_not == prng_copy.read_float('Goodbye!')
339
- prng.state.should == prng_copy.state
340
- prng.read_float('Hello!').should_not == prng_copy.read_float
341
- prng.state.should == prng_copy.state
342
- prng.read_float('Hello','Goodbye').should_not == prng_copy.read_float
343
- prng.state.should == prng_copy.state
334
+ expect( prng.read_float('Hello!') ).to eql prng_copy.read_float('Hello!')
335
+ expect( prng.state ).to eql prng_copy.state
336
+ expect( prng.read_float('Hello!') ).to_not eql prng_copy.read_float('Goodbye!')
337
+ expect( prng.state ).to eql prng_copy.state
338
+ expect( prng.read_float ).to_not eql prng_copy.read_float('Goodbye!')
339
+ expect( prng.state ).to eql prng_copy.state
340
+ expect( prng.read_float('Hello!') ).to_not eql prng_copy.read_float
341
+ expect( prng.state ).to eql prng_copy.state
342
+ expect( prng.read_float('Hello','Goodbye') ).to_not eql prng_copy.read_float
343
+ expect( prng.state ).to eql prng_copy.state
344
344
  # Verify that output remains same for next rolls
345
- prng.read_float('Foobar','Wibble').should == prng_copy.read_float('Foobar','Wibble')
346
- prng.state.should == prng_copy.state
347
- prng.read_float.should == prng_copy.read_float
348
- prng.state.should == prng_copy.state
345
+ expect( prng.read_float('Foobar','Wibble') ).to eql prng_copy.read_float('Foobar','Wibble')
346
+ expect( prng.state ).to eql prng_copy.state
347
+ expect( prng.read_float ).to eql prng_copy.read_float
348
+ expect( prng.state ).to eql prng_copy.state
349
349
  end
350
350
  end
351
351
  end
@@ -355,84 +355,84 @@ describe PoolOfEntropy::CorePRNG do
355
355
  it "always returns an integer between 0 (inclusive) and supplied top (exclusive)" do
356
356
  100.times do
357
357
  num = prng.generate_integer( 10 )
358
- num.should be_a Fixnum
359
- num.should >= 0
360
- num.should < 10
358
+ expect( num ).to be_a Fixnum
359
+ expect( num ).to be >= 0
360
+ expect( num ).to be < 10
361
361
  end
362
362
 
363
363
  100.times do
364
364
  num = prng.generate_integer( 100 )
365
- num.should be_a Fixnum
366
- num.should >= 0
367
- num.should < 100
365
+ expect( num ).to be_a Fixnum
366
+ expect( num ).to be >= 0
367
+ expect( num ).to be < 100
368
368
  end
369
369
 
370
370
  100.times do
371
371
  num = prng.generate_integer( 1000 )
372
- num.should be_a Fixnum
373
- num.should >= 0
374
- num.should < 1000
372
+ expect( num ).to be_a Fixnum
373
+ expect( num ).to be >= 0
374
+ expect( num ).to be < 1000
375
375
  end
376
376
 
377
377
  100.times do
378
378
  num = prng.generate_integer( 647218456 )
379
- num.should be_a Fixnum
380
- num.should >= 0
381
- num.should < 647218456
379
+ expect( num ).to be_a Fixnum
380
+ expect( num ).to be >= 0
381
+ expect( num ).to be < 647218456
382
382
  end
383
383
  end
384
384
 
385
385
  it "can generate integers larger than 2**128" do
386
386
  results = (0..100).map do
387
387
  num = prng.generate_integer( 2 ** 1024 )
388
- num.should >= 0
389
- num.should < 2 ** 1024
388
+ expect( num ).to be >= 0
389
+ expect( num ).to be < 2 ** 1024
390
390
  num
391
391
  end
392
- results.select { |n| n > 2 ** 1020 }.count.should > 50
392
+ expect( results.select { |n| n > 2 ** 1020 }.count ).to be > 50
393
393
  end
394
394
 
395
395
  it "with a large enough value for top, has a high probability of returning a different integer each time" do
396
- Set[ *(1..100).map {prng.generate_integer( 2**75 - 7 )} ].size.should == 100
396
+ expect( Set[ *(1..100).map {prng.generate_integer( 2**75 - 7 )} ].size ).to eql 100
397
397
  end
398
398
 
399
399
  it "covers a distribution 0...top" do
400
- Set[ *(1..100).map {prng.generate_integer(10)} ].size.should == 10
400
+ expect( Set[ *(1..100).map {prng.generate_integer(10)} ].size ).to eql 10
401
401
  end
402
402
 
403
403
  describe "with adjustments" do
404
404
  it "always returns an integer between 0 (inclusive) and supplied top (exclusive)" do
405
405
  100.times do
406
406
  num = prng.generate_integer( 10, 'jkffwe' )
407
- num.should be_a Fixnum
408
- num.should >= 0
409
- num.should < 10
407
+ expect( num ).to be_a Fixnum
408
+ expect( num ).to be >= 0
409
+ expect( num ).to be < 10
410
410
  end
411
411
 
412
412
  100.times do
413
413
  num = prng.generate_integer( 100, 'jkffweefewg' )
414
- num.should be_a Fixnum
415
- num.should >= 0
416
- num.should < 100
414
+ expect( num ).to be_a Fixnum
415
+ expect( num ).to be >= 0
416
+ expect( num ).to be < 100
417
417
  end
418
418
 
419
419
  100.times do
420
420
  num = prng.generate_integer( 1000, 'jkffweefewg', 'efhwjkfgw' )
421
- num.should be_a Fixnum
422
- num.should >= 0
423
- num.should < 1000
421
+ expect( num ).to be_a Fixnum
422
+ expect( num ).to be >= 0
423
+ expect( num ).to be < 1000
424
424
  end
425
425
 
426
426
  100.times do
427
427
  num = prng.generate_integer( 647218456, 'j*****g', 'efhwjkfgw' )
428
- num.should be_a Fixnum
429
- num.should >= 0
430
- num.should < 647218456
428
+ expect( num ).to be_a Fixnum
429
+ expect( num ).to be >= 0
430
+ expect( num ).to be < 647218456
431
431
  end
432
432
  end
433
433
 
434
434
  it "with a large enough value for top, has a high probability of returning a different integer each time" do
435
- Set[ *(1..100).map {prng.generate_integer( 2**80 - 5, '654321')} ].size.should == 100
435
+ expect( Set[ *(1..100).map {prng.generate_integer( 2**80 - 5, '654321')} ].size ).to eql 100
436
436
  end
437
437
 
438
438
  it "changes output, but does not include adjustments in changes to state" do
@@ -440,21 +440,21 @@ describe PoolOfEntropy::CorePRNG do
440
440
  big = 2 ** 64 - 3
441
441
  small = 20
442
442
  10.times do
443
- prng.generate_integer( small, 'Hello!').should == prng_copy.generate_integer( small, 'Hello!')
444
- prng.state.should == prng_copy.state
445
- prng.generate_integer( big, 'Hello!').should_not == prng_copy.generate_integer( big, 'Goodbye!')
446
- prng.state.should == prng_copy.state
447
- prng.generate_integer( big ).should_not == prng_copy.generate_integer( big, 'Goodbye!')
448
- prng.state.should == prng_copy.state
449
- prng.generate_integer( big, 'Hello!').should_not == prng_copy.generate_integer( big )
450
- prng.state.should == prng_copy.state
451
- prng.generate_integer( big, 'Hello','Goodbye').should_not == prng_copy.generate_integer( big )
452
- prng.state.should == prng_copy.state
443
+ expect( prng.generate_integer( small, 'Hello!') ).to eql prng_copy.generate_integer( small, 'Hello!')
444
+ expect( prng.state ).to eql prng_copy.state
445
+ expect( prng.generate_integer( big, 'Hello!') ).to_not eql prng_copy.generate_integer( big, 'Goodbye!')
446
+ expect( prng.state ).to eql prng_copy.state
447
+ expect( prng.generate_integer( big ) ).to_not eql prng_copy.generate_integer( big, 'Goodbye!')
448
+ expect( prng.state ).to eql prng_copy.state
449
+ expect( prng.generate_integer( big, 'Hello!') ).to_not eql prng_copy.generate_integer( big )
450
+ expect( prng.state ).to eql prng_copy.state
451
+ expect( prng.generate_integer( big, 'Hello','Goodbye') ).to_not eql prng_copy.generate_integer( big )
452
+ expect( prng.state ).to eql prng_copy.state
453
453
  # Verify that output remains same for next rolls
454
- prng.generate_integer( small, 'Foobar','Wibble').should == prng_copy.generate_integer( small, 'Foobar','Wibble')
455
- prng.state.should == prng_copy.state
456
- prng.generate_integer( big ).should == prng_copy.generate_integer( big )
457
- prng.state.should == prng_copy.state
454
+ expect( prng.generate_integer( small, 'Foobar','Wibble') ).to eql prng_copy.generate_integer( small, 'Foobar','Wibble')
455
+ expect( prng.state ).to eql prng_copy.state
456
+ expect( prng.generate_integer( big ) ).to eql prng_copy.generate_integer( big )
457
+ expect( prng.state ).to eql prng_copy.state
458
458
  end
459
459
  end
460
460
  end
@@ -474,10 +474,10 @@ describe PoolOfEntropy::CorePRNG do
474
474
  :int => prngs[4].generate_integer( 1_000_000_000 ),
475
475
  ]
476
476
  end
477
- results.sort_by { |h| h[:int] }.should == results.sort_by { |h| h[:hex] }
478
- results.sort_by { |h| h[:float] }.should == results.sort_by { |h| h[:hex] }
479
- results.sort_by { |h| h[:num] }.should == results.sort_by { |h| h[:bytes] }
480
- results.sort_by { |h| h[:float] }.should == results.sort_by { |h| h[:int] }
477
+ expect( results.sort_by { |h| h[:int] } ).to eql results.sort_by { |h| h[:hex] }
478
+ expect( results.sort_by { |h| h[:float] } ).to eql results.sort_by { |h| h[:hex] }
479
+ expect( results.sort_by { |h| h[:num] } ).to eql results.sort_by { |h| h[:bytes] }
480
+ expect( results.sort_by { |h| h[:float] } ).to eql results.sort_by { |h| h[:int] }
481
481
  end
482
482
  end
483
483
 
@@ -487,7 +487,7 @@ describe PoolOfEntropy::CorePRNG do
487
487
  describe "using predictable sequences" do
488
488
  it "generates expected hex strings from simple zeroed pool" do
489
489
  prng = PoolOfEntropy::CorePRNG.new( 1, "\x0" * 64 )
490
- (0..24).map { prng.read_hex }.should == [ "da0cd77eb1c84458ddcc91e36b9dcb35",
490
+ expect( (0..24).map { prng.read_hex } ).to eql [ "da0cd77eb1c84458ddcc91e36b9dcb35",
491
491
  "498ec24d1126440047eed396d836b5e1", "0b90df55c5e7c1513b072367eae4a4ce",
492
492
  "f12b5b54b5594e785bbb9a4ac50ccec8", "d506bd4e201a00dc30499bd8e59a30d8",
493
493
  "2557893cf995fe43bd00721fce6ab16a", "41ee50244cdd02334bafc3e9d8f564d9",
@@ -504,7 +504,7 @@ describe PoolOfEntropy::CorePRNG do
504
504
 
505
505
  it "generates expected hex strings from simple zeroed pool and an adjustment" do
506
506
  prng = PoolOfEntropy::CorePRNG.new( 1, "\x0" * 64 )
507
- (0..24).map { prng.read_hex( 'bananas' ) }.should == [
507
+ expect( (0..24).map { prng.read_hex( 'bananas' ) } ).to eql [
508
508
  "fed9de9a612f4157ebb49582ca557a50", "a7adc2374a4df2ed67846ac09a3b6645",
509
509
  "cbdf8bbbe6145751fe14004719915160", "8cd84be95376f72918c305bdea43e36d",
510
510
  "9e08e80ff40c942f0cf4d479b5378fa0", "54d80c5330873f9733a0adef0197220f",
@@ -522,7 +522,7 @@ describe PoolOfEntropy::CorePRNG do
522
522
 
523
523
  it "generates expected hex strings from simple zeroed pool and alternating adjustments" do
524
524
  prng = PoolOfEntropy::CorePRNG.new( 1, "\x0" * 64 )
525
- (0..24).map { |x| x.odd? ? prng.read_hex( 'bananas', x.to_s ) : prng.read_hex }.should == [
525
+ expect( (0..24).map { |x| x.odd? ? prng.read_hex( 'bananas', x.to_s ) : prng.read_hex } ).to eql [
526
526
  "da0cd77eb1c84458ddcc91e36b9dcb35", "de4b20a0560263090c6fe11ebba6256e",
527
527
  "0b90df55c5e7c1513b072367eae4a4ce", "0c92d534160cb268cb3282a9dd3f1efe",
528
528
  "d506bd4e201a00dc30499bd8e59a30d8", "089f799236a9cf64f22f1deafbe28214",
@@ -6,17 +6,17 @@ describe PoolOfEntropy do
6
6
  describe "#new" do
7
7
  it "should instantiate a default object" do
8
8
  pool = PoolOfEntropy.new
9
- pool.should be_a PoolOfEntropy
9
+ expect( pool ).to be_a PoolOfEntropy
10
10
  end
11
11
 
12
12
  it "should allow setting number of blocks in pool" do
13
13
  [1,3,5,8,13,21,34,55,89,144,233].each do |s|
14
14
  pool = PoolOfEntropy.new( :size => 12 )
15
- pool.should be_a PoolOfEntropy
15
+ expect( pool ).to be_a PoolOfEntropy
16
16
  num = pool.rand()
17
- num.should be_a Float
18
- num.should >= 0.0
19
- num.should < 1.0
17
+ expect( num ).to be_a Float
18
+ expect( num ).to be >= 0.0
19
+ expect( num ).to be < 1.0
20
20
  end
21
21
  end
22
22
 
@@ -38,30 +38,30 @@ describe PoolOfEntropy do
38
38
 
39
39
  it "should default to unpredicatble internal state" do
40
40
  pool = PoolOfEntropy.new()
41
- pool.should be_a PoolOfEntropy
42
- (10..20).map { |x| pool.rand(x) }.should_not == [8, 3, 0, 12, 11, 2, 4, 8, 1, 11, 18]
41
+ expect( pool ).to be_a PoolOfEntropy
42
+ expect( (10..20).map { |x| pool.rand(x) } ).to_not eql [8, 3, 0, 12, 11, 2, 4, 8, 1, 11, 18]
43
43
  end
44
44
 
45
45
  it "should accept { :blank => false } as explicit statement of default" do
46
46
  pool = PoolOfEntropy.new( :blank => false )
47
- pool.should be_a PoolOfEntropy
48
- (10..20).map { |x| pool.rand(x) }.should_not == [8, 3, 0, 12, 11, 2, 4, 8, 1, 11, 18]
47
+ expect( pool ).to be_a PoolOfEntropy
48
+ expect( (10..20).map { |x| pool.rand(x) } ).to_not eql [8, 3, 0, 12, 11, 2, 4, 8, 1, 11, 18]
49
49
  end
50
50
 
51
51
  it "should allow an initial blank internal state" do
52
52
  pool = PoolOfEntropy.new( :blank => true )
53
- pool.should be_a PoolOfEntropy
54
- (10..20).map { |x| pool.rand(x) }.should == [8, 3, 0, 12, 11, 2, 4, 8, 1, 11, 18]
53
+ expect( pool ).to be_a PoolOfEntropy
54
+ expect( (10..20).map { |x| pool.rand(x) } ).to eql [8, 3, 0, 12, 11, 2, 4, 8, 1, 11, 18]
55
55
  end
56
56
 
57
57
  it "should accept and use :seeds array" do
58
58
  pool = PoolOfEntropy.new( :blank => true, :seeds => ['foo'] )
59
- pool.should be_a PoolOfEntropy
60
- (10..20).map { |x| pool.rand(x) }.should == [9, 1, 3, 7, 8, 12, 14, 5, 11, 5, 6]
59
+ expect( pool ).to be_a PoolOfEntropy
60
+ expect( (10..20).map { |x| pool.rand(x) } ).to eql [9, 1, 3, 7, 8, 12, 14, 5, 11, 5, 6]
61
61
 
62
62
  pool = PoolOfEntropy.new( :blank => true, :seeds => ['foo', 'bar'] )
63
- pool.should be_a PoolOfEntropy
64
- (10..20).map { |x| pool.rand(x) }.should == [8, 1, 5, 8, 2, 7, 11, 8, 8, 13, 14]
63
+ expect( pool ).to be_a PoolOfEntropy
64
+ expect( (10..20).map { |x| pool.rand(x) } ).to eql [8, 1, 5, 8, 2, 7, 11, 8, 8, 13, 14]
65
65
  end
66
66
 
67
67
  it "should fail if :seeds param is not an array" do
@@ -117,7 +117,7 @@ describe PoolOfEntropy do
117
117
 
118
118
  pool_copy = pool.clone
119
119
  100.times do
120
- pool_copy.rand().should == pool.rand()
120
+ expect( pool_copy.rand() ).to eql pool.rand()
121
121
  end
122
122
  end
123
123
  end
@@ -128,20 +128,20 @@ describe PoolOfEntropy do
128
128
  it "should call PoolOfEntropy::CorePRNG::read_bytes internally" do
129
129
  allow_any_instance_of( PoolOfEntropy::CorePRNG).
130
130
  to receive( :read_bytes ).and_return( "\x1e\xfe" * 8 )
131
- 20.times { pool.rand.should == 0.12106507972838931 }
131
+ 20.times { expect( pool.rand ).to eql 0.12106507972838931 }
132
132
  end
133
133
 
134
134
  it "should return a Float between 0.0 and 1.0" do
135
135
  100.times do
136
136
  num = pool.rand
137
- num.should be_a Float
138
- num.should >= 0.0
139
- num.should < 1.0
137
+ expect( num ).to be_a Float
138
+ expect( num ).to be >= 0.0
139
+ expect( num ).to be < 1.0
140
140
  end
141
141
  end
142
142
 
143
143
  it "should return a different Float each time (with high probability) " do
144
- Set[ *(1..100).map{ pool.rand } ].size.should == 100
144
+ expect( Set[ *(1..100).map{ pool.rand } ].size ).to eql 100
145
145
  end
146
146
  end
147
147
 
@@ -149,27 +149,27 @@ describe PoolOfEntropy do
149
149
  it "should call PoolOfEntropy::CorePRNG::read_bytes internally" do
150
150
  allow_any_instance_of( PoolOfEntropy::CorePRNG).
151
151
  to receive( :read_bytes ).and_return( "\x1e\xfe" * 8 )
152
- 20.times { pool.rand(20).should == 2 }
152
+ 20.times { expect( pool.rand(20) ).to eql 2 }
153
153
  end
154
154
 
155
155
  it "should return an Integer between 0 and x (excluding x)" do
156
156
  [ 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 ].each do |x|
157
157
  100.times do
158
158
  num = pool.rand( x )
159
- num.should be_a Fixnum
160
- num.should >= 0
161
- num.should < x
159
+ expect( num ).to be_a Fixnum
160
+ expect( num ).to be >= 0
161
+ expect( num ).to be < x
162
162
  end
163
163
  end
164
164
  end
165
165
 
166
166
  # This is a very weak test of randomness, see DIEHARDER_TEST.md
167
167
  it "should select values without obvious bias" do
168
- Set[ *(1..200).map{ pool.rand( 20 ) } ].size.should == 20
168
+ expect( Set[ *(1..200).map{ pool.rand( 20 ) } ].size ).to eql 20
169
169
  end
170
170
 
171
171
  it "should return a different Integer each time (with high probability for large x) " do
172
- Set[ *(1..100).map{ pool.rand( 2**64 ) } ].size.should == 100
172
+ expect( Set[ *(1..100).map{ pool.rand( 2**64 ) } ].size ).to eql 100
173
173
  end
174
174
  end
175
175
 
@@ -177,22 +177,22 @@ describe PoolOfEntropy do
177
177
  it "should call PoolOfEntropy::CorePRNG::read_bytes internally" do
178
178
  allow_any_instance_of( PoolOfEntropy::CorePRNG).
179
179
  to receive( :read_bytes ).and_return( "\x1e\xfe" * 8 )
180
- 20.times { pool.rand( 7..28 ).should == 9 }
180
+ 20.times { expect( pool.rand( 7..28 ) ).to eql 9 }
181
181
  end
182
182
 
183
183
  it "should return an Integer that is a member of the range" do
184
184
  [ 1..2, 2..5, 3..8, 5..13, 21..34, 55..89 ].each do |r|
185
185
  100.times do
186
186
  num = pool.rand( r )
187
- num.should be_a Fixnum
188
- num.should >= r.min
189
- num.should <= r.max
187
+ expect( num ).to be_a Fixnum
188
+ expect( num ).to be >= r.min
189
+ expect( num ).to be <= r.max
190
190
  end
191
191
  end
192
192
  end
193
193
 
194
194
  it "should return a different Integer each time (with high probability for large range) " do
195
- Set[ *(1..100).map{ pool.rand( 100000000000..200000000000 ) } ].size.should == 100
195
+ expect( Set[ *(1..100).map{ pool.rand( 100000000000..200000000000 ) } ].size ).to eql 100
196
196
  end
197
197
 
198
198
  end
@@ -205,7 +205,7 @@ describe PoolOfEntropy do
205
205
  pool_copy = pool.clone
206
206
  100.times do
207
207
  modifier = SecureRandom.hex
208
- pool_copy.modify_next( modifier ).rand.should_not == pool.rand
208
+ expect( pool_copy.modify_next( modifier ).rand ).to_not eql pool.rand
209
209
  end
210
210
  end
211
211
 
@@ -213,7 +213,7 @@ describe PoolOfEntropy do
213
213
  pool_copy = pool.clone
214
214
  100.times do
215
215
  modifier = SecureRandom.hex
216
- pool_copy.modify_next( modifier ).rand.should == pool.modify_next( modifier ).rand
216
+ expect( pool_copy.modify_next( modifier ).rand ).to eql pool.modify_next( modifier ).rand
217
217
  end
218
218
  end
219
219
 
@@ -221,8 +221,8 @@ describe PoolOfEntropy do
221
221
  pool_copy = pool.clone
222
222
  100.times do
223
223
  modifier = SecureRandom.hex
224
- pool_copy.modify_next( modifier ).rand.should_not == pool.rand
225
- pool_copy.rand.should == pool.rand
224
+ expect( pool_copy.modify_next( modifier ).rand ).to_not eql pool.rand
225
+ expect( pool_copy.rand ).to eql pool.rand
226
226
  end
227
227
  end
228
228
 
@@ -234,20 +234,20 @@ describe PoolOfEntropy do
234
234
  # Syntax for all-at-once
235
235
  pool_copy.modify_next( *modifiers )
236
236
  modifiers.each do |modifier|
237
- pool_copy.rand.should == pool.modify_next( modifier ).rand
237
+ expect( pool_copy.rand ).to eql pool.modify_next( modifier ).rand
238
238
  end
239
239
  # Assert we're back in sync without modifiers
240
- pool_copy.rand.should == pool.rand
240
+ expect( pool_copy.rand ).to eql pool.rand
241
241
 
242
242
  # Adding to queue one-at-a-time
243
243
  modifiers.each do |modifier|
244
244
  pool_copy.modify_next( modifier )
245
245
  end
246
246
  modifiers.each do |modifier|
247
- pool_copy.rand.should == pool.modify_next( modifier ).rand
247
+ expect( pool_copy.rand ).to eql pool.modify_next( modifier ).rand
248
248
  end
249
249
  # Assert we're back in sync without modifiers
250
- pool_copy.rand.should == pool.rand
250
+ expect( pool_copy.rand ).to eql pool.rand
251
251
  end
252
252
  end
253
253
 
@@ -255,11 +255,11 @@ describe PoolOfEntropy do
255
255
  pool_copy = pool.clone
256
256
  10.times do
257
257
  pool_copy.modify_next( 'hello', nil, 'goodbye' )
258
- pool_copy.rand.should_not == pool.rand
259
- pool_copy.rand.should == pool.rand
260
- pool_copy.rand.should_not == pool.rand
261
- pool_copy.rand.should == pool.rand
262
- pool_copy.rand.should == pool.rand
258
+ expect( pool_copy.rand ).to_not eql pool.rand
259
+ expect( pool_copy.rand ).to eql pool.rand
260
+ expect( pool_copy.rand ).to_not eql pool.rand
261
+ expect( pool_copy.rand ).to eql pool.rand
262
+ expect( pool_copy.rand ).to eql pool.rand
263
263
  end
264
264
  end
265
265
  end # modify_next
@@ -269,9 +269,9 @@ describe PoolOfEntropy do
269
269
  pool_copy = pool.clone
270
270
  10.times do
271
271
  modifier = SecureRandom.hex
272
- pool_copy.modify_all( modifier ).rand.should_not == pool.rand
272
+ expect( pool_copy.modify_all( modifier ).rand ).to_not eql pool.rand
273
273
  10.times do
274
- pool_copy.rand.should_not == pool.rand
274
+ expect( pool_copy.rand ).to_not eql pool.rand
275
275
  end
276
276
  end
277
277
  end
@@ -280,9 +280,9 @@ describe PoolOfEntropy do
280
280
  pool_copy = pool.clone
281
281
  10.times do
282
282
  modifier = SecureRandom.hex
283
- pool_copy.modify_all( modifier ).rand.should == pool.modify_all( modifier ).rand
283
+ expect( pool_copy.modify_all( modifier ).rand ).to eql pool.modify_all( modifier ).rand
284
284
  10.times do
285
- pool_copy.rand.should == pool.rand
285
+ expect( pool_copy.rand ).to eql pool.rand
286
286
  end
287
287
  end
288
288
  end
@@ -291,7 +291,7 @@ describe PoolOfEntropy do
291
291
  pool_copy = pool.clone
292
292
  100.times do
293
293
  modifier = SecureRandom.hex
294
- pool_copy.modify_all( modifier ).rand.should == pool.modify_next( modifier ).rand
294
+ expect( pool_copy.modify_all( modifier ).rand ).to eql pool.modify_next( modifier ).rand
295
295
  end
296
296
  end
297
297
 
@@ -299,11 +299,11 @@ describe PoolOfEntropy do
299
299
  pool_copy = pool.clone
300
300
  10.times do
301
301
  modifier = SecureRandom.hex
302
- pool_copy.modify_all( modifier ).rand.should_not == pool.rand
303
- pool_copy.rand.should_not == pool.rand
302
+ expect( pool_copy.modify_all( modifier ).rand ).to_not eql pool.rand
303
+ expect( pool_copy.rand ).to_not eql pool.rand
304
304
  pool_copy.modify_all( nil )
305
305
  10.times do
306
- pool_copy.rand.should == pool.rand
306
+ expect( pool_copy.rand ).to eql pool.rand
307
307
  end
308
308
  end
309
309
  end
@@ -317,10 +317,10 @@ describe PoolOfEntropy do
317
317
  10.times do
318
318
  modifiers = (0..5).map { SecureRandom.hex }
319
319
  pool_copy.modify_next( *modifiers )
320
- pool_copy.rand.should_not == pool.rand
320
+ expect( pool_copy.rand ).to_not eql pool.rand
321
321
  pool_copy.clear_all_modifiers
322
322
  10.times do
323
- pool_copy.rand.should == pool.rand
323
+ expect( pool_copy.rand ).to eql pool.rand
324
324
  end
325
325
  end
326
326
  end
@@ -329,11 +329,11 @@ describe PoolOfEntropy do
329
329
  pool_copy = pool.clone
330
330
  10.times do
331
331
  modifier = SecureRandom.hex
332
- pool_copy.modify_all( modifier ).rand.should_not == pool.rand
333
- pool_copy.rand.should_not == pool.rand
332
+ expect( pool_copy.modify_all( modifier ).rand ).to_not eql pool.rand
333
+ expect( pool_copy.rand ).to_not eql pool.rand
334
334
  pool_copy.clear_all_modifiers
335
335
  10.times do
336
- pool_copy.rand.should == pool.rand
336
+ expect( pool_copy.rand ).to eql pool.rand
337
337
  end
338
338
  end
339
339
  end
@@ -343,11 +343,11 @@ describe PoolOfEntropy do
343
343
  10.times do
344
344
  modifier = SecureRandom.hex
345
345
  pool_copy.modify_next( *(0..5).map { SecureRandom.hex } )
346
- pool_copy.modify_all( modifier ).rand.should_not == pool.rand
347
- pool_copy.rand.should_not == pool.rand
346
+ expect( pool_copy.modify_all( modifier ).rand ).to_not eql pool.rand
347
+ expect( pool_copy.rand ).to_not eql pool.rand
348
348
  pool_copy.clear_all_modifiers
349
349
  10.times do
350
- pool_copy.rand.should == pool.rand
350
+ expect( pool_copy.rand ).to eql pool.rand
351
351
  end
352
352
  end
353
353
  end
@@ -359,7 +359,7 @@ describe PoolOfEntropy do
359
359
  pool_copy = pool.clone
360
360
  pool_copy.add_to_pool( 'Some user data!' )
361
361
  100.times do
362
- pool_copy.rand.should_not == pool.rand
362
+ expect( pool_copy.rand ).to_not eql pool.rand
363
363
  end
364
364
  end
365
365
 
@@ -372,7 +372,7 @@ describe PoolOfEntropy do
372
372
  pool.add_to_pool( user_data )
373
373
 
374
374
  10.times do
375
- pool_copy.rand.should == pool.rand
375
+ expect( pool_copy.rand ).to eql pool.rand
376
376
  end
377
377
  end
378
378
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pool_of_entropy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Slater
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2015-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard