-
Notifications
You must be signed in to change notification settings - Fork 1
/
pointer_types_test.go
67 lines (38 loc) · 936 Bytes
/
pointer_types_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
package webutils
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestPointerTypes(t *testing.T) {
s := "abc"
assert.Equal(t, String(s), &s)
b := true
assert.Equal(t, Bool(b), &b)
var f32 float32 = -1.23
assert.Equal(t, Float32(f32), &f32)
var f64 float64 = -1.23
assert.Equal(t, Float64(f64), &f64)
var u8 uint8 = 1
assert.Equal(t, UInt8(u8), &u8)
var u16 uint16 = 1
assert.Equal(t, UInt16(u16), &u16)
var u32 uint32 = 1
assert.Equal(t, UInt32(u32), &u32)
var u64 uint64 = 1
assert.Equal(t, UInt64(u64), &u64)
var u uint = 1
assert.Equal(t, UInt(u), &u)
var i8 int8 = 1
assert.Equal(t, Int8(i8), &i8)
var i16 int16 = 1
assert.Equal(t, Int16(i16), &i16)
var i32 int32 = 1
assert.Equal(t, Int32(i32), &i32)
var i64 int64 = 1
assert.Equal(t, Int64(i64), &i64)
var i int = 1
assert.Equal(t, Int(i), &i)
now := time.Now()
assert.Equal(t, Time(now), &now)
}