summaryrefslogtreecommitdiff
path: root/unit-tests/cond-cmp-numeric.mk
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/cond-cmp-numeric.mk')
-rw-r--r--unit-tests/cond-cmp-numeric.mk25
1 files changed, 23 insertions, 2 deletions
diff --git a/unit-tests/cond-cmp-numeric.mk b/unit-tests/cond-cmp-numeric.mk
index 409636c3c3ca..67358ddaf86b 100644
--- a/unit-tests/cond-cmp-numeric.mk
+++ b/unit-tests/cond-cmp-numeric.mk
@@ -1,8 +1,29 @@
-# $NetBSD: cond-cmp-numeric.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: cond-cmp-numeric.mk,v 1.3 2020/09/12 18:01:51 rillig Exp $
#
# Tests for numeric comparisons in .if conditions.
-# TODO: Implementation
+.MAKEFLAGS: -dc
+
+# The ${:U...} on the left-hand side is necessary for the parser.
+
+# Even if strtod(3) parses "INF" as +Infinity, make does not accept this
+# since it is not really a number; see TryParseNumber.
+.if !(${:UINF} > 1e100)
+. error
+.endif
+
+# Neither is NaN a number; see TryParseNumber.
+.if ${:UNaN} > NaN
+. error
+.endif
+
+# Since NaN is not parsed as a number, both operands are interpreted
+# as strings and are therefore equal. If they were parsed as numbers,
+# they would compare unequal, since NaN is unequal to any and everything,
+# including itself.
+.if !(${:UNaN} == NaN)
+. error
+.endif
all:
@:;