From 79fb2c36893140ce61765e2b437ef37c51235615 Mon Sep 17 00:00:00 2001 From: Malo <57839069+MDLC01@users.noreply.github.com> Date: Sun, 11 Aug 2024 22:18:57 +0200 Subject: Fix `calc.inf`, `-calc.inf`, and `calc.nan` reprs and displays (#4724) --- tests/ref/float-display.png | Bin 1621 -> 1848 bytes tests/ref/float-repr.png | Bin 1923 -> 2443 bytes tests/ref/grid-rowspan-split-15.png | Bin 1727 -> 2948 bytes tests/ref/ops-multiply-inf-with-length.png | Bin 1066 -> 2414 bytes tests/suite/foundations/float.typ | 15 +++++++++++++-- tests/suite/scripting/ops.typ | 4 ++-- 6 files changed, 15 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/ref/float-display.png b/tests/ref/float-display.png index 6c33b372..bfece012 100644 Binary files a/tests/ref/float-display.png and b/tests/ref/float-display.png differ diff --git a/tests/ref/float-repr.png b/tests/ref/float-repr.png index 8b510969..7b49e9d1 100644 Binary files a/tests/ref/float-repr.png and b/tests/ref/float-repr.png differ diff --git a/tests/ref/grid-rowspan-split-15.png b/tests/ref/grid-rowspan-split-15.png index 445f0a95..bbefe0da 100644 Binary files a/tests/ref/grid-rowspan-split-15.png and b/tests/ref/grid-rowspan-split-15.png differ diff --git a/tests/ref/ops-multiply-inf-with-length.png b/tests/ref/ops-multiply-inf-with-length.png index 749be056..0662d568 100644 Binary files a/tests/ref/ops-multiply-inf-with-length.png and b/tests/ref/ops-multiply-inf-with-length.png differ diff --git a/tests/suite/foundations/float.typ b/tests/suite/foundations/float.typ index 770533b9..206013ac 100644 --- a/tests/suite/foundations/float.typ +++ b/tests/suite/foundations/float.typ @@ -20,6 +20,8 @@ // Test float `is-nan()`. #test(float(calc.nan).is-nan(), true) #test(float(10).is-nan(), false) +#test(float(calc.inf).is-nan(), false) +#test(float(-calc.inf).is-nan(), false) --- float-is-infinite --- // Test float `is-infinite()`. @@ -27,6 +29,7 @@ #test(float(-calc.inf).is-infinite(), true) #test(float(10).is-infinite(), false) #test(float(-10).is-infinite(), false) +#test(float(calc.nan).is-infinite(), false) --- float-signum --- // Test float `signum()` @@ -35,6 +38,8 @@ #test(float(-1.0).signum(), -1.0) #test(float(10.0).signum(), 1.0) #test(float(-10.0).signum(), -1.0) +#test(float(calc.inf).signum(), 1.0) +#test(float(-calc.inf).signum(), -1.0) #test(float(calc.nan).signum().is-nan(), true) --- float-repr --- @@ -49,7 +54,10 @@ #repr(-9876543210.0) \ #repr(-0987654321.0) \ #repr(-3.14) \ -#repr(4.0 - 8.0) +#repr(4.0 - 8.0) \ +#repr(calc.inf) \ +#repr(-calc.inf) \ +#repr(calc.nan) --- float-display --- // Test floats. @@ -63,4 +71,7 @@ #(-9876543210.0) \ #(-0987654321.0) \ #(-3.14) \ -#(4.0 - 8.0) +#(4.0 - 8.0) \ +#calc.inf \ +#(-calc.inf) \ +#calc.nan diff --git a/tests/suite/scripting/ops.typ b/tests/suite/scripting/ops.typ index 0f13d212..0df4b82d 100644 --- a/tests/suite/scripting/ops.typ +++ b/tests/suite/scripting/ops.typ @@ -335,7 +335,7 @@ #(1em <= 10pt) --- ops-compare-normal-float-with-nan --- -// Error: 3-22 cannot compare 2.2 with NaN +// Error: 3-22 cannot compare 2.2 with calc.nan #(2.2 <= float("nan")) --- ops-compare-int-and-str --- @@ -343,7 +343,7 @@ #((0, 1, 3) > (0, 1, "a")) --- ops-compare-array-nested-failure --- -// Error: 3-42 cannot compare 3.5 with NaN +// Error: 3-42 cannot compare 3.5 with calc.nan #((0, "a", 3.5) <= (0, "a", float("nan"))) --- ops-divide-by-zero-float --- -- cgit v1.2.3