Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Taillefer committed Dec 4, 2024
1 parent a000226 commit b5b98c9
Showing 1 changed file with 125 additions and 14 deletions.
139 changes: 125 additions & 14 deletions frozen-collections/tests/hash_macro_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,18 +373,129 @@ fn hash_usize() {

#[test]
fn hash_string() {
test_hash!(&str, "0");
test_hash!(&str, "0", "1");
test_hash!(&str, "0", "1", "2");
test_hash!(&str, "0", "1", "2", "3");
test_hash!(&str, "0", "1", "2", "3", "4");
test_hash!(&str, "0", "1", "2", "3", "4", "5");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13");
/*
test_hash!(&str, "0");
test_hash!(&str, "0", "1");
test_hash!(&str, "0", "1", "2");
test_hash!(&str, "0", "1", "2", "3");
test_hash!(&str, "0", "1", "2", "3", "4");
test_hash!(&str, "0", "1", "2", "3", "4", "5");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");
test_hash!(&str, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13");
*/

let s0 = ::frozen_collections::inline_sets::InlineHashSet::<
_,
5,
16,
::frozen_collections::SmallCollection,
::frozen_collections::hashers::BridgeHasher<::frozen_collections::ahash::RandomState>,
>::new(::frozen_collections::inline_maps::InlineHashMap::<
_,
_,
5,
16,
::frozen_collections::SmallCollection,
::frozen_collections::hashers::BridgeHasher<::frozen_collections::ahash::RandomState>,
>::new_raw(
::frozen_collections::hash_tables::InlineHashTable::<
(_, _),
5,
16,
::frozen_collections::SmallCollection,
>::new_raw(
[
::frozen_collections::hash_tables::HashTableSlot::new(4, 5),
::frozen_collections::hash_tables::HashTableSlot::new(3, 4),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(2, 3),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(1, 2),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 1),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
],
[("0", ()), ("1", ()), ("4", ()), ("3", ()), ("2", ())],
),
::frozen_collections::hashers::BridgeHasher::new(
::frozen_collections::ahash::RandomState::with_seeds(
9584098910905393284u64,
15632693311588097570u64,
1813734937071665716u64,
6326412730285402181u64,
),
),
));

type Bar = ::frozen_collections::inline_sets::InlineHashSet<
&'static str,
5,
16,
::frozen_collections::SmallCollection,
::frozen_collections::hashers::BridgeHasher<::frozen_collections::ahash::RandomState>,
>;
let s4: Bar = ::frozen_collections::inline_sets::InlineHashSet::<
&'static str,
5,
16,
::frozen_collections::SmallCollection,
::frozen_collections::hashers::BridgeHasher<::frozen_collections::ahash::RandomState>,
>::new(::frozen_collections::inline_maps::InlineHashMap::<
&'static str,
_,
5,
16,
::frozen_collections::SmallCollection,
::frozen_collections::hashers::BridgeHasher<::frozen_collections::ahash::RandomState>,
>::new_raw(
::frozen_collections::hash_tables::InlineHashTable::<
(&'static str, _),
5,
16,
::frozen_collections::SmallCollection,
>::new_raw(
[
::frozen_collections::hash_tables::HashTableSlot::new(4, 5),
::frozen_collections::hash_tables::HashTableSlot::new(3, 4),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(2, 3),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(1, 2),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 1),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
::frozen_collections::hash_tables::HashTableSlot::new(0, 0),
],
[("0", ()), ("1", ()), ("4", ()), ("3", ()), ("2", ())],
),
::frozen_collections::hashers::BridgeHasher::new(
::frozen_collections::ahash::RandomState::with_seeds(
9584098910905393284u64,
15632693311588097570u64,
1813734937071665716u64,
6326412730285402181u64,
),
),
));

assert_eq!(s0, s4, "s0 vs s4");
}

0 comments on commit b5b98c9

Please sign in to comment.