1 /* Copyright (C) 2000 Free Software Foundation, Inc.  */
2 
3 /* { dg-do run } */
4 /* { dg-options "-trigraphs" } */
5 
6 /* Test lexing of numbers.  */
7 
8 #if DEBUG
9 extern int puts (const char *);
10 #else
11 #define puts(X)
12 #endif
13 extern void abort (void);
14 #define err(str) do { puts(str); abort(); } while (0)
15 
16 /* Escaped newlines.  */
17 #define foo 12\
18 3\
19 \
20 4??/
21 5
22 
23 #if foo != 12345
24 #error foo
25 #endif
26 
main(int argc,char * argv[])27 int main (int argc, char *argv[])
28 {
29   double a = 5.;
30   double x = .5;
31 
32 /* Decimal points, including initially and immediately before and
33    after an escaped newline.  */
34   if (a != 5)
35     err ("a");
36   if (x != .\
37 5)
38     err ("x != .5");
39   x = 25\
40 .\
41 6;
42   if (x != 25.6)
43     err ("x != 25.6");
44 
45   /* Test exponentials and their signs.  A buggy lexer is more likely
46      to fail the compile, but never mind.  */
47   if (250 != 25e+1 || 250 != 25e1 || 250 != 2500e-1)
48     err ("exponentials");
49 
50   /* Todo: p exponentials, and how to test preprocessing number
51      tokenisation?  */
52 
53   return 0;
54 }
55