-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathptr_test.go
142 lines (107 loc) · 2.07 KB
/
ptr_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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package ptr
import (
"testing"
"time"
)
func TestBool(t *testing.T) {
var b bool = true
if *Bool(b) != b {
t.Error("did not get a pointer back")
}
}
func TestByte(t *testing.T) {
b := []byte{'a'}
if *Byte(b[0]) != b[0] {
t.Error("did not get a pointer back")
}
}
func TestFloat32(t *testing.T) {
var f float32 = 123.12
if *Float32(f) != f {
t.Error("did not get a pointer back")
}
}
func TestFloat64(t *testing.T) {
var f float64 = 123.12
if *Float64(f) != f {
t.Error("did not get a pointer back")
}
}
func TestInt(t *testing.T) {
var i int = 123
if *Int(i) != i {
t.Error("did not get a pointer back")
}
}
func TestInt8(t *testing.T) {
var i int8 = 123
if *Int8(i) != i {
t.Error("did not get a pointer back")
}
}
func TestInt16(t *testing.T) {
var i int16 = 123
if *Int16(i) != i {
t.Error("did not get a pointer back")
}
}
func TestInt32(t *testing.T) {
var i int32 = 123
if *Int32(i) != i {
t.Error("did not get a pointer back")
}
}
func TestInt64(t *testing.T) {
var i int64 = 123
if *Int64(i) != i {
t.Error("did not get a pointer back")
}
}
func TestRune(t *testing.T) {
var r rune = 1
if *Rune(r) != r {
t.Error("did not get a pointer back")
}
}
func TestString(t *testing.T) {
var i string = "What was the question to life, universe and everything?"
if *String(i) != i {
t.Error("did not get a pointer back")
}
}
func TestTime(t *testing.T) {
o := time.Now().UTC()
if *Time(o) != o {
t.Error("did not get a pointer back")
}
}
func TestUint(t *testing.T) {
var i uint = 123
if *Uint(i) != i {
t.Error("did not get a pointer back")
}
}
func TestUint8(t *testing.T) {
var i uint8 = 123
if *Uint8(i) != i {
t.Error("did not get a pointer back")
}
}
func TestUint16(t *testing.T) {
var i uint16 = 123
if *Uint16(i) != i {
t.Error("did not get a pointer back")
}
}
func TestUint32(t *testing.T) {
var i uint32 = 123
if *Uint32(i) != i {
t.Error("did not get a pointer back")
}
}
func TestUint64(t *testing.T) {
var i uint64 = 123
if *Uint64(i) != i {
t.Error("did not get a pointer back")
}
}