Skip to content

add adverbial coverage - #1297

Closed
Asekhame wants to merge 1 commit into
RevoraOrg:masterfrom
Asekhame:Revora-contract
Closed

Asekhame wants to merge 1 commit into
RevoraOrg:masterfrom
Asekhame:Revora-contract

Conversation

@Asekhame

Copy link
Copy Markdown

#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

…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.
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