-
Notifications
You must be signed in to change notification settings - Fork 1
/
print_primitives_pointer_test.go
60 lines (46 loc) · 1.08 KB
/
print_primitives_pointer_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
package pprnt
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func Test_PrintPointerString(t *testing.T) {
cases := []*string{
GetStringAdddress("t1"),
GetStringAdddress("t2"),
GetStringAdddress("t3"),
GetStringAdddress("t4"),
GetStringAdddress("t5"),
}
for _, c := range cases {
output := Print(c)
assert.Equal(t, fmt.Sprintf("\"%+v\"\n", *c), output)
}
}
func Test_PrintPointerInt(t *testing.T) {
cases := []*int{
new(int), new(int), new(int), new(int), new(int),
}
for _, c := range cases {
output := Print(c)
assert.Equal(t, fmt.Sprintf("%+v\n", *c), output)
}
}
func Test_PrintPointerBoolean(t *testing.T) {
cases := []*bool{
new(bool), new(bool), new(bool), new(bool), new(bool),
}
for _, c := range cases {
output := Print(c)
assert.Equal(t, fmt.Sprintf("%+v\n", *c), output)
}
}
func Test_PrintPointerFloat64(t *testing.T) {
cases := []*float64{
new(float64), new(float64), new(float64), new(float64), new(float64),
}
for _, c := range cases {
output := Print(c)
assert.Equal(t, fmt.Sprintf("%+v\n", *c), output)
}
}