This is an automated email from the ASF dual-hosted git repository.
tisonkun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datasketches-rust.git
The following commit(s) were added to refs/heads/main by this push:
new a69b238 test: for hll::Array4::shift_to_bigger_cur_min (#123)
a69b238 is described below
commit a69b2382d0f350af9caad699a911ac11f27837e1
Author: tison <[email protected]>
AuthorDate: Mon May 11 19:18:59 2026 +0800
test: for hll::Array4::shift_to_bigger_cur_min (#123)
Signed-off-by: tison <[email protected]>
---
datasketches/src/hll/array4.rs | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/datasketches/src/hll/array4.rs b/datasketches/src/hll/array4.rs
index f0f6132..f6bc879 100644
--- a/datasketches/src/hll/array4.rs
+++ b/datasketches/src/hll/array4.rs
@@ -503,4 +503,29 @@ mod tests {
"kxq1 should be small (1/2^40 is tiny)"
);
}
+
+ #[test]
+ fn test_shift_cur_min_rebuilds_aux_entry() {
+ let lg_config_k = 4;
+ let num_slots = 1_u32 << lg_config_k;
+ let mut arr = Array4::new(lg_config_k);
+
+ arr.update(Coupon::pack(0, 15));
+ assert_eq!(arr.get_raw(0), AUX_TOKEN);
+ assert_eq!(arr.aux_map.as_ref().and_then(|aux| aux.get(0)), Some(15));
+
+ for slot in 1..num_slots {
+ arr.update(Coupon::pack(slot, 1));
+ }
+
+ assert_eq!(arr.cur_min, 1);
+ assert_eq!(arr.num_at_cur_min, num_slots - 1);
+ assert_eq!(arr.get_raw(0), 14);
+ assert_eq!(arr.get(0), 15);
+ assert!(arr.aux_map.is_none());
+
+ for slot in 1..num_slots {
+ assert_eq!(arr.get(slot), 1);
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]