1// errorcheck
2
3// Copyright 2015 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7// Verify that error messages print meaningful values
8// for various extreme floating-point constants.
9
10package p
11
12// failure case in issue
13const _ int64 = 1e-10000 // ERROR "1e\-10000 truncated|.* truncated to int64|truncated"
14
15const (
16	_ int64 = 1e10000000 // ERROR "integer too large|truncated to int64|truncated"
17	_ int64 = 1e1000000  // ERROR "integer too large|truncated to int64|truncated"
18	_ int64 = 1e100000   // ERROR "integer too large|truncated to int64|truncated"
19	_ int64 = 1e10000    // ERROR "integer too large|truncated to int64|truncated"
20	_ int64 = 1e1000     // ERROR "integer too large|truncated to int64|truncated"
21	_ int64 = 1e100      // ERROR "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows|truncated to int64|truncated"
22	_ int64 = 1e10
23	_ int64 = 1e1
24	_ int64 = 1e0
25	_ int64 = 1e-1       // ERROR "0\.1 truncated|.* truncated to int64|truncated"
26	_ int64 = 1e-10      // ERROR "1e\-10 truncated|.* truncated to int64|truncated"
27	_ int64 = 1e-100     // ERROR "1e\-100 truncated|.* truncated to int64|truncated"
28	_ int64 = 1e-1000    // ERROR "1e\-1000 truncated|.* truncated to int64|truncated"
29	_ int64 = 1e-10000   // ERROR "1e\-10000 truncated|.* truncated to int64|truncated"
30	_ int64 = 1e-100000  // ERROR "1e\-100000 truncated|.* truncated to int64|truncated"
31	_ int64 = 1e-1000000 // ERROR "1e\-1000000 truncated|.* truncated to int64|truncated"
32)
33
34const (
35	_ int64 = -1e10000000 // ERROR "integer too large|truncated to int64|truncated"
36	_ int64 = -1e1000000  // ERROR "integer too large|truncated to int64|truncated"
37	_ int64 = -1e100000   // ERROR "integer too large|truncated to int64|truncated"
38	_ int64 = -1e10000    // ERROR "integer too large|truncated to int64|truncated"
39	_ int64 = -1e1000     // ERROR "integer too large|truncated to int64|truncated"
40	_ int64 = -1e100      // ERROR "\-10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows|truncated to int64|truncated"
41	_ int64 = -1e10
42	_ int64 = -1e1
43	_ int64 = -1e0
44	_ int64 = -1e-1       // ERROR "\-0\.1 truncated|.* truncated to int64|truncated"
45	_ int64 = -1e-10      // ERROR "\-1e\-10 truncated|.* truncated to int64|truncated"
46	_ int64 = -1e-100     // ERROR "\-1e\-100 truncated|.* truncated to int64|truncated"
47	_ int64 = -1e-1000    // ERROR "\-1e\-1000 truncated|.* truncated to int64|truncated"
48	_ int64 = -1e-10000   // ERROR "\-1e\-10000 truncated|.* truncated to int64|truncated"
49	_ int64 = -1e-100000  // ERROR "\-1e\-100000 truncated|.* truncated to int64|truncated"
50	_ int64 = -1e-1000000 // ERROR "\-1e\-1000000 truncated|.* truncated to int64|truncated"
51)
52
53const (
54	_ int64 = 1.23456789e10000000 // ERROR "integer too large|truncated to int64|truncated"
55	_ int64 = 1.23456789e1000000  // ERROR "integer too large|truncated to int64|truncated"
56	_ int64 = 1.23456789e100000   // ERROR "integer too large|truncated to int64|truncated"
57	_ int64 = 1.23456789e10000    // ERROR "integer too large|truncated to int64|truncated"
58	_ int64 = 1.23456789e1000     // ERROR "integer too large|truncated to int64|truncated"
59	_ int64 = 1.23456789e100      // ERROR "12345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows|truncated to int64|truncated"
60	_ int64 = 1.23456789e10
61	_ int64 = 1.23456789e1        // ERROR "12\.3457 truncated|.* truncated to int64|truncated"
62	_ int64 = 1.23456789e0        // ERROR "1\.23457 truncated|.* truncated to int64|truncated"
63	_ int64 = 1.23456789e-1       // ERROR "0\.123457 truncated|.* truncated to int64|truncated"
64	_ int64 = 1.23456789e-10      // ERROR "1\.23457e\-10 truncated|.* truncated to int64|truncated"
65	_ int64 = 1.23456789e-100     // ERROR "1\.23457e\-100 truncated|.* truncated to int64|truncated"
66	_ int64 = 1.23456789e-1000    // ERROR "1\.23457e\-1000 truncated|.* truncated to int64|truncated"
67	_ int64 = 1.23456789e-10000   // ERROR "1\.23457e\-10000 truncated|.* truncated to int64|truncated"
68	_ int64 = 1.23456789e-100000  // ERROR "1\.23457e\-100000 truncated|.* truncated to int64|truncated"
69	_ int64 = 1.23456789e-1000000 // ERROR "1\.23457e\-1000000 truncated|.* truncated to int64|truncated"
70)
71
72const (
73	_ int64 = -1.23456789e10000000 // ERROR "integer too large|truncated to int64|truncated"
74	_ int64 = -1.23456789e1000000  // ERROR "integer too large|truncated to int64|truncated"
75	_ int64 = -1.23456789e100000   // ERROR "integer too large|truncated to int64|truncated"
76	_ int64 = -1.23456789e10000    // ERROR "integer too large|truncated to int64|truncated"
77	_ int64 = -1.23456789e1000     // ERROR "integer too large|truncated to int64|truncated"
78	_ int64 = -1.23456789e100      // ERROR "\-12345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows|truncated to int64|truncated"
79	_ int64 = -1.23456789e10
80	_ int64 = -1.23456789e1        // ERROR "\-12\.3457 truncated|.* truncated to int64|truncated"
81	_ int64 = -1.23456789e0        // ERROR "\-1\.23457 truncated|.* truncated to int64|truncated"
82	_ int64 = -1.23456789e-1       // ERROR "\-0\.123457 truncated|.* truncated to int64|truncated"
83	_ int64 = -1.23456789e-10      // ERROR "\-1\.23457e\-10 truncated|.* truncated to int64|truncated"
84	_ int64 = -1.23456789e-100     // ERROR "\-1\.23457e\-100 truncated|.* truncated to int64|truncated"
85	_ int64 = -1.23456789e-1000    // ERROR "\-1\.23457e\-1000 truncated|.* truncated to int64|truncated"
86	_ int64 = -1.23456789e-10000   // ERROR "\-1\.23457e\-10000 truncated|.* truncated to int64|truncated"
87	_ int64 = -1.23456789e-100000  // ERROR "\-1\.23457e\-100000 truncated|.* truncated to int64|truncated"
88	_ int64 = -1.23456789e-1000000 // ERROR "\-1\.23457e\-1000000 truncated|.* truncated to int64|truncated"
89)
90