Repository navigation
add adverbial coverage - #1297
Closed
Asekhame wants to merge 1 commit into
Closed
add adverbial coverage #1297Asekhame wants to merge 1 commit into
Asekhame wants to merge 1 commit into
Conversation
…g#1099) Add src/test_get_blacklist_adversarial.rs with 17 focused tests covering every observable behaviour of get_blacklist(issuer, namespace, token): - Returns empty Vec for unknown (issuer, namespace, token) triple (no panic) - Returns empty Vec after offering registration before any add - Single-entry round-trip - Insertion order (FIFO) preserved across multiple adds - Idempotent add: duplicate address does not appear twice in the order vec - Remove from head, middle, and tail with correct order reconstruction - Remove of non-existent address is a safe no-op (list unchanged) - Add → remove → re-add cycle: re-added address lands at tail - Cross-token isolation: distinct tokens have independent BlacklistOrder keys - Cross-namespace isolation: distinct namespaces have independent keys - Cross-issuer isolation: distinct issuers have independent keys - Consistency with is_blacklisted: every entry in the vec returns true - Consistency with get_blacklist_size: vec len == map size at every step - Empty vec (not error) after all entries are removed - Large list (30 entries): all present, insertion order preserved Wire-up: add #[cfg(test)] mod test_get_blacklist_adversarial; in lib.rs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#1099
Summary
Adds
test_get_blacklist_adversarial.rs
with 17 focused tests covering every observable behaviour of get_blacklist(issuer, namespace, token). Wires the module into lib.rs via #[cfg(test)] mod test_get_blacklist_adversarial;.
What was tested
Scenario Invariant
1 Unknown (issuer, namespace, token) Returns empty Vec, no panic
2 Registered offering, no entries yet Returns empty Vec before first add
3 Single entry Exact address returned
4 Multiple entries FIFO insertion order preserved
5 Idempotent add (same address twice) No duplicate in order vec
6–8 Remove from head / middle / tail Remaining entries preserve relative order
9 Remove non-existent address Safe no-op, list unchanged
10 Add → remove → re-add cycle Re-added address appears at tail
11 Cross-token isolation Distinct tokens have independent BlacklistOrder keys
12 Cross-namespace isolation Distinct namespaces have independent keys
13 Cross-issuer isolation Distinct issuers have independent keys
14 Consistency with is_blacklisted Every address in the vec returns true
15 Consistency with get_blacklist_size Vec len == map size at every mutation step
16 All entries removed Returns empty Vec, not an error
17 30-entry list All entries present, insertion order correct
Testing
cargo fmt --all -- --check — clean cargo test — our file contributes 0 errors; pre-existing failures in unrelated files are unchanged