OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [floatcmp.go] - Blame information for rev 700

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// $G $F.go && $L $F.$A && ./$A.out
2
 
3
// Copyright 2009 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
package main
8
 
9
import "math"
10
 
11
type floatTest struct {
12
        name string
13
        expr bool
14
        want bool
15
}
16
 
17
var nan float64 = math.NaN()
18
var f float64 = 1
19
 
20
var tests = []floatTest{
21
        floatTest{"nan == nan", nan == nan, false},
22
        floatTest{"nan != nan", nan != nan, true},
23
        floatTest{"nan < nan", nan < nan, false},
24
        floatTest{"nan > nan", nan > nan, false},
25
        floatTest{"nan <= nan", nan <= nan, false},
26
        floatTest{"nan >= nan", nan >= nan, false},
27
        floatTest{"f == nan", f == nan, false},
28
        floatTest{"f != nan", f != nan, true},
29
        floatTest{"f < nan", f < nan, false},
30
        floatTest{"f > nan", f > nan, false},
31
        floatTest{"f <= nan", f <= nan, false},
32
        floatTest{"f >= nan", f >= nan, false},
33
        floatTest{"nan == f", nan == f, false},
34
        floatTest{"nan != f", nan != f, true},
35
        floatTest{"nan < f", nan < f, false},
36
        floatTest{"nan > f", nan > f, false},
37
        floatTest{"nan <= f", nan <= f, false},
38
        floatTest{"nan >= f", nan >= f, false},
39
        floatTest{"!(nan == nan)", !(nan == nan), true},
40
        floatTest{"!(nan != nan)", !(nan != nan), false},
41
        floatTest{"!(nan < nan)", !(nan < nan), true},
42
        floatTest{"!(nan > nan)", !(nan > nan), true},
43
        floatTest{"!(nan <= nan)", !(nan <= nan), true},
44
        floatTest{"!(nan >= nan)", !(nan >= nan), true},
45
        floatTest{"!(f == nan)", !(f == nan), true},
46
        floatTest{"!(f != nan)", !(f != nan), false},
47
        floatTest{"!(f < nan)", !(f < nan), true},
48
        floatTest{"!(f > nan)", !(f > nan), true},
49
        floatTest{"!(f <= nan)", !(f <= nan), true},
50
        floatTest{"!(f >= nan)", !(f >= nan), true},
51
        floatTest{"!(nan == f)", !(nan == f), true},
52
        floatTest{"!(nan != f)", !(nan != f), false},
53
        floatTest{"!(nan < f)", !(nan < f), true},
54
        floatTest{"!(nan > f)", !(nan > f), true},
55
        floatTest{"!(nan <= f)", !(nan <= f), true},
56
        floatTest{"!(nan >= f)", !(nan >= f), true},
57
        floatTest{"!!(nan == nan)", !!(nan == nan), false},
58
        floatTest{"!!(nan != nan)", !!(nan != nan), true},
59
        floatTest{"!!(nan < nan)", !!(nan < nan), false},
60
        floatTest{"!!(nan > nan)", !!(nan > nan), false},
61
        floatTest{"!!(nan <= nan)", !!(nan <= nan), false},
62
        floatTest{"!!(nan >= nan)", !!(nan >= nan), false},
63
        floatTest{"!!(f == nan)", !!(f == nan), false},
64
        floatTest{"!!(f != nan)", !!(f != nan), true},
65
        floatTest{"!!(f < nan)", !!(f < nan), false},
66
        floatTest{"!!(f > nan)", !!(f > nan), false},
67
        floatTest{"!!(f <= nan)", !!(f <= nan), false},
68
        floatTest{"!!(f >= nan)", !!(f >= nan), false},
69
        floatTest{"!!(nan == f)", !!(nan == f), false},
70
        floatTest{"!!(nan != f)", !!(nan != f), true},
71
        floatTest{"!!(nan < f)", !!(nan < f), false},
72
        floatTest{"!!(nan > f)", !!(nan > f), false},
73
        floatTest{"!!(nan <= f)", !!(nan <= f), false},
74
        floatTest{"!!(nan >= f)", !!(nan >= f), false},
75
}
76
 
77
func main() {
78
        bad := false
79
        for _, t := range tests {
80
                if t.expr != t.want {
81
                        if !bad {
82
                                bad = true
83
                                println("BUG: floatcmp")
84
                        }
85
                        println(t.name, "=", t.expr, "want", t.want)
86
                }
87
        }
88
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.