forked from joeig/go-powerdns
-
Notifications
You must be signed in to change notification settings - Fork 1
/
type_conversions_test.go
71 lines (62 loc) · 1.3 KB
/
type_conversions_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package powerdns
import "testing"
func TestBool(t *testing.T) {
source := true
if *Bool(source) != source {
t.Error("Invalid return value")
}
}
func TestBoolValue(t *testing.T) {
source := true
if BoolValue(&source) != source {
t.Error("Invalid return value")
}
if BoolValue(nil) != false {
t.Error("Unexpected return value")
}
}
func TestUint32(t *testing.T) {
source := uint32(1337)
if *Uint32(source) != source {
t.Error("Invalid return value")
}
}
func TestUint32Value(t *testing.T) {
source := uint32(1337)
if Uint32Value(&source) != source {
t.Error("Invalid return value")
}
if Uint32Value(nil) != 0 {
t.Error("Unexpected return value")
}
}
func TestUint64(t *testing.T) {
source := uint64(1337)
if *Uint64(source) != source {
t.Error("Invalid return value")
}
}
func TestUint64Value(t *testing.T) {
source := uint64(1337)
if Uint64Value(&source) != source {
t.Error("Invalid return value")
}
if Uint64Value(nil) != 0 {
t.Error("Unexpected return value")
}
}
func TestString(t *testing.T) {
source := "foo"
if *String(source) != source {
t.Error("Invalid return value")
}
}
func TestStringValue(t *testing.T) {
source := "foo"
if StringValue(&source) != source {
t.Error("Invalid return value")
}
if StringValue(nil) != "" {
t.Error("Unexpected return value")
}
}