Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests tests/make: test very small and very...
details: https://anonhg.NetBSD.org/src/rev/889d70dce312
branches: trunk
changeset: 373821:889d70dce312
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Mar 04 08:07:29 2023 +0000
description:
tests/make: test very small and very large numbers in conditions
diffstat:
usr.bin/make/unit-tests/cond-cmp-numeric.exp | 8 ++++----
usr.bin/make/unit-tests/cond-cmp-numeric.mk | 11 +++++++----
usr.bin/make/unit-tests/cond-token-number.exp | 1 -
usr.bin/make/unit-tests/cond-token-number.mk | 22 ++++++++++++++++++----
4 files changed, 29 insertions(+), 13 deletions(-)
diffs (111 lines):
diff -r 03c83e0e06ce -r 889d70dce312 usr.bin/make/unit-tests/cond-cmp-numeric.exp
--- a/usr.bin/make/unit-tests/cond-cmp-numeric.exp Fri Mar 03 15:29:48 2023 +0000
+++ b/usr.bin/make/unit-tests/cond-cmp-numeric.exp Sat Mar 04 08:07:29 2023 +0000
@@ -1,15 +1,15 @@
CondParser_Eval: !(${:UINF} > 1e100)
-make: "cond-cmp-numeric.mk" line 11: Comparison with '>' requires both operands 'INF' and '1e100' to be numeric
+make: "cond-cmp-numeric.mk" line 15: Comparison with '>' requires both operands 'INF' and '1e100' to be numeric
CondParser_Eval: ${:UNaN} > NaN
-make: "cond-cmp-numeric.mk" line 16: Comparison with '>' requires both operands 'NaN' and 'NaN' to be numeric
+make: "cond-cmp-numeric.mk" line 21: Comparison with '>' requires both operands 'NaN' and 'NaN' to be numeric
CondParser_Eval: !(${:UNaN} == NaN)
Comparing "NaN" == "NaN"
CondParser_Eval: 123 ! 123
-make: "cond-cmp-numeric.mk" line 34: Malformed conditional (123 ! 123)
+make: "cond-cmp-numeric.mk" line 38: Malformed conditional (123 ! 123)
CondParser_Eval: ${:U 123} < 124
Comparing 123.000000 < 124.000000
CondParser_Eval: ${:U123 } < 124
-make: "cond-cmp-numeric.mk" line 50: Comparison with '<' requires both operands '123 ' and '124' to be numeric
+make: "cond-cmp-numeric.mk" line 54: Comparison with '<' requires both operands '123 ' and '124' to be numeric
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r 03c83e0e06ce -r 889d70dce312 usr.bin/make/unit-tests/cond-cmp-numeric.mk
--- a/usr.bin/make/unit-tests/cond-cmp-numeric.mk Fri Mar 03 15:29:48 2023 +0000
+++ b/usr.bin/make/unit-tests/cond-cmp-numeric.mk Sat Mar 04 08:07:29 2023 +0000
@@ -1,6 +1,9 @@
-# $NetBSD: cond-cmp-numeric.mk,v 1.6 2022/09/04 22:55:00 rillig Exp $
+# $NetBSD: cond-cmp-numeric.mk,v 1.7 2023/03/04 08:07:29 rillig Exp $
#
# Tests for numeric comparisons in .if conditions.
+#
+# See also:
+# cond-token-number.mk
.MAKEFLAGS: -dc
@@ -8,11 +11,13 @@
# Even if strtod(3) parses "INF" as +Infinity, make does not accept this
# since it is not really a number; see TryParseNumber.
+# expect+1: Comparison with '>' requires both operands 'INF' and '1e100' to be numeric
.if !(${:UINF} > 1e100)
. error
.endif
# Neither is NaN a number; see TryParseNumber.
+# expect+1: Comparison with '>' requires both operands 'NaN' and 'NaN' to be numeric
.if ${:UNaN} > NaN
. error
.endif
@@ -29,8 +34,7 @@
# whether the operator is valid, leaving the rest of the work to the
# evaluation functions EvalCompareNum and EvalCompareStr. Ensure that this
# parse error is properly reported.
-#
-# XXX: The warning message does not mention the actual operator.
+# expect+1: Malformed conditional (123 ! 123)
.if 123 ! 123
. error
.else
@@ -54,4 +58,3 @@
.endif
all:
- @:;
diff -r 03c83e0e06ce -r 889d70dce312 usr.bin/make/unit-tests/cond-token-number.exp
--- a/usr.bin/make/unit-tests/cond-token-number.exp Fri Mar 03 15:29:48 2023 +0000
+++ b/usr.bin/make/unit-tests/cond-token-number.exp Sat Mar 04 08:07:29 2023 +0000
@@ -2,7 +2,6 @@
make: "cond-token-number.mk" line 25: Malformed conditional (+0)
make: "cond-token-number.mk" line 35: Malformed conditional (!-1)
make: "cond-token-number.mk" line 45: Malformed conditional (!+1)
-make: "cond-token-number.mk" line 89: End of the tests.
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r 03c83e0e06ce -r 889d70dce312 usr.bin/make/unit-tests/cond-token-number.mk
--- a/usr.bin/make/unit-tests/cond-token-number.mk Fri Mar 03 15:29:48 2023 +0000
+++ b/usr.bin/make/unit-tests/cond-token-number.mk Sat Mar 04 08:07:29 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-number.mk,v 1.7 2022/01/02 02:57:39 rillig Exp $
+# $NetBSD: cond-token-number.mk,v 1.8 2023/03/04 08:07:29 rillig Exp $
#
# Tests for number tokens in .if conditions.
#
@@ -85,7 +85,21 @@
. error
.endif
-# Ensure that parsing continues until here.
-.info End of the tests.
+# Very small numbers round to 0.
+.if 12345e-400
+. error
+.endif
+.if 12345e-200
+.else
+. error
+.endif
-all: # nothing
+# Very large numbers round up to infinity on IEEE 754 implementations, or to
+# the largest representable number (VAX); in particular, make does not fall
+# back to checking whether a variable of that name is defined.
+.if 12345e400
+.else
+. error
+.endif
+
+all:
Home |
Main Index |
Thread Index |
Old Index