From: Stefan Schantl Date: Mon, 17 Apr 2023 13:21:39 +0000 (+0200) Subject: Add test to create and remove a port set. X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=4dff2ddfc299ac44b50427b5f04019823092f170;p=people%2Fstevee%2Fperl-ipset.git Add test to create and remove a port set. Signed-off-by: Stefan Schantl --- diff --git a/t/IPSet.t b/t/IPSet.t index fdff527..82657e4 100644 --- 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);