]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
test: od: verify -t f defaults to double precision
authorSylvestre Ledru <sylvestre@debian.org>
Mon, 6 Apr 2026 16:10:42 +0000 (17:10 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 6 Apr 2026 16:16:05 +0000 (17:16 +0100)
* tests/od/od-float.sh: Add cases to ensure -t f = -t fD,
and also verify the resulting number.
https://github.com/uutils/coreutils/pull/11396
https://github.com/coreutils/coreutils/pull/241

tests/od/od-float.sh

index 3894aea8af664b34bb7517bc171ad9d164633840..6b547945c025d82385199d2184ff67479ec35b38 100755 (executable)
@@ -90,4 +90,19 @@ else
   compare exp_err err || fail=1
 fi
 
+# Ensure -t f defaults to double precision (8 bytes), not float (4 bytes).
+env printf '\x00\x00\x80\x3f\x00\x00\x00\x40' |
+od -An -t f --endian=little > out || fail=1
+printf '        2.000000473111868\n' > exp || framework_failure_
+compare exp out || fail=1
+
+env printf '\x00\x00\x80\x3f\x00\x00\x00\x40' |
+od -An -t fD --endian=little > out || fail=1
+compare exp out || fail=1
+
+env printf '\x00\x00\x80\x3f\x00\x00\x00\x40' |
+od -An -t fF --endian=little > out || fail=1
+printf '               1               2\n' > exp || framework_failure_
+compare exp out || fail=1
+
 Exit $fail