diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-01-20 10:15:11 +1100 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-01-20 10:15:11 +1100 |
commit | abe20d48f6a96a2f636672d50b9274c71acf7d9f (patch) | |
tree | 213a492082311993fd4c2eab8c07f46d0ca72332 /tests | |
parent | 05f12fecffab242122c2702c049b48500ae8081a (diff) | |
download | vyatta-cfg-abe20d48f6a96a2f636672d50b9274c71acf7d9f.tar.gz vyatta-cfg-abe20d48f6a96a2f636672d50b9274c71acf7d9f.zip |
update unit tests
Add more unit tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/interface.pl | 11 | ||||
-rw-r--r-- | tests/isip.pl | 23 |
2 files changed, 30 insertions, 4 deletions
diff --git a/tests/interface.pl b/tests/interface.pl index c2a1a1b..86ec96e 100644 --- a/tests/interface.pl +++ b/tests/interface.pl @@ -12,11 +12,14 @@ use Vyatta::Misc; my @interfaces = getInterfaces(); print "Interfaces: ", join(' ',@interfaces),"\n"; -print "IP addresses = "; -foreach my $addr (Vyatta::Misc::getInterfacesIPadresses('all')) { - print $addr, '(', is_ip_v4_or_v6($addr), ') '; +print "IP\n"; +foreach my $type (qw/all broadcast multicast pointtopoint/) { + print "\t$type = "; + foreach my $addr (Vyatta::Misc::getInterfacesIPadresses($type)) { + print $addr, '(', is_ip_v4_or_v6($addr), ') '; + } + print "\n"; } -print "\n"; foreach my $arg (@interfaces) { diff --git a/tests/isip.pl b/tests/isip.pl new file mode 100644 index 0000000..35a04b7 --- /dev/null +++ b/tests/isip.pl @@ -0,0 +1,23 @@ +#! /usr/bin/perl + +# Standalone test for Vyatta::Misc::isIPInterfaces + +use strict; +use warnings; +use Vyatta::Misc; +use Vyatta::Interface; + +my $vc; +my @interfaces = getInterfaces(); +print "Interfaces: ", join(' ',@interfaces),"\n"; + +foreach my $lip (@ARGV) { + print $lip, " is"; + if (Vyatta::Misc::isIPinInterfaces($vc, $lip, @interfaces)) { + print " in\n"; + } else { + print " not in\n"; + } +} + +exit 0; |