Fix for case where calling shrink_to_fit could make the map larger
Reproduced issue by adding new test shrink_to_fit_after_insert. Checked it was failing before doing any changes
With the test in place fixes were:
Make CHashMap::reserve be the place the amortizing growth factor LENGTH_MULTIPLIER is applied, rather than Table::with_capacity ( non-CHashMap::reserve users of Table::with_capacity are requesting a specific capacity and just need load factor applied, not amortizing growth multiplier )
Apply load factor consistently in Table::with_capacity() vs CHashMap::capacity()
Apply MINIMUM_CAPACITY in CHashMap::capacity to stop reported capacity being below requested.
Add test known_size_with_capacity_matches_shrink to test the initial capacity+shrink case
Tested via cargo test