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