generated from sensu/check-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
main_test.go
53 lines (48 loc) · 1.07 KB
/
main_test.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
package main
import (
"testing"
)
func TestMain(t *testing.T) {
}
func TestAll(t *testing.T) {
got := all("foo", "bar", "baz")
if got != true {
t.Error("got false, want true")
}
got = all("foo", "", "baz")
if got == true {
t.Error("got true, want false")
}
got = all("", "", "")
if got == true {
t.Error("got true, want false")
}
}
func TestAny(t *testing.T) {
got := any("foo", "bar", "baz")
if got != true {
t.Error("got false, want true")
}
got = any("", "bar", "")
if got != true {
t.Error("got false, want true")
}
got = any("", "", "")
if got == true {
t.Error("got true, want false")
}
}
func TestCast(t *testing.T) {
if got, want := cast("5"), int(5); got != want {
t.Errorf("bad cast: got %v, want %v", got, want)
}
if got, want := cast("5.5"), float64(5.5); got != want {
t.Errorf("bad cast: got %v, want %v", got, want)
}
if got, want := cast("foo"), "foo"; got != want {
t.Errorf("bad cast: got %v, want %v", got, want)
}
if got, want := cast(""), (interface{})(nil); got != want {
t.Errorf("bad cast: got %v, want %v", got, want)
}
}