about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorStein Somers <git@steinsomers.be>2021-01-20 16:54:58 +0100
committerStein Somers <git@steinsomers.be>2021-02-21 19:06:46 +0100
commitd9daedd433c7e58e21f9edb693142af6d605d040 (patch)
tree0d914719cfa91965aa26ef1e094f1f98e360de57 /library/alloc/src
parent3e826bb11228508fbe749e594038d6727208aa94 (diff)
downloadrust-d9daedd433c7e58e21f9edb693142af6d605d040.tar.gz
rust-d9daedd433c7e58e21f9edb693142af6d605d040.zip
BTreeMap: correct tests for alternative choices of B
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/collections/btree/map/tests.rs5
-rw-r--r--library/alloc/src/collections/btree/node/tests.rs6
2 files changed, 6 insertions, 5 deletions
diff --git a/library/alloc/src/collections/btree/map/tests.rs b/library/alloc/src/collections/btree/map/tests.rs
index 56d6ae57e04..4e48db7f493 100644
--- a/library/alloc/src/collections/btree/map/tests.rs
+++ b/library/alloc/src/collections/btree/map/tests.rs
@@ -136,8 +136,9 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
     }
 }
 
-// Tests our value of MIN_INSERTS_HEIGHT_2. It may change according to the
-// implementation of insertion, but it's best to be aware of when it does.
+// Tests our value of MIN_INSERTS_HEIGHT_2. Failure may mean you just need to
+// adapt that value to match a change in node::CAPACITY or the choices made
+// during insertion, otherwise other test cases may fail or be less useful.
 #[test]
 fn test_levels() {
     let mut map = BTreeMap::new();
diff --git a/library/alloc/src/collections/btree/node/tests.rs b/library/alloc/src/collections/btree/node/tests.rs
index acb7210ca7c..6da93b19a8d 100644
--- a/library/alloc/src/collections/btree/node/tests.rs
+++ b/library/alloc/src/collections/btree/node/tests.rs
@@ -103,7 +103,7 @@ fn test_partial_cmp_eq() {
 #[cfg(target_arch = "x86_64")]
 fn test_sizes() {
     assert_eq!(core::mem::size_of::<LeafNode<(), ()>>(), 16);
-    assert_eq!(core::mem::size_of::<LeafNode<i64, i64>>(), 16 + CAPACITY * 8 * 2);
-    assert_eq!(core::mem::size_of::<InternalNode<(), ()>>(), 112);
-    assert_eq!(core::mem::size_of::<InternalNode<i64, i64>>(), 112 + CAPACITY * 8 * 2);
+    assert_eq!(core::mem::size_of::<LeafNode<i64, i64>>(), 16 + CAPACITY * 2 * 8);
+    assert_eq!(core::mem::size_of::<InternalNode<(), ()>>(), 16 + (CAPACITY + 1) * 8);
+    assert_eq!(core::mem::size_of::<InternalNode<i64, i64>>(), 16 + (CAPACITY * 3 + 1) * 8);
 }