@@ -99,57 +99,57 @@ float_impls! { f32_rand_impls, f32, 23, next_f32 }
99
99
#[ cfg( test) ]
100
100
mod tests {
101
101
use Rng ;
102
- use mock:: MockAddRng ;
102
+ use mock:: StepRng ;
103
103
use distributions:: { Open01 , Closed01 } ;
104
104
105
105
const EPSILON32 : f32 = :: core:: f32:: EPSILON ;
106
106
const EPSILON64 : f64 = :: core:: f64:: EPSILON ;
107
107
108
108
#[ test]
109
109
fn floating_point_edge_cases ( ) {
110
- let mut zeros = MockAddRng :: new ( 0 , 0 ) ;
110
+ let mut zeros = StepRng :: new ( 0 , 0 ) ;
111
111
assert_eq ! ( zeros. gen :: <f32 >( ) , 0.0 ) ;
112
112
assert_eq ! ( zeros. gen :: <f64 >( ) , 0.0 ) ;
113
113
114
- let mut one = MockAddRng :: new ( 1 , 0 ) ;
114
+ let mut one = StepRng :: new ( 1 , 0 ) ;
115
115
assert_eq ! ( one. gen :: <f32 >( ) , EPSILON32 ) ;
116
116
assert_eq ! ( one. gen :: <f64 >( ) , EPSILON64 ) ;
117
117
118
- let mut max = MockAddRng :: new ( !0 , 0 ) ;
118
+ let mut max = StepRng :: new ( !0 , 0 ) ;
119
119
assert_eq ! ( max. gen :: <f32 >( ) , 1.0 - EPSILON32 ) ;
120
120
assert_eq ! ( max. gen :: <f64 >( ) , 1.0 - EPSILON64 ) ;
121
121
}
122
122
123
123
#[ test]
124
124
fn fp_closed_edge_cases ( ) {
125
- let mut zeros = MockAddRng :: new ( 0 , 0 ) ;
125
+ let mut zeros = StepRng :: new ( 0 , 0 ) ;
126
126
assert_eq ! ( zeros. sample:: <f32 , _>( Closed01 ) , 0.0 ) ;
127
127
assert_eq ! ( zeros. sample:: <f64 , _>( Closed01 ) , 0.0 ) ;
128
128
129
- let mut one = MockAddRng :: new ( 1 , 0 ) ;
129
+ let mut one = StepRng :: new ( 1 , 0 ) ;
130
130
let one32 = one. sample :: < f32 , _ > ( Closed01 ) ;
131
131
let one64 = one. sample :: < f64 , _ > ( Closed01 ) ;
132
132
assert ! ( EPSILON32 < one32 && one32 < EPSILON32 * 1.01 ) ;
133
133
assert ! ( EPSILON64 < one64 && one64 < EPSILON64 * 1.01 ) ;
134
134
135
- let mut max = MockAddRng :: new ( !0 , 0 ) ;
135
+ let mut max = StepRng :: new ( !0 , 0 ) ;
136
136
assert_eq ! ( max. sample:: <f32 , _>( Closed01 ) , 1.0 ) ;
137
137
assert_eq ! ( max. sample:: <f64 , _>( Closed01 ) , 1.0 ) ;
138
138
}
139
139
140
140
#[ test]
141
141
fn fp_open_edge_cases ( ) {
142
- let mut zeros = MockAddRng :: new ( 0 , 0 ) ;
142
+ let mut zeros = StepRng :: new ( 0 , 0 ) ;
143
143
assert_eq ! ( zeros. sample:: <f32 , _>( Open01 ) , 0.0 + EPSILON32 / 2.0 ) ;
144
144
assert_eq ! ( zeros. sample:: <f64 , _>( Open01 ) , 0.0 + EPSILON64 / 2.0 ) ;
145
145
146
- let mut one = MockAddRng :: new ( 1 , 0 ) ;
146
+ let mut one = StepRng :: new ( 1 , 0 ) ;
147
147
let one32 = one. sample :: < f32 , _ > ( Open01 ) ;
148
148
let one64 = one. sample :: < f64 , _ > ( Open01 ) ;
149
149
assert ! ( EPSILON32 < one32 && one32 < EPSILON32 * 2.0 ) ;
150
150
assert ! ( EPSILON64 < one64 && one64 < EPSILON64 * 2.0 ) ;
151
151
152
- let mut max = MockAddRng :: new ( !0 , 0 ) ;
152
+ let mut max = StepRng :: new ( !0 , 0 ) ;
153
153
assert_eq ! ( max. sample:: <f32 , _>( Open01 ) , 1.0 - EPSILON32 / 2.0 ) ;
154
154
assert_eq ! ( max. sample:: <f64 , _>( Open01 ) , 1.0 - EPSILON64 / 2.0 ) ;
155
155
}
0 commit comments