try? / catch?

This commit is contained in:
Christoffer Lerno
2023-03-17 00:45:23 +01:00
committed by Christoffer Lerno
parent 1b667cbc93
commit 8b0df0ee11
33 changed files with 235 additions and 183 deletions

View File

@@ -34,11 +34,11 @@ fn void! test_ipv4_parse()
assert(a.ipv4.a == 127 && a.ipv4.b == 0 && a.ipv4.c == 0 && a.ipv4.d == 1);
a = net::ipv4_from_str("255.254.253.255")?;
assert(a.ipv4.a == 255 && a.ipv4.b == 254 && a.ipv4.c == 253 && a.ipv4.d == 255);
assert(catch(net::ipv4_from_str(".1.1.1.1")));
assert(catch(net::ipv4_from_str("1..1.1")));
assert(catch(net::ipv4_from_str("1..1.1.1")));
assert(catch(net::ipv4_from_str("1.1.1.256")));
assert(catch(net::ipv4_from_str("256.1.1.1")));
assert(catch? net::ipv4_from_str(".1.1.1.1"));
assert(catch? net::ipv4_from_str("1..1.1"));
assert(catch? net::ipv4_from_str("1..1.1.1"));
assert(catch? net::ipv4_from_str("1.1.1.256"));
assert(catch? net::ipv4_from_str("256.1.1.1"));
}
fn void test_ipv6()