diff options
Diffstat (limited to 'module/ri-base/src/test/java')
-rw-r--r-- | module/ri-base/src/test/java/io/trygvis/rules/network/Ipv4CidrTest.txt | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/module/ri-base/src/test/java/io/trygvis/rules/network/Ipv4CidrTest.txt b/module/ri-base/src/test/java/io/trygvis/rules/network/Ipv4CidrTest.txt deleted file mode 100644 index 826f586..0000000 --- a/module/ri-base/src/test/java/io/trygvis/rules/network/Ipv4CidrTest.txt +++ /dev/null @@ -1,37 +0,0 @@ -package io.trygvis.rules.network; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; - -import static io.trygvis.rules.network.Ipv4Cidr.parseCidr; -import static org.junit.jupiter.api.Assertions.*; - -class Ipv4CidrTest { - - @Test - public void basic() { - Assertions.assertThrows(IllegalArgumentException.class, () -> parseCidr("192.168.1.1/24").addresses()); - assertEquals(256, parseCidr("192.168.1.0/24").addresses().size()); - assertEquals(128, parseCidr("192.168.1.128/25").addresses().size()); - } - - @ParameterizedTest - @ValueSource(strings = { - "192.168.1.0/24", - "192.168.1.128/25", - }) - public void testParsing(String s) { - assertEquals(s, parseCidr(s).toString()); - } - - @Test - public void partition() { - var children = parseCidr("192.168.1.0/24").partition(26); - assertEquals(1 << 2, children.size()); - for (var cidr : children) { - assertEquals(26, cidr.bits); - } - } -} |