Plug resolveIp6 into IPv6 tests
parent
64e55a74de
commit
2fa9cf51ff
|
@ -32,8 +32,13 @@ test "parse and render IPv6 addresses" {
|
||||||
};
|
};
|
||||||
for (ips) |ip, i| {
|
for (ips) |ip, i| {
|
||||||
var addr = net.Address.parseIp6(ip, 0) catch unreachable;
|
var addr = net.Address.parseIp6(ip, 0) catch unreachable;
|
||||||
|
var addr_via_resolve = net.Address.resolveIp6(ip, 0) catch unreachable;
|
||||||
|
|
||||||
var newIp = std.fmt.bufPrint(buffer[0..], "{}", .{addr}) catch unreachable;
|
var newIp = std.fmt.bufPrint(buffer[0..], "{}", .{addr}) catch unreachable;
|
||||||
|
var newResolvedIp = std.fmt.bufPrint(buffer[0..], "{}", .{addr_via_resolve}) catch unreachable;
|
||||||
|
|
||||||
std.testing.expect(std.mem.eql(u8, printed[i], newIp[1 .. newIp.len - 3]));
|
std.testing.expect(std.mem.eql(u8, printed[i], newIp[1 .. newIp.len - 3]));
|
||||||
|
std.testing.expect(std.mem.eql(u8, printed[i], newResolvedIp[1 .. newResolvedIp.len - 3]));
|
||||||
}
|
}
|
||||||
|
|
||||||
testing.expectError(error.InvalidCharacter, net.Address.parseIp6(":::", 0));
|
testing.expectError(error.InvalidCharacter, net.Address.parseIp6(":::", 0));
|
||||||
|
@ -42,6 +47,7 @@ test "parse and render IPv6 addresses" {
|
||||||
testing.expectError(error.InvalidEnd, net.Address.parseIp6("FF01:0:0:0:0:0:0:FB:", 0));
|
testing.expectError(error.InvalidEnd, net.Address.parseIp6("FF01:0:0:0:0:0:0:FB:", 0));
|
||||||
testing.expectError(error.Incomplete, net.Address.parseIp6("FF01:", 0));
|
testing.expectError(error.Incomplete, net.Address.parseIp6("FF01:", 0));
|
||||||
testing.expectError(error.InvalidIpv4Mapping, net.Address.parseIp6("::123.123.123.123", 0));
|
testing.expectError(error.InvalidIpv4Mapping, net.Address.parseIp6("::123.123.123.123", 0));
|
||||||
|
testing.expectError(error.Incomplete, net.Address.resolveIp6("ff01::fb%", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
test "parse and render IPv4 addresses" {
|
test "parse and render IPv4 addresses" {
|
||||||
|
|
Loading…
Reference in New Issue