1#!/bin/sh
2# verify that multiple -t specifiers to od align well
3# This would fail before coreutils-6.13.
4
5# Copyright (C) 2008-2023 Free Software Foundation, Inc.
6
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.
11
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.
16
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/>.
19
20. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
21print_ver_ od
22
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.
25seq 19 > in || framework_failure_
26test $(wc -c < in) -eq 48 || framework_failure_
27
28
29list='a c dC dS dI dL oC oS oI oL uC uS uI uL xC xS xI xL fF fD fL'
30for 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
38done
39
40compare exp out || fail=1
41
42Exit $fail
43