tests: add test for locale decimal processing
[coreutils.git] / tests / misc / od-multiple-t.sh
blobe8056ba3c938d08f69db5ee04984677b9c691810
1 #!/bin/sh
2 # verify that multiple -t specifiers to od align well
3 # This would fail before coreutils-6.13.
5 # Copyright (C) 2008-2019 Free Software Foundation, Inc.
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
20 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
21 print_ver_ od
23 # Choose 48 bytes for the input, as that is lcm for 1, 2, 4, 8, 12, 16;
24 # we don't anticipate any other native object size on modern hardware.
25 seq 19 > in || framework_failure_
26 test $(wc -c < in) -eq 48 || framework_failure_
29 list='a c dC dS dI dL oC oS oI oL uC uS uI uL xC xS xI xL fF fD fL'
30 for format1 in $list; do
31 for format2 in $list; do
32 od -An -t${format1}z -t${format2}z in > out-raw || fail=1
33 linewidth=$(head -n1 out-raw | wc -c)
34 linecount=$(wc -l < out-raw)
35 echo $format1 $format2 $(wc -c < out-raw) >> out
36 echo $format1 $format2 $(expr $linewidth '*' $linecount) >> exp
37 done
38 done
40 compare exp out || fail=1
42 Exit $fail