]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
network-functions.pl: Add tests for the new equals function
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 11 Jan 2017 17:18:46 +0000 (17:18 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 11 Jan 2017 17:18:46 +0000 (17:18 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/network-functions.pl

index db9d7dbfc30bb20c65d2b0588bee1b633b53604e..5f53704cd18e552ca4f12670f6bce91449b62b54 100644 (file)
@@ -368,12 +368,26 @@ sub testsuite() {
        $result = &find_next_ip_address("1.2.3.4", 2);
        assert($result eq "1.2.3.6");
 
+       $result = &network_equal("192.168.0.0/24", "192.168.0.0/255.255.255.0");
+       assert($result);
+
+       $result = &network_equal("192.168.0.0/24", "192.168.0.0/25");
+       assert(!$result);
+
+       $result = &network_equal("192.168.0.0/24", "192.168.0.128/25");
+       assert(!$result);
+
+       $result = &network_equal("192.168.0.1/24", "192.168.0.XXX/24");
+       assert($result);
+
        $result = &ip_address_in_network("10.0.1.4", "10.0.0.0/8");
        assert($result);
 
        $result = &ip_address_in_network("192.168.30.11", "192.168.30.0/255.255.255.0");
        assert($result);
 
+       print "Testsuite completed successfully!\n";
+
        return 0;
 }