1
+ use std:: collections:: { HashMap , HashSet } ;
2
+
1
3
use super :: * ;
2
4
use ark_std:: {
3
5
collections:: { BTreeMap , BTreeSet , LinkedList , VecDeque } ,
@@ -8,7 +10,7 @@ use ark_std::{
8
10
} ;
9
11
use num_bigint:: BigUint ;
10
12
11
- #[ derive( Copy , Clone , Ord , PartialOrd , Eq , PartialEq , Debug ) ]
13
+ #[ derive( Copy , Clone , Ord , PartialOrd , Eq , PartialEq , Debug , Hash ) ]
12
14
struct Dummy ;
13
15
14
16
impl CanonicalSerialize for Dummy {
@@ -286,6 +288,31 @@ fn test_btreeset() {
286
288
test_serialize ( set) ;
287
289
}
288
290
291
+ #[ test]
292
+ #[ allow( clippy:: zero_sized_map_values) ]
293
+ fn test_hashmap ( ) {
294
+ let mut map = HashMap :: new ( ) ;
295
+ map. insert ( 0u64 , Dummy ) ;
296
+ map. insert ( 5u64 , Dummy ) ;
297
+ test_serialize ( map) ;
298
+ let mut map = BTreeMap :: new ( ) ;
299
+ map. insert ( 10u64 , vec ! [ 1u8 , 2u8 , 3u8 ] ) ;
300
+ map. insert ( 50u64 , vec ! [ 4u8 , 5u8 , 6u8 ] ) ;
301
+ test_serialize ( map) ;
302
+ }
303
+
304
+ #[ test]
305
+ fn test_hashset ( ) {
306
+ let mut set = HashSet :: new ( ) ;
307
+ set. insert ( Dummy ) ;
308
+ set. insert ( Dummy ) ;
309
+ test_serialize ( set) ;
310
+ let mut set = BTreeSet :: new ( ) ;
311
+ set. insert ( vec ! [ 1u8 , 2u8 , 3u8 ] ) ;
312
+ set. insert ( vec ! [ 4u8 , 5u8 , 6u8 ] ) ;
313
+ test_serialize ( set) ;
314
+ }
315
+
289
316
#[ test]
290
317
fn test_phantomdata ( ) {
291
318
test_serialize ( core:: marker:: PhantomData :: < Dummy > ) ;
0 commit comments