@@ -13,37 +13,37 @@ mod xxhash32 {
13
13
14
14
proptest ! {
15
15
#[ test]
16
- fn oneshot_same_as_one_chunk( seed: u32 , data: Vec <u8 >) {
16
+ fn oneshot_same_as_one_chunk( seed in seed_32 ( ) , data: Vec <u8 >) {
17
17
oneshot_same_as_one_chunk_impl( seed, & data) ?;
18
18
}
19
19
20
20
#[ test]
21
- fn oneshot_same_as_one_chunk_with_an_offset( seed: u32 , ( data, offset) in vec_and_index( ) ) {
21
+ fn oneshot_same_as_one_chunk_with_an_offset( seed in seed_32 ( ) , ( data, offset) in vec_and_index( ) ) {
22
22
oneshot_same_as_one_chunk_impl( seed, & data[ offset..] ) ?;
23
23
}
24
24
25
25
#[ test]
26
- fn oneshot_same_as_many_chunks( seed: u32 , ( data, chunks) in data_and_chunks( ) ) {
26
+ fn oneshot_same_as_many_chunks( seed in seed_32 ( ) , ( data, chunks) in data_and_chunks( ) ) {
27
27
oneshot_same_as_many_chunks_impl( seed, & data, & chunks) ?;
28
28
}
29
29
30
30
#[ test]
31
- fn oneshot( seed: u32 , data: Vec <u8 >) {
31
+ fn oneshot( seed in seed_32 ( ) , data: Vec <u8 >) {
32
32
oneshot_impl( seed, & data) ?;
33
33
}
34
34
35
35
#[ test]
36
- fn oneshot_with_an_offset( seed: u32 , ( data, offset) in vec_and_index( ) ) {
36
+ fn oneshot_with_an_offset( seed in seed_32 ( ) , ( data, offset) in vec_and_index( ) ) {
37
37
oneshot_impl( seed, & data[ offset..] ) ?;
38
38
}
39
39
40
40
#[ test]
41
- fn streaming_one_chunk( seed: u32 , data: Vec <u8 >) {
41
+ fn streaming_one_chunk( seed in seed_32 ( ) , data: Vec <u8 >) {
42
42
streaming_one_chunk_impl( seed, & data) ?;
43
43
}
44
44
45
45
#[ test]
46
- fn streaming_one_chunk_with_an_offset( seed: u32 , ( data, offset) in vec_and_index( ) ) {
46
+ fn streaming_one_chunk_with_an_offset( seed in seed_32 ( ) , ( data, offset) in vec_and_index( ) ) {
47
47
streaming_one_chunk_impl( seed, & data[ offset..] ) ?;
48
48
}
49
49
}
@@ -112,37 +112,37 @@ mod xxhash64 {
112
112
113
113
proptest ! {
114
114
#[ test]
115
- fn oneshot_same_as_one_chunk( seed: u64 , data: Vec <u8 >) {
115
+ fn oneshot_same_as_one_chunk( seed in seed_64 ( ) , data: Vec <u8 >) {
116
116
oneshot_same_as_one_chunk_impl( seed, & data) ?;
117
117
}
118
118
119
119
#[ test]
120
- fn oneshot_same_as_one_chunk_with_an_offset( seed: u64 , ( data, offset) in vec_and_index( ) ) {
120
+ fn oneshot_same_as_one_chunk_with_an_offset( seed in seed_64 ( ) , ( data, offset) in vec_and_index( ) ) {
121
121
oneshot_same_as_one_chunk_impl( seed, & data[ offset..] ) ?;
122
122
}
123
123
124
124
#[ test]
125
- fn oneshot_same_as_many_chunks( seed: u64 , ( data, chunks) in data_and_chunks( ) ) {
125
+ fn oneshot_same_as_many_chunks( seed in seed_64 ( ) , ( data, chunks) in data_and_chunks( ) ) {
126
126
oneshot_same_as_many_chunks_impl( seed, & data, & chunks) ?;
127
127
}
128
128
129
129
#[ test]
130
- fn oneshot( seed: u64 , data: Vec <u8 >) {
130
+ fn oneshot( seed in seed_64 ( ) , data: Vec <u8 >) {
131
131
oneshot_impl( seed, & data) ?;
132
132
}
133
133
134
134
#[ test]
135
- fn oneshot_with_an_offset( seed: u64 , ( data, offset) in vec_and_index( ) ) {
135
+ fn oneshot_with_an_offset( seed in seed_64 ( ) , ( data, offset) in vec_and_index( ) ) {
136
136
oneshot_impl( seed, & data[ offset..] ) ?;
137
137
}
138
138
139
139
#[ test]
140
- fn streaming_one_chunk( seed: u64 , data: Vec <u8 >) {
140
+ fn streaming_one_chunk( seed in seed_64 ( ) , data: Vec <u8 >) {
141
141
streaming_one_chunk_impl( seed, & data) ?;
142
142
}
143
143
144
144
#[ test]
145
- fn streaming_one_chunk_with_an_offset( seed: u64 , ( data, offset) in vec_and_index( ) ) {
145
+ fn streaming_one_chunk_with_an_offset( seed in seed_64 ( ) , ( data, offset) in vec_and_index( ) ) {
146
146
streaming_one_chunk_impl( seed, & data[ offset..] ) ?;
147
147
}
148
148
}
@@ -212,27 +212,27 @@ mod xxhash3_64 {
212
212
213
213
proptest ! {
214
214
#[ test]
215
- fn oneshot_same_as_one_chunk( seed: u64 , data: Vec <u8 >) {
215
+ fn oneshot_same_as_one_chunk( seed in seed_64 ( ) , data: Vec <u8 >) {
216
216
oneshot_same_as_one_chunk_impl( seed, & data) ?;
217
217
}
218
218
219
219
#[ test]
220
- fn oneshot_same_as_one_chunk_with_an_offset( seed: u64 , ( data, offset) in vec_and_index( ) ) {
220
+ fn oneshot_same_as_one_chunk_with_an_offset( seed in seed_64 ( ) , ( data, offset) in vec_and_index( ) ) {
221
221
oneshot_same_as_one_chunk_impl( seed, & data[ offset..] ) ?;
222
222
}
223
223
224
224
#[ test]
225
- fn oneshot_same_as_many_chunks( seed: u64 , ( data, chunks) in data_and_chunks( ) ) {
225
+ fn oneshot_same_as_many_chunks( seed in seed_64 ( ) , ( data, chunks) in data_and_chunks( ) ) {
226
226
oneshot_same_as_many_chunks_impl( seed, & data, & chunks) ?;
227
227
}
228
228
229
229
#[ test]
230
- fn oneshot( seed: u64 , data: Vec <u8 >) {
230
+ fn oneshot( seed in seed_64 ( ) , data: Vec <u8 >) {
231
231
oneshot_impl( seed, & data) ?;
232
232
}
233
233
234
234
#[ test]
235
- fn oneshot_with_an_offset( seed: u64 , ( data, offset) in vec_and_index( ) ) {
235
+ fn oneshot_with_an_offset( seed in seed_64 ( ) , ( data, offset) in vec_and_index( ) ) {
236
236
oneshot_impl( seed, & data[ offset..] ) ?;
237
237
}
238
238
@@ -242,22 +242,22 @@ mod xxhash3_64 {
242
242
}
243
243
244
244
#[ test]
245
- fn oneshot_with_a_seed_and_secret( seed: u64 , secret in secret( ) , data: Vec <u8 >) {
245
+ fn oneshot_with_a_seed_and_secret( seed in seed_64 ( ) , secret in secret( ) , data: Vec <u8 >) {
246
246
oneshot_with_seed_and_secret_impl( seed, & secret, & data) ?;
247
247
}
248
248
249
249
#[ test]
250
- fn streaming_one_chunk( seed: u64 , data: Vec <u8 >) {
250
+ fn streaming_one_chunk( seed in seed_64 ( ) , data: Vec <u8 >) {
251
251
streaming_one_chunk_impl( seed, & data) ?;
252
252
}
253
253
254
254
#[ test]
255
- fn streaming_one_chunk_with_an_offset( seed: u64 , ( data, offset) in vec_and_index( ) ) {
255
+ fn streaming_one_chunk_with_an_offset( seed in seed_64 ( ) , ( data, offset) in vec_and_index( ) ) {
256
256
streaming_one_chunk_impl( seed, & data[ offset..] ) ?;
257
257
}
258
258
259
259
#[ test]
260
- fn streaming_with_a_seed_and_secret( seed: u64 , secret in secret( ) , data: Vec <u8 >) {
260
+ fn streaming_with_a_seed_and_secret( seed in seed_64 ( ) , secret in secret( ) , data: Vec <u8 >) {
261
261
streaming_with_seed_and_secret_impl( seed, & secret, & data) ?;
262
262
}
263
263
}
@@ -363,6 +363,14 @@ mod xxhash3_64 {
363
363
}
364
364
}
365
365
366
+ fn seed_32 ( ) -> impl Strategy < Value = u32 > {
367
+ prop_oneof ! [ Just ( 0 ) , Just ( u32 :: MAX ) , num:: u32 :: ANY ]
368
+ }
369
+
370
+ fn seed_64 ( ) -> impl Strategy < Value = u64 > {
371
+ prop_oneof ! [ Just ( 0 ) , Just ( u64 :: MAX ) , num:: u64 :: ANY ]
372
+ }
373
+
366
374
fn vec_and_index ( ) -> impl Strategy < Value = ( Vec < u8 > , usize ) > {
367
375
prop:: collection:: vec ( num:: u8:: ANY , 0 ..=32 * 1024 ) . prop_flat_map ( |vec| {
368
376
let len = vec. len ( ) ;
0 commit comments