3 # Check various corner cases of upkg_decode_index.
4 # Copyright © 2012, 2022 Nick Bowler
6 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
7 # This is free software: you are free to do what the fuck you want to.
8 # There is NO WARRANTY, to the extent permitted by law.
10 decodeindex=test/decodeindex$EXEEXT
15 { $decodeindex "$1" 3>&-
16 echo decode_status=$? >&3
18 echo decode_val=\'$val\' >&3;
24 (exit $decode_status) || return 1
25 if test x"$decode_val" != x"$2"; then
26 printf '%s: result (%d) does not match expected (%d)\n' \
27 "$scriptname" "$decode_val" "$2"
32 if (exit $decode_status); then
33 printf '%s: false positive on (%s), got (%d)\n' \
34 "$scriptname" "$1" "$decode_val"
41 test_index 00 0 || exit 1
42 test_index 4000 0 || exit 1
43 test_index 408000 0 || exit 1
44 test_index 40808000 0 || exit 1
45 test_index 4080808000 0 || exit 1
48 test_index '' || exit 1
49 test_index 40 || exit 1
50 test_index 4080 || exit 1
51 test_index 408080 || exit 1
52 test_index 40808080 || exit 1
53 test_index 4080808080 || exit 1
54 test_index 408080808000 || exit 1