Skip to content

Add ImHashMap defect repro tests#63

Open
dzmitry-lahoda wants to merge 1 commit intodadhi:masterfrom
dzmitry-lahoda-forks:dz/imhashmap-defect-repros
Open

Add ImHashMap defect repro tests#63
dzmitry-lahoda wants to merge 1 commit intodadhi:masterfrom
dzmitry-lahoda-forks:dz/imhashmap-defect-repros

Conversation

@dzmitry-lahoda
Copy link
Copy Markdown

Summary

Add focused repro tests for concrete ImHashMap and PartitionedHashMap defects found during audit.

Coverage added

  • custom partition counts smaller than 16 fail with default mask-based indexing
  • custom partition counts larger than 16 silently use only the first 16 partitions by default
  • concurrent PartitionedHashMap.AddOrKeep can overwrite on CAS retry
  • BuildFromDifferent rejects same-hash distinct keys despite the current API contract mentioning only key uniqueness
  • BuildUnchecked(IEnumerable<HKV<...>>) does not dispose the source enumerator
  • BuildUnchecked<int, V> produces entries incompatible with int-specialized accessors

Validation

  • dotnet test test/ImTools.UnitTests/ImTools.UnitTests.csproj -p:CILinux=true -f net11.0 --filter "Custom_partition_count_smaller_than_16_breaks_default_operations|Custom_partition_count_larger_than_16_still_uses_only_first_16_partitions_by_default|Concurrent_AddOrKeep_may_overwrite_existing_value_after_compare_exchange_retry|BuildFromDifferent_rejects_distinct_keys_with_the_same_hash_even_though_the_api_mentions_only_key_uniqueness|BuildUnchecked_does_not_dispose_source_enumerator|BuildUnchecked_with_int_keys_creates_entries_incompatible_with_int_specialized_accessors"
  • dotnet test test/ImTools.UnitTests/ImTools.UnitTests.csproj -p:CILinux=true -f net11.0 --filter "ImHashMapTests|PartitionedHashMapTests"

@dzmitry-lahoda
Copy link
Copy Markdown
Author

AI generated, seems at least 2 legit

@dadhi
Copy link
Copy Markdown
Owner

dadhi commented Apr 3, 2026

I see :) I will check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants