X-Git-Url: http://git.draconx.ca/gitweb/upkg.git/blobdiff_plain/18cf0058df91c5c0338c202b222ee3c5ea3fce75..f6779008e58e8d3158555dca574e7bbdb15a55dd:/tests/libupkg-index-decode.sh diff --git a/tests/libupkg-index-decode.sh b/tests/libupkg-index-decode.sh deleted file mode 100644 index 80b328d..0000000 --- a/tests/libupkg-index-decode.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -# -# Check various corner cases of upkg_decode_index. -# Copyright © 2012, 2022 Nick Bowler -# -# License WTFPL2: Do What The Fuck You Want To Public License, version 2. -# This is free software: you are free to do what the fuck you want to. -# There is NO WARRANTY, to the extent permitted by law. - -decodeindex=test/decodeindex$EXEEXT -scriptname=$0 - -test_index() { - decode_cmd=`exec 3>&1 - { $decodeindex "$1" 3>&- - echo decode_status=$? >&3 - } | { read val 3>&- - echo decode_val=\'$val\' >&3; - }` - eval "$decode_cmd" - - case $# in - 2) - (exit $decode_status) || return 1 - if test x"$decode_val" != x"$2"; then - printf '%s: result (%d) does not match expected (%d)\n' \ - "$scriptname" "$decode_val" "$2" - return 1 - fi - ;; - 1) - if (exit $decode_status); then - printf '%s: false positive on (%s), got (%d)\n' \ - "$scriptname" "$1" "$decode_val" - return 1 - fi - ;; - esac -} - -test_index 00 0 || exit 1 -test_index 4000 0 || exit 1 -test_index 408000 0 || exit 1 -test_index 40808000 0 || exit 1 -test_index 4080808000 0 || exit 1 - -# False positives -test_index '' || exit 1 -test_index 40 || exit 1 -test_index 4080 || exit 1 -test_index 408080 || exit 1 -test_index 40808080 || exit 1 -test_index 4080808080 || exit 1 -test_index 408080808000 || exit 1