...
Run Format

Source file test/fixedbugs/issue13559.go

Documentation: test/fixedbugs

     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  
    10  package p
    11  
    12  // failure case in issue
    13  const _ int64 = 1e-10000 // ERROR "1e\-10000 truncated"
    14  
    15  const (
    16  	_ int64 = 1e10000000 // ERROR "integer too large"
    17  	_ int64 = 1e1000000  // ERROR "integer too large"
    18  	_ int64 = 1e100000   // ERROR "integer too large"
    19  	_ int64 = 1e10000    // ERROR "integer too large"
    20  	_ int64 = 1e1000     // ERROR "integer too large"
    21  	_ int64 = 1e100      // ERROR "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
    22  	_ int64 = 1e10
    23  	_ int64 = 1e1
    24  	_ int64 = 1e0
    25  	_ int64 = 1e-1       // ERROR "0\.1 truncated"
    26  	_ int64 = 1e-10      // ERROR "1e\-10 truncated"
    27  	_ int64 = 1e-100     // ERROR "1e\-100 truncated"
    28  	_ int64 = 1e-1000    // ERROR "1e\-1000 truncated"
    29  	_ int64 = 1e-10000   // ERROR "1e\-10000 truncated"
    30  	_ int64 = 1e-100000  // ERROR "1e\-100000 truncated"
    31  	_ int64 = 1e-1000000 // ERROR "1e\-1000000 truncated"
    32  )
    33  
    34  const (
    35  	_ int64 = -1e10000000 // ERROR "integer too large"
    36  	_ int64 = -1e1000000  // ERROR "integer too large"
    37  	_ int64 = -1e100000   // ERROR "integer too large"
    38  	_ int64 = -1e10000    // ERROR "integer too large"
    39  	_ int64 = -1e1000     // ERROR "integer too large"
    40  	_ int64 = -1e100      // ERROR "\-10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
    41  	_ int64 = -1e10
    42  	_ int64 = -1e1
    43  	_ int64 = -1e0
    44  	_ int64 = -1e-1       // ERROR "\-0\.1 truncated"
    45  	_ int64 = -1e-10      // ERROR "\-1e\-10 truncated"
    46  	_ int64 = -1e-100     // ERROR "\-1e\-100 truncated"
    47  	_ int64 = -1e-1000    // ERROR "\-1e\-1000 truncated"
    48  	_ int64 = -1e-10000   // ERROR "\-1e\-10000 truncated"
    49  	_ int64 = -1e-100000  // ERROR "\-1e\-100000 truncated"
    50  	_ int64 = -1e-1000000 // ERROR "\-1e\-1000000 truncated"
    51  )
    52  
    53  const (
    54  	_ int64 = 1.23456789e10000000 // ERROR "integer too large"
    55  	_ int64 = 1.23456789e1000000  // ERROR "integer too large"
    56  	_ int64 = 1.23456789e100000   // ERROR "integer too large"
    57  	_ int64 = 1.23456789e10000    // ERROR "integer too large"
    58  	_ int64 = 1.23456789e1000     // ERROR "integer too large"
    59  	_ int64 = 1.23456789e100      // ERROR "12345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
    60  	_ int64 = 1.23456789e10
    61  	_ int64 = 1.23456789e1        // ERROR "12\.3457 truncated"
    62  	_ int64 = 1.23456789e0        // ERROR "1\.23457 truncated"
    63  	_ int64 = 1.23456789e-1       // ERROR "0\.123457 truncated"
    64  	_ int64 = 1.23456789e-10      // ERROR "1\.23457e\-10 truncated"
    65  	_ int64 = 1.23456789e-100     // ERROR "1\.23457e\-100 truncated"
    66  	_ int64 = 1.23456789e-1000    // ERROR "1\.23457e\-1000 truncated"
    67  	_ int64 = 1.23456789e-10000   // ERROR "1\.23457e\-10000 truncated"
    68  	_ int64 = 1.23456789e-100000  // ERROR "1\.23457e\-100000 truncated"
    69  	_ int64 = 1.23456789e-1000000 // ERROR "1\.23457e\-1000000 truncated"
    70  )
    71  
    72  const (
    73  	_ int64 = -1.23456789e10000000 // ERROR "integer too large"
    74  	_ int64 = -1.23456789e1000000  // ERROR "integer too large"
    75  	_ int64 = -1.23456789e100000   // ERROR "integer too large"
    76  	_ int64 = -1.23456789e10000    // ERROR "integer too large"
    77  	_ int64 = -1.23456789e1000     // ERROR "integer too large"
    78  	_ int64 = -1.23456789e100      // ERROR "\-12345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
    79  	_ int64 = -1.23456789e10
    80  	_ int64 = -1.23456789e1        // ERROR "\-12\.3457 truncated"
    81  	_ int64 = -1.23456789e0        // ERROR "\-1\.23457 truncated"
    82  	_ int64 = -1.23456789e-1       // ERROR "\-0\.123457 truncated"
    83  	_ int64 = -1.23456789e-10      // ERROR "\-1\.23457e\-10 truncated"
    84  	_ int64 = -1.23456789e-100     // ERROR "\-1\.23457e\-100 truncated"
    85  	_ int64 = -1.23456789e-1000    // ERROR "\-1\.23457e\-1000 truncated"
    86  	_ int64 = -1.23456789e-10000   // ERROR "\-1\.23457e\-10000 truncated"
    87  	_ int64 = -1.23456789e-100000  // ERROR "\-1\.23457e\-100000 truncated"
    88  	_ int64 = -1.23456789e-1000000 // ERROR "\-1\.23457e\-1000000 truncated"
    89  )
    90  

View as plain text