Skip to content

Addressing issues, cleaning up, adding tests dropping gulliver & refactoring like a boss#72

Closed
rheone wants to merge 20 commits into
sandialabs:mainfrom
rheone:addressingIssuesAddingTestsDroppingGulliverRefactorLikeABoss
Closed

Addressing issues, cleaning up, adding tests dropping gulliver & refactoring like a boss#72
rheone wants to merge 20 commits into
sandialabs:mainfrom
rheone:addressingIssuesAddingTestsDroppingGulliverRefactorLikeABoss

Conversation

@rheone

@rheone rheone commented Jun 5, 2026

Copy link
Copy Markdown
Member

No description provided.

rheone added 20 commits May 22, 2026 21:38
## Breaking Changes

### SubnetUtilities static fields are now readonly
`SubnetUtilities.PrivateIPAddressRangesList` and `LinkLocalIPAddressRangesList`
are now declared `readonly`. Any code that reassigned these field references
(e.g. `SubnetUtilities.PrivateIPAddressRangesList = myList`) will no longer
compile. The `IReadOnlyList<Subnet>` type already prevented content mutation;
`readonly` now also prevents reference replacement.

## Bug Fixes

### AbstractIPAddressRange.Overlaps — symmetry restored
`Overlaps(IIPAddressRange)` previously returned `false` when the argument range
was wholly contained inside `this`. Added `addressRange.Contains(this)` to the
check so the method is symmetric: `A.Overlaps(B) == B.Overlaps(A)` in all cases.
Bidirectional and Subnet-typed symmetry regression tests added.

### AbstractIPAddressRange — ContainsAnyPrivateAddresses / ContainsAllPublicAddresses
All four `ContainsAny/AllPrivate/PublicAddresses` methods previously used an
endpoint heuristic that produced wrong results when both endpoints of a range
were public but the interior spanned a private subnet (e.g. 11.0.0.0-173.0.0.0
spans 172.16.0.0/12). All four methods now independently use range-overlap
detection against `PrivateIPAddressRangesList`. Regression tests for the
spanning-block case and cross-method inverse-assertion tests added.

### IPAddressRange.TryExcludeAll — boundary guards at family min/max
All four unguarded `Increment`/`Increment(-1)` call sites are now guarded with
`IsAtMax`/`IsAtMin`. When an exclusion ends at the family maximum (e.g.
255.255.255.255) the method returns `(true, leading segment)` or `(true, [])`
instead of throwing `InvalidOperationException`. When an exclusion starts at the
family minimum the trailing-segment path is guarded symmetrically. Boundary
behavior is documented in XML remarks. Regression tests for IPv4 and IPv6
family-max/min exclusion cases added.

### MacAddress.IsUnusable — implementation corrected
`IsUnusable` previously used `Any(b != 0)` and returned `true` for almost every
real MAC address — the logical inverse of the documented contract. Fixed to
`All(b == 0)`: returns `true` only when all three OUI bytes are 0x00. All four
existing test cases have their expected values corrected with comments noting the
intentional behavioral fix.

## Additional Coverage
- `Overlaps(Subnet)` typed override: explicit bidirectional symmetry test
- `Overlaps(IIPAddressRange)` called from a Subnet context: symmetry test
- `TryExcludeAll`: IPv4 and IPv6 family-max and family-min boundary tests
- Private/public spanning-block regression + ContainsAnyPrivate <->
  ContainsAllPublic inverse assertions
Addressing targeting issues with specific lang version change
Adds RFC notes
Cleans up ToBase85String
Dropped (most) obsolete items; including MAC Address type
Cleaned up ToDottedQuadString method
Using modern collection conventions
fixing bad exceptions - adding tests too
using matching and switch where possible
Touches serialization
Addresses warnings
@rheone rheone closed this Jun 6, 2026
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.

1 participant