forked from go-critic/go-critic
/
negative_tests.go
78 lines (63 loc) · 967 Bytes
/
negative_tests.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package checker_test
import (
"bytes"
"strings"
)
type s []string
func (s) Compare(x, y string) int {
if x < y {
return 1
}
return 0
}
func negative() {
bytes.Compare([]byte{}, []byte{})
strings := s{}
_ = strings.Compare("1", "3") == 0
}
func negative2() {
var a, b = "aaa", "bbb"
if a > b {
print(1)
}
if a == b {
print(0)
}
if a < b {
print(-1)
}
switch a > b {
case true:
print(1)
case false:
print(0, -1)
}
}
func negative3() {
if "aaa" > "bbb" {
print(1)
}
if "aaa" == "bbb" {
print(0)
}
if "aaa" < "bbb" {
print(-1)
}
switch "aaa" > "bbb" {
case true:
print(1)
case false:
print(0, -1)
}
}
func negative4() {
f, b := "aaa", "bbb"
_ = strings.Compare(f, b) > -100
_ = strings.Compare(f, b) < 100
_ = strings.Compare(f, b) >= -1
_ = strings.Compare(f, b) <= -1
_ = strings.Compare(f, b) >= 1
_ = strings.Compare(f, b) <= 1
_ = strings.Compare(f, b) >= 0
_ = strings.Compare(f, b) <= 0
}