Skip to content

Commit 67ebf9b

Browse files
maxholmanclaude
andcommitted
test(core): add IPv6 default-route and host-route containment tests
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent de6390f commit 67ebf9b

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

crates/core/src/types.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,24 @@ mod tests {
342342
);
343343
}
344344

345+
#[test]
346+
fn test_cidr_contains_ipv6_default_route() {
347+
let default: Cidr = "::/0".parse().unwrap();
348+
let any: Cidr = "2001:db8::/32".parse().unwrap();
349+
assert!(default.contains(&any), "::/0 should contain any IPv6 CIDR");
350+
}
351+
352+
#[test]
353+
fn test_cidr_contains_ipv6_host_route() {
354+
let net: Cidr = "fd00::/16".parse().unwrap();
355+
let host: Cidr = "fd00::1/128".parse().unwrap();
356+
assert!(net.contains(&host), "fd00::/16 should contain fd00::1/128");
357+
assert!(
358+
!host.contains(&net),
359+
"fd00::1/128 should not contain fd00::/16"
360+
);
361+
}
362+
345363
#[test]
346364
fn test_cidr_contains_mixed_families() {
347365
let v4: Cidr = "10.0.0.0/8".parse().unwrap();

0 commit comments

Comments
 (0)