Skip to content

Commit aa5a63e

Browse files
committed
update coverage
1 parent 6060845 commit aa5a63e

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

net/unstable_ip_test.ts

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,30 +62,6 @@ Deno.test("matchSubnets()", () => {
6262
];
6363

6464
const list = [
65-
// IPv4 exact and CIDR matches
66-
{ addr: "192.168.1.10", subnets: ["192.168.1.10"], expected: true },
67-
{ addr: "192.168.1.10", subnets: ["192.168.1.11"], expected: false },
68-
{ addr: "192.168.1.10", subnets: ["192.168.1.0/24"], expected: true },
69-
{ addr: "192.168.1.255", subnets: ["192.168.1.0/24"], expected: true },
70-
{ addr: "192.168.2.10", subnets: ["192.168.1.0/24"], expected: false },
71-
{ addr: "192.168.100.10", subnets: ["192.168.0.0/16"], expected: true },
72-
{ addr: "192.169.1.10", subnets: ["192.168.0.0/16"], expected: false },
73-
{ addr: "192.100.100.100", subnets: ["192.0.0.0/8"], expected: true },
74-
{ addr: "193.1.1.1", subnets: ["192.0.0.0/8"], expected: false },
75-
{ addr: "192.168.1.10", subnets: ["192.168.1.10/32"], expected: true },
76-
{ addr: "192.168.1.11", subnets: ["192.168.1.10/32"], expected: false },
77-
78-
// IPv6 exact and subnet matches
79-
{ addr: "2001:db8::1", subnets: ["2001:db8::1"], expected: true },
80-
{ addr: "2001:db8::1", subnets: ["2001:db8::2"], expected: false },
81-
{ addr: "::1", subnets: ["::1"], expected: true },
82-
{ addr: "2001:db8::1", subnets: ["2001:db8::/64"], expected: true },
83-
{ addr: "2001:db9::1", subnets: ["2001:db8::/64"], expected: false },
84-
{ addr: "2001:db8:1234::1", subnets: ["2001:db8::/32"], expected: true },
85-
{ addr: "2001:db9::1", subnets: ["2001:db8::/32"], expected: false },
86-
{ addr: "::", subnets: ["::/0"], expected: true },
87-
{ addr: "2001:db8::1", subnets: ["::/0"], expected: true },
88-
8965
// Multiple and mixed subnets
9066
{ addr: "192.168.1.50", subnets: mixed, expected: true },
9167
{ addr: "10.5.5.5", subnets: mixed, expected: true },
@@ -116,9 +92,9 @@ Deno.test("matchIPv4Subnet()", () => {
11692
{ addr: "192.168.1.10", subnet: "192.168.1.0/24", expected: true },
11793
{ addr: "192.168.1.11", subnet: "/32", expected: false },
11894
{ addr: "192.168.1", subnet: "192.168.1/32", expected: false },
119-
{ addr: "192.168.1.1", subnet: "192.168.1.0/", expected: false }, // Missing prefix length
120-
{ addr: "192.168.1.1", subnet: "192.168.1.0/33", expected: false }, // Invalid prefix length
121-
{ addr: "192.168.1.1", subnet: "192.168.1.0/0", expected: true }, // /0 prefix (all IPs)
95+
{ addr: "192.168.1.1", subnet: "192.168.1.0/", expected: false },
96+
{ addr: "192.168.1.1", subnet: "192.168.1.0/33", expected: false },
97+
{ addr: "192.168.1.1", subnet: "192.168.1.0/0", expected: true },
12298
];
12399

124100
for (const { addr, subnet, expected } of list) {
@@ -158,6 +134,7 @@ Deno.test("matchIPv6Subnet()", () => {
158134
// Additional edge cases
159135
{ addr: "2001:db8::1", subnet: "2001:db8::1/-1", expected: false },
160136
{ addr: "2001:db8::1", subnet: "2001:db8::1/abc", expected: false },
137+
161138
//IPv6 with embedded IPv4
162139
{
163140
addr: "2001:db8::ffff:192.168.1.1.1",

0 commit comments

Comments
 (0)