Skip to content

Commit 5255c24

Browse files
committed
tests: od: verify -t f defaults to double precision
* tests/od/od.pl: Add tests to ensure -t f (no size suffix) defaults to double precision (8 bytes), matching -t fD, and differs from -t fF (explicit 4-byte float). uutils/coreutils#11396
1 parent b64f9bf commit 5255c24

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/od/od.pl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@
9999
{ERR=>"$prog: invalid -w argument '-1'\n"}],
100100
['invalid-w-3', '-ww -An', {IN=>""}, {EXIT=>1},
101101
{ERR=>"$prog: invalid -w argument 'w'\n"}],
102+
103+
# Ensure -t f defaults to double precision (8 bytes), not float (4 bytes).
104+
# https://github.com/uutils/coreutils/pull/11396
105+
['tf-default', '-An -t f',
106+
{IN_PIPE=>"\x00\x00\x80\x3f\x00\x00\x00\x40"},
107+
{OUT=>" 2.000000473111868\n"}],
108+
['tf-double', '-An -t fD',
109+
{IN_PIPE=>"\x00\x00\x80\x3f\x00\x00\x00\x40"},
110+
{OUT=>" 2.000000473111868\n"}],
111+
['tf-float', '-An -t fF',
112+
{IN_PIPE=>"\x00\x00\x80\x3f\x00\x00\x00\x40"},
113+
{OUT=>" 1 2\n"}],
102114
);
103115

104116
my $save_temps = $ENV{DEBUG};

0 commit comments

Comments
 (0)