@@ -439,11 +439,10 @@ impl<R: BlockRngCore + CryptoRng> CryptoRng for BlockRng<R> {}
439
439
mod test {
440
440
use crate :: { SeedableRng , RngCore } ;
441
441
use crate :: block:: { BlockRng , BlockRng64 , BlockRngCore } ;
442
- use crate :: mock:: StepRng ;
443
442
444
443
#[ derive( Debug , Clone ) ]
445
444
struct DummyRng {
446
- rng : StepRng ,
445
+ counter : u32 ,
447
446
}
448
447
449
448
impl BlockRngCore for DummyRng {
@@ -453,16 +452,17 @@ mod test {
453
452
454
453
fn generate ( & mut self , results : & mut Self :: Results ) {
455
454
for r in results {
456
- * r = self . rng . next_u32 ( ) ;
455
+ * r = self . counter ;
456
+ self . counter += 1 ;
457
457
}
458
458
}
459
459
}
460
460
461
461
impl SeedableRng for DummyRng {
462
- type Seed = [ u8 ; 8 ] ;
462
+ type Seed = [ u8 ; 4 ] ;
463
463
464
464
fn from_seed ( seed : Self :: Seed ) -> Self {
465
- DummyRng { rng : StepRng :: new ( u64 :: from_le_bytes ( seed) , 1 ) }
465
+ DummyRng { counter : u32 :: from_le_bytes ( seed) }
466
466
}
467
467
}
468
468
@@ -492,7 +492,7 @@ mod test {
492
492
493
493
#[ derive( Debug , Clone ) ]
494
494
struct DummyRng64 {
495
- rng : StepRng ,
495
+ counter : u64 ,
496
496
}
497
497
498
498
impl BlockRngCore for DummyRng64 {
@@ -502,7 +502,8 @@ mod test {
502
502
503
503
fn generate ( & mut self , results : & mut Self :: Results ) {
504
504
for r in results {
505
- * r = self . rng . next_u64 ( ) ;
505
+ * r = self . counter ;
506
+ self . counter += 1 ;
506
507
}
507
508
}
508
509
}
@@ -511,7 +512,7 @@ mod test {
511
512
type Seed = [ u8 ; 8 ] ;
512
513
513
514
fn from_seed ( seed : Self :: Seed ) -> Self {
514
- DummyRng64 { rng : StepRng :: new ( u64:: from_le_bytes ( seed) , 1 ) }
515
+ DummyRng64 { counter : u64:: from_le_bytes ( seed) }
515
516
}
516
517
}
517
518
0 commit comments