gbranden pushed a commit to branch master
in repository groff.
commit 3f5a6f4901055438febe5619eb02a392f22c462e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Tue Aug 13 09:09:15 2024 -0500
[groff]: Add more tests of arithmetic.
* src/roff/groff/tests/arithmetic-works.sh: Add more test cases.
---
ChangeLog | 4 ++++
src/roff/groff/tests/arithmetic-works.sh | 32 ++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index cfe2700b9..3d3761f8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2024-08-13 G. Branden Robinson <[email protected]>
+
+ * src/roff/groff/tests/arithmetic-works.sh: Add more test cases.
+
2024-08-13 G. Branden Robinson <[email protected]>
* src/roff/troff/node.cpp (troff_output_file::flush_tbuf): Add
diff --git a/src/roff/groff/tests/arithmetic-works.sh
b/src/roff/groff/tests/arithmetic-works.sh
index 291b930cd..279a5ce9a 100755
--- a/src/roff/groff/tests/arithmetic-works.sh
+++ b/src/roff/groff/tests/arithmetic-works.sh
@@ -78,6 +78,38 @@ echo "$output" | grep -Fqx '3: .l=24, .H=24' || wail
echo "checking that setting huge page length does not overflow" >&2
echo "$output" | grep -Fqx '4: .p=40, .V=40' || wail
+input='.
+.ec @
+.nf
+.nr a 99999999999999999999n
+.nr b (-99999999999999999999n)
+.nr c 99999999999999999999v
+.nr d (-99999999999999999999v)
+a: @na
+b: @nb
+c: @nc
+d: @nd
+.'
+
+output=$(echo "$input" | "$groff" -T ascii)
+echo "$output"
+
+# The vunits and hunits constructors in src/roff/troff/number.cpp don't
+# permit INT_MIN to be assigned, as a side effect of making rounding
+# behavior sign-independent.
+
+echo "checking assignment of large positive horizontal measurement" >&2
+echo "$output" | grep -Fqx 'a: 2147483647' || wail
+
+echo "checking assignment of large negative horizontal measurement" >&2
+echo "$output" | grep -Fqx 'b: -2147483647' || wail
+
+echo "checking assignment of large positive vertical measurement" >&2
+echo "$output" | grep -Fqx 'c: 2147483647' || wail
+
+echo "checking assignment of large negative vertical measurement" >&2
+echo "$output" | grep -Fqx 'd: -2147483647' || wail
+
# Exercise boundary values.
input='.
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit