@@ -13,11 +13,8 @@ fn test_simple() {
13
13
ret u;
14
14
}
15
15
16
- // FIXME we don't really want to bind here but if we don't then the
17
- // hashmap's drop glue UMRs when trying to drop these functions, which
18
- // it stores internally.
19
- let map. hashfn[ uint] hasher = bind hash ( _) ;
20
- let map. eqfn[ uint] eqer = bind eq( _, _) ;
16
+ let map. hashfn[ uint] hasher = hash;
17
+ let map. eqfn[ uint] eqer = eq;
21
18
let map. hashmap[ uint, uint] hm = map. mk_hashmap [ uint, uint] ( hasher, eqer) ;
22
19
23
20
hm. insert ( 10 u, 12 u) ;
@@ -43,7 +40,7 @@ fn test_simple() {
43
40
fn test_growth ( ) {
44
41
log "*** starting test_growth" ;
45
42
46
- let uint map_capacity = 64 u; // Keep in sync with map.mk_hashmap
43
+ let uint num_to_insert = 64 u;
47
44
48
45
fn eq ( & uint x, & uint y) -> bool { ret x == y; }
49
46
fn hash ( & uint u) -> uint {
@@ -52,13 +49,12 @@ fn test_growth() {
52
49
ret u;
53
50
}
54
51
55
- // FIXME: as in test_simple(), don't really want to bind.
56
- let map. hashfn[ uint] hasher = bind hash ( _) ;
57
- let map. eqfn[ uint] eqer = bind eq( _, _) ;
52
+ let map. hashfn[ uint] hasher = hash;
53
+ let map. eqfn[ uint] eqer = eq;
58
54
let map. hashmap[ uint, uint] hm = map. mk_hashmap [ uint, uint] ( hasher, eqer) ;
59
55
60
56
let uint i = 0 u;
61
- while ( i < map_capacity ) {
57
+ while ( i < num_to_insert ) {
62
58
hm. insert ( i, i * i) ;
63
59
log "inserting " + std. _uint . to_str ( i, 10 u)
64
60
+ " -> " + std. _uint . to_str ( i * i, 10 u) ;
@@ -68,22 +64,22 @@ fn test_growth() {
68
64
log "-----";
69
65
70
66
i = 0u;
71
- while (i < map_capacity ) {
67
+ while (i < num_to_insert ) {
72
68
log " get( " + std._uint.to_str(i, 10u) + " ) = "
73
69
+ std._uint.to_str(hm.get(i), 10u);
74
70
check (hm.get(i) == i * i);
75
71
i += 1u;
76
72
}
77
73
78
- hm.insert(map_capacity , 17u);
79
- check (hm.get(map_capacity ) == 17u);
74
+ hm.insert(num_to_insert , 17u);
75
+ check (hm.get(num_to_insert ) == 17u);
80
76
81
77
log " -----";
82
78
83
79
hm.rehash();
84
80
85
81
i = 0u;
86
- while (i < map_capacity ) {
82
+ while (i < num_to_insert ) {
87
83
log " get( " + std._uint.to_str(i, 10u) + " ) = "
88
84
+ std._uint.to_str(hm.get(i), 10u);
89
85
check (hm.get(i) == i * i);
0 commit comments