]> git.ipfire.org Git - people/stevee/perl-ipset.git/commitdiff
Add test to create and remove a port set.
authorStefan Schantl <stefan.schantl@ipfire.org>
Mon, 17 Apr 2023 13:21:39 +0000 (15:21 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Mon, 17 Apr 2023 13:21:39 +0000 (15:21 +0200)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
t/IPSet.t

index fdff527654ebcbd1adb919d33450dbe850cd8248..82657e4be02c87af842b24b41146160abfe07b74 100644 (file)
--- a/t/IPSet.t
+++ b/t/IPSet.t
@@ -8,7 +8,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 21;
+use Test::More tests => 23;
 BEGIN { use_ok('IPSet') };
 
 #########################
@@ -24,6 +24,11 @@ my %testset = (
        "maxelem" => "10",
 );
 
+my %portset = (
+       "name" => "PORTTEST",
+       "type" => "bitmap:port",
+);
+
 # Array with addresses to be added to the testset.
 my @addresses = ("1.1.1.1", "2.2.2.2");
 
@@ -104,5 +109,16 @@ ok($data->{entries} eq 0, "No entries anymore in the testset.");
 # CLEANUP: Delete the remaining set.
 &IPSet::delete_set($session, $testset{'name'});
 
+# Create the testset for ports.
+my $create_port_set = &IPSet::create_set($session, $portset{'name'}, $portset{'type'}, "0", "0");
+ok($create_port_set, "Sucessfully created set: $portset{'name'}");
+
+# Check if the testset exists.
+$exists = &IPSet::setname_exists($session, $portset{'name'});
+ok($exists, "The portset exists.");
+
+# Destroy the port set.
+&IPSet::delete_set($session, $portset{'name'});
+
 # Destroy the ipset session.
 &IPSet::DESTROY($session);