diff options
author | Bill Nottingham <notting@redhat.com> | 2009-07-29 16:29:08 -0400 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2009-07-29 16:29:08 -0400 |
commit | ea8b242b9ef95f9c4b30310a10c50fef8a071a36 (patch) | |
tree | d6cf544f0d03e6d9c5706bcfe0a1eb8a6623d561 /src | |
parent | 3532aba190ca6bad047ad487d73dc453c6b192a1 (diff) | |
download | initscripts-ea8b242b9ef95f9c4b30310a10c50fef8a071a36.tar initscripts-ea8b242b9ef95f9c4b30310a10c50fef8a071a36.tar.gz initscripts-ea8b242b9ef95f9c4b30310a10c50fef8a071a36.tar.bz2 initscripts-ea8b242b9ef95f9c4b30310a10c50fef8a071a36.tar.xz initscripts-ea8b242b9ef95f9c4b30310a10c50fef8a071a36.zip |
More tests.
Diffstat (limited to 'src')
-rwxr-xr-x | src/ipcalc-tests | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/src/ipcalc-tests b/src/ipcalc-tests index 0cedbc43..25a38a98 100755 --- a/src/ipcalc-tests +++ b/src/ipcalc-tests @@ -20,6 +20,7 @@ # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. +bin=./ipcalc exitcode=0 ok() { @@ -54,33 +55,39 @@ TestOutput() { } echo -n "Checking for ipcalc binary... " -[ -x ./ipcalc ] || { fail ; exit $exitcode ; } +[ -x $bin ] || { fail ; exit $exitcode ; } -TestSuccess "ipcalc --help" +TestSuccess "$bin --help" -TestSuccess "ipcalc -c 127.0.0.1" -TestSuccess "ipcalc -c -6 ::1" -TestSuccess "ipcalc -c ::1" +TestSuccess "$bin -c 127.0.0.1" +TestSuccess "$bin -c -6 ::1" +TestSuccess "$bin -c ::1" -TestSuccess "ipcalc -c 192.168.1.1" -TestSuccess "ipcalc -c -6 2a01:198:200:300::2" -TestSuccess "ipcalc -c -6 2a01:198:200:300:0000:0000:0000:2" -TestSuccess "ipcalc -c -6 2a01:0198:0200:0300:0000:0000:0000:0002" +TestSuccess "$bin -c 192.168.1.1" +TestSuccess "$bin -c -6 2a01:198:200:300::2" +TestSuccess "$bin -c -6 2a01:198:200:300:0000:0000:0000:2" +TestSuccess "$bin -c -6 2a01:0198:0200:0300:0000:0000:0000:0002" -TestFailure "ipcalc -c -6 gggg::" -TestFailure "ipcalc -b -6 ::1/128" +TestFailure "$bin -c -6 gggg::" +TestFailure "$bin -b -6 ::1/128" +TestFailure "$bin -c -4 -6 2a01:198:200:300:0000:0000:0000:2" +TestFailure "$bin -c -4 -6 127.0.0.1" +TestFailure "$bin -c -6 127.0.0.1" +TestFailure "$bin -m 192.168.1.1/-1" +TestFailure "$bin -m 192.168.1.1/64" +TestFailure "$bin -m 192.168.1.1/99999" -TestOutput "ipcalc -b 192.168.1.1/24" "BROADCAST=192.168.1.255" -TestOutput "ipcalc -b 192.168.1.1 255.255.255.0" "BROADCAST=192.168.1.255" -TestOutput "ipcalc -m 192.168.1.1/24" "NETMASK=255.255.255.0" -TestOutput "ipcalc -p 192.168.1.1 255.255.255.0" "PREFIX=24" -TestOutput "ipcalc -p 192.168.1.1 255.255.255.255" "PREFIX=32" -TestOutput "ipcalc -p 192.168.1.1 0.0.0.0" "PREFIX=0" -TestOutput "ipcalc -p 172.16.59.222 255.255.252.0" "PREFIX=22" -TestOutput "ipcalc -m 172.16.59.222/22" "NETMASK=255.255.252.0" -TestOutput "ipcalc -m 192.168.1.1" "NETMASK=255.255.255.0" -TestOutput "ipcalc -m 10.1.2.3" "NETMASK=255.0.0.0" -TestOutput "ipcalc -m 129.22.4.3" "NETMASK=255.255.0.0" +TestOutput "$bin -b 192.168.1.1/24" "BROADCAST=192.168.1.255" +TestOutput "$bin -b 192.168.1.1 255.255.255.0" "BROADCAST=192.168.1.255" +TestOutput "$bin -m 192.168.1.1/24" "NETMASK=255.255.255.0" +TestOutput "$bin -p 192.168.1.1 255.255.255.0" "PREFIX=24" +TestOutput "$bin -p 192.168.1.1 255.255.255.255" "PREFIX=32" +TestOutput "$bin -p 192.168.1.1 0.0.0.0" "PREFIX=0" +TestOutput "$bin -p 172.16.59.222 255.255.252.0" "PREFIX=22" +TestOutput "$bin -m 172.16.59.222/22" "NETMASK=255.255.252.0" +TestOutput "$bin -m 192.168.1.1" "NETMASK=255.255.255.0" +TestOutput "$bin -m 10.1.2.3" "NETMASK=255.0.0.0" +TestOutput "$bin -m 129.22.4.3" "NETMASK=255.255.0.0" -echo "$exitcode tests failed." +echo "$exitcode test(s) failed." exit $exitcode |