index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2008-07-22 23:41:50 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-07-24 22:16:28 -0500 |
commit | 5e4882dfe8b62a8cb7c206986d1010195a63d74e (patch) | |
tree | 9a4ed779c610670bbd272b88087555fb3c432379 /pactest | |
parent | 075b244be23aa788ae21e8c5d50cb99a1296c37f (diff) |
-rwxr-xr-x | pactest/vercmptest.sh | 36 |
diff --git a/pactest/vercmptest.sh b/pactest/vercmptest.sh index f8d457ee..e36bf4be 100755 --- a/pactest/vercmptest.sh +++ b/pactest/vercmptest.sh @@ -26,8 +26,9 @@ failure=0 # args: # pass ver1 ver2 ret expected pass() { - echo "test: ver1: $1 ver2: $2 ret: $3 expected: $4" - echo " --> pass" + #echo "test: ver1: $1 ver2: $2 ret: $3 expected: $4" + #echo " --> pass" + echo -n } # args: @@ -54,13 +55,20 @@ runtest() { ret=$($bin $2 $1) func='pass' [ $ret -eq $reverse ] || func='fail' - $func $1 $2 $ret $reverse + $func $2 $1 $ret $reverse total=$(expr $total + 1) } # use first arg as our binary if specified [ -n "$1" ] && bin="$1" +if [ ! -x "$bin" ]; then + echo "vercmp binary ($bin) could not be located" + exit 1 +fi + +echo "Beginning vercmp tests" + # BEGIN TESTS # all similar length, no pkgrel @@ -88,6 +96,28 @@ runtest 1.1-1 1.1 0 runtest 1.0-1 1.1 -1 runtest 1.1-1 1.0 1 +# alphanumeric versions +runtest 1.5b-1 1.5-1 -1 +runtest 1.5b 1.5 -1 +runtest 1.5b-1 1.5 -1 +runtest 1.5b 1.5.1 -1 + +# from the manpage +runtest 1.0a 1.0alpha -1 +runtest 1.0alpha 1.0b -1 +runtest 1.0b 1.0beta -1 +runtest 1.0beta 1.0rc -1 +runtest 1.0rc 1.0 -1 + +# going crazy? alpha-dotted versions +runtest 1.5.a 1.5 1 +runtest 1.5.b 1.5.a 1 +runtest 1.5.1 1.5.b 1 + +# alpha dots and dashes +runtest 1.5.b-1 1.5.b 0 +runtest 1.5-1 1.5.b -1 + #END TESTS echo |