summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
author+merlan #flirora <uruwi@protonmail.com>2024-11-27 06:04:54 -0500
committerGitHub <noreply@github.com>2024-11-27 11:04:54 +0000
commit6bf1350b16b90ae915836f94dff440da671ebd45 (patch)
treecac250782e46775a7751b28d495e1f3065fad994 /tests
parente550dce62d3def1fb2dfbd1f2b15491e1424da09 (diff)
Add support for interpreting f32 in float.{from-bytes, to-bytes} (#5480)
Diffstat (limited to 'tests')
-rw-r--r--tests/suite/foundations/float.typ7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/suite/foundations/float.typ b/tests/suite/foundations/float.typ
index 2e9e07f2..716ecd6b 100644
--- a/tests/suite/foundations/float.typ
+++ b/tests/suite/foundations/float.typ
@@ -53,8 +53,13 @@
#test(1.0.to-bytes(), bytes((0, 0, 0, 0, 0, 0, 240, 63)))
#test(1.0.to-bytes(endian: "big"), bytes((63, 240, 0, 0, 0, 0, 0, 0)))
+#test(float.from-bytes(bytes((0, 0, 32, 64))), 2.5)
+#test(float.from-bytes(bytes((64, 32, 0, 0)), endian: "big"), 2.5)
+#test(2.5.to-bytes(size: 4), bytes((0, 0, 32, 64)))
+#test(2.5.to-bytes(size: 4, endian: "big"), bytes((64, 32, 0, 0)))
+
--- float-from-bytes-bad-length ---
-// Error: 2-54 bytes must have a length of exactly 8
+// Error: 2-54 bytes must have a length of 4 or 8
#float.from-bytes(bytes((0, 0, 0, 0, 0, 0, 0, 1, 0)))
--- float-repr ---