From: Stefan Schantl Date: Mon, 17 Apr 2023 13:23:26 +0000 (+0200) Subject: Add test to remove ports from a set X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;p=people%2Fstevee%2Fperl-ipset.git Add test to remove ports from a set Signed-off-by: Stefan Schantl --- diff --git a/t/IPSet.t b/t/IPSet.t index 8705c01..e3f003b 100644 --- a/t/IPSet.t +++ b/t/IPSet.t @@ -8,7 +8,7 @@ use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 27; BEGIN { use_ok('IPSet') }; ######################### @@ -129,6 +129,15 @@ foreach my $port (@ports) { $data = &IPSet::get_set_data($session, $portset{'name'}); ok($data->{entries} eq scalar(@ports), "All ports added successfully to the set"); +# Remove a port from the set. +$remove = &IPSet::remove_port($session, $portset{'name'}, $ports[0]); +ok($remove, "Successfully removed $ports[0] from $portset{'name'}"); + +# Grab set data from portset once again. +$data = &IPSet::get_set_data($session, $portset{'name'}); +ok($data->{entries} lt scalar(@ports), "Less entries in the set than at the ports array"); +ok($data->{entries} gt 0, "At least one entry on the portset"); + # Destroy the port set. &IPSet::delete_set($session, $portset{'name'});