Home | History | Annotate | Line # | Download | only in unit-tests
cond-token-number.mk revision 1.3
      1  1.3  rillig # $NetBSD: cond-token-number.mk,v 1.3 2020/09/14 06:22:59 rillig Exp $
      2  1.1  rillig #
      3  1.2  rillig # Tests for number tokens in .if conditions.
      4  1.1  rillig 
      5  1.3  rillig .if 0
      6  1.3  rillig .  error
      7  1.3  rillig .endif
      8  1.1  rillig 
      9  1.3  rillig # Even though -0 is a number and would be accepted by strtod, it is not
     10  1.3  rillig # accepted by the condition parser.
     11  1.3  rillig #
     12  1.3  rillig # See the ch_isdigit call in CondParser_String.
     13  1.3  rillig .if -0
     14  1.3  rillig .  error
     15  1.3  rillig .endif
     16  1.3  rillig 
     17  1.3  rillig # Even though +0 is a number and would be accepted by strtod, it is not
     18  1.3  rillig # accepted by the condition parser.
     19  1.3  rillig #
     20  1.3  rillig # See the ch_isdigit call in CondParser_String.
     21  1.3  rillig .if +0
     22  1.3  rillig .  error
     23  1.3  rillig .endif
     24  1.3  rillig 
     25  1.3  rillig # Even though -1 is a number and would be accepted by strtod, it is not
     26  1.3  rillig # accepted by the condition parser.
     27  1.3  rillig #
     28  1.3  rillig # See the ch_isdigit call in CondParser_String.
     29  1.3  rillig .if !-1
     30  1.3  rillig .  error
     31  1.3  rillig .endif
     32  1.3  rillig 
     33  1.3  rillig # Even though +1 is a number and would be accepted by strtod, it is not
     34  1.3  rillig # accepted by the condition parser.
     35  1.3  rillig #
     36  1.3  rillig # See the ch_isdigit call in CondParser_String.
     37  1.3  rillig .if !+1
     38  1.3  rillig .  error
     39  1.3  rillig .endif
     40  1.3  rillig 
     41  1.3  rillig # When the number comes from a variable expression though, it may be signed.
     42  1.3  rillig # XXX: This is inconsistent.
     43  1.3  rillig .if ${:U+0}
     44  1.3  rillig .  error
     45  1.3  rillig .endif
     46  1.3  rillig 
     47  1.3  rillig # When the number comes from a variable expression though, it may be signed.
     48  1.3  rillig # XXX: This is inconsistent.
     49  1.3  rillig .if !${:U+1}
     50  1.3  rillig .  error
     51  1.3  rillig .endif
     52  1.3  rillig 
     53  1.3  rillig # Ensure that parsing continues until here.
     54  1.3  rillig .info End of the tests.
     55  1.3  rillig 
     56  1.3  rillig all: # nothing
     57