xref: /freebsd/contrib/bmake/unit-tests/cond-cmp-numeric.mk (revision 36d6566e5985030fd2f1100bd9c1387bbe0bd290)
1# $NetBSD: cond-cmp-numeric.mk,v 1.3 2020/09/12 18:01:51 rillig Exp $
2#
3# Tests for numeric comparisons in .if conditions.
4
5.MAKEFLAGS: -dc
6
7# The ${:U...} on the left-hand side is necessary for the parser.
8
9# Even if strtod(3) parses "INF" as +Infinity, make does not accept this
10# since it is not really a number; see TryParseNumber.
11.if !(${:UINF} > 1e100)
12.  error
13.endif
14
15# Neither is NaN a number; see TryParseNumber.
16.if ${:UNaN} > NaN
17.  error
18.endif
19
20# Since NaN is not parsed as a number, both operands are interpreted
21# as strings and are therefore equal.  If they were parsed as numbers,
22# they would compare unequal, since NaN is unequal to any and everything,
23# including itself.
24.if !(${:UNaN} == NaN)
25.  error
26.endif
27
28all:
29	@:;
30