@@ -11,7 +11,7 @@ fn assert_min_max_count<T: Counter, B: Borrow<Histogram<T>>>(hist: B) {
11
11
let mut min = None ;
12
12
let mut max = None ;
13
13
let mut total = 0 ;
14
- for i in 0 ..h. len ( ) {
14
+ for i in 0 ..h. distinct_values ( ) {
15
15
let value = h. value_for ( i) ;
16
16
let count = h. count_at ( value) ;
17
17
if count == T :: zero ( ) {
@@ -28,7 +28,7 @@ fn assert_min_max_count<T: Counter, B: Borrow<Histogram<T>>>(hist: B) {
28
28
29
29
assert_eq ! ( min, h. min( ) ) ;
30
30
assert_eq ! ( max, h. max( ) ) ;
31
- assert_eq ! ( total, h. count ( ) ) ;
31
+ assert_eq ! ( total, h. len ( ) ) ;
32
32
}
33
33
34
34
#[ test]
@@ -44,17 +44,17 @@ fn subtract_after_add() {
44
44
h1. add ( & h2) . unwrap ( ) ;
45
45
assert_eq ! ( h1. count_at( TEST_VALUE_LEVEL ) , 2 ) ;
46
46
assert_eq ! ( h1. count_at( 1000 * TEST_VALUE_LEVEL ) , 2 ) ;
47
- assert_eq ! ( h1. count ( ) , 4 ) ;
47
+ assert_eq ! ( h1. len ( ) , 4 ) ;
48
48
49
49
h1 += & h2;
50
50
assert_eq ! ( h1. count_at( TEST_VALUE_LEVEL ) , 3 ) ;
51
51
assert_eq ! ( h1. count_at( 1000 * TEST_VALUE_LEVEL ) , 3 ) ;
52
- assert_eq ! ( h1. count ( ) , 6 ) ;
52
+ assert_eq ! ( h1. len ( ) , 6 ) ;
53
53
54
54
h1. subtract ( & h2) . unwrap ( ) ;
55
55
assert_eq ! ( h1. count_at( TEST_VALUE_LEVEL ) , 2 ) ;
56
56
assert_eq ! ( h1. count_at( 1000 * TEST_VALUE_LEVEL ) , 2 ) ;
57
- assert_eq ! ( h1. count ( ) , 4 ) ;
57
+ assert_eq ! ( h1. len ( ) , 4 ) ;
58
58
59
59
assert_min_max_count ( h1) ;
60
60
assert_min_max_count ( h2) ;
@@ -69,13 +69,13 @@ fn subtract_to_zero_counts() {
69
69
70
70
assert_eq ! ( h1. count_at( TEST_VALUE_LEVEL ) , 1 ) ;
71
71
assert_eq ! ( h1. count_at( 1000 * TEST_VALUE_LEVEL ) , 1 ) ;
72
- assert_eq ! ( h1. count ( ) , 2 ) ;
72
+ assert_eq ! ( h1. len ( ) , 2 ) ;
73
73
74
74
let clone = h1. clone ( ) ;
75
75
h1. subtract ( & clone) . unwrap ( ) ;
76
76
assert_eq ! ( h1. count_at( TEST_VALUE_LEVEL ) , 0 ) ;
77
77
assert_eq ! ( h1. count_at( 1000 * TEST_VALUE_LEVEL ) , 0 ) ;
78
- assert_eq ! ( h1. count ( ) , 0 ) ;
78
+ assert_eq ! ( h1. len ( ) , 0 ) ;
79
79
80
80
assert_min_max_count ( h1) ;
81
81
}
@@ -141,14 +141,14 @@ fn subtract_values_inside_minuend_range_works() {
141
141
assert_eq ! ( big. count_at( TEST_VALUE_LEVEL ) , 3 ) ;
142
142
assert_eq ! ( big. count_at( 1000 * TEST_VALUE_LEVEL ) , 3 ) ;
143
143
assert_eq ! ( big. count_at( 2 * max) , 3 ) ; // overflow smaller hist...
144
- assert_eq ! ( big. count ( ) , 9 ) ;
144
+ assert_eq ! ( big. len ( ) , 9 ) ;
145
145
146
146
// Subtracting the smaller histogram from the bigger one should work:
147
147
big -= & h1;
148
148
assert_eq ! ( big. count_at( TEST_VALUE_LEVEL ) , 2 ) ;
149
149
assert_eq ! ( big. count_at( 1000 * TEST_VALUE_LEVEL ) , 2 ) ;
150
150
assert_eq ! ( big. count_at( 2 * max) , 3 ) ; // overflow smaller hist...
151
- assert_eq ! ( big. count ( ) , 7 ) ;
151
+ assert_eq ! ( big. len ( ) , 7 ) ;
152
152
153
153
assert_min_max_count ( h1) ;
154
154
assert_min_max_count ( big) ;
@@ -172,7 +172,7 @@ fn subtract_values_strictly_inside_minuend_range_yields_same_min_max_no_restat()
172
172
173
173
assert_eq ! ( 1 , h1. min( ) ) ;
174
174
assert_eq ! ( 1000 , h1. max( ) ) ;
175
- assert_eq ! ( 2 , h1. count ( ) ) ;
175
+ assert_eq ! ( 2 , h1. len ( ) ) ;
176
176
177
177
assert_min_max_count ( h1) ;
178
178
assert_min_max_count ( h2) ;
@@ -340,7 +340,7 @@ fn subtract_values_minuend_saturated_total_recalculates_saturated() {
340
340
assert_eq ! ( 1 , h1. min( ) ) ;
341
341
assert_eq ! ( 1000 , h1. max( ) ) ;
342
342
// still saturated
343
- assert_eq ! ( u64 :: max_value( ) , h1. count ( ) ) ;
343
+ assert_eq ! ( u64 :: max_value( ) , h1. len ( ) ) ;
344
344
345
345
assert_min_max_count ( h1) ;
346
346
assert_min_max_count ( h2) ;
@@ -368,7 +368,7 @@ fn subtract_values_minuend_saturated_total_recalculates_not_saturated() {
368
368
assert_eq ! ( 1 , h1. min( ) ) ;
369
369
assert_eq ! ( 1000 , h1. max( ) ) ;
370
370
// not saturated
371
- assert_eq ! ( u64 :: max_value( ) / 16 * 15 , h1. count ( ) ) ;
371
+ assert_eq ! ( u64 :: max_value( ) / 16 * 15 , h1. len ( ) ) ;
372
372
373
373
assert_min_max_count ( h1) ;
374
374
assert_min_max_count ( h2) ;
0 commit comments