| ... | ... | @@ -4,7 +4,7 @@ const mem = std.mem; |
| 4 | 4 | const testing = std.testing; |
| 5 | 5 | |
| 6 | 6 | test "std.net.parseIp4" { |
| 7 | | assert((try parseIp4("127.0.0.1")) == mem.bigToNative(u32, 0x7f000001)); |
| 7 | testing.expect((try net.parseIp4("127.0.0.1")) == mem.bigToNative(u32, 0x7f000001)); |
| 8 | 8 | |
| 9 | 9 | testParseIp4Fail("256.0.0.1", error.Overflow); |
| 10 | 10 | testParseIp4Fail("x.0.0.1", error.InvalidCharacter); |
| ... | ... | @@ -14,16 +14,16 @@ test "std.net.parseIp4" { |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | fn testParseIp4Fail(buf: []const u8, expected_err: anyerror) void { |
| 17 | | if (parseIp4(buf)) |_| { |
| 17 | if (net.parseIp4(buf)) |_| { |
| 18 | 18 | @panic("expected error"); |
| 19 | 19 | } else |e| { |
| 20 | | assert(e == expected_err); |
| 20 | testing.expect(e == expected_err); |
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | test "std.net.parseIp6" { |
| 25 | | const ip6 = try parseIp6("FF01:0:0:0:0:0:0:FB"); |
| 26 | | const addr = Address.initIp6(ip6, 80); |
| 25 | const ip6 = try net.parseIp6("FF01:0:0:0:0:0:0:FB"); |
| 26 | const addr = net.Address.initIp6(ip6, 80); |
| 27 | 27 | var buf: [100]u8 = undefined; |
| 28 | 28 | const printed = try std.fmt.bufPrint(&buf, "{}", addr); |
| 29 | 29 | std.testing.expect(mem.eql(u8, "[ff01::fb]:80", printed)); |