-
Notifications
You must be signed in to change notification settings - Fork 0
/
export_byte_test.go
50 lines (44 loc) · 894 Bytes
/
export_byte_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
package tools
import (
"fmt"
"testing"
"time"
)
func TestInt64ToBytes(t *testing.T) {
v := DataToBytes(time.Now().Unix())
fmt.Println(v)
//vv := DataToBytes(1645798603)
vv := make([]byte, 10, 16)
vv[0] = 49
vv[1] = 54
vv[2] = 52
vv[3] = 53
vv[4] = 56
vv[5] = 48
vv[6] = 50
vv[7] = 51
vv[8] = 48
vv[9] = 48
fmt.Println(BytesToData[int64](DataToBytes(time.Now().Unix())))
fmt.Println(BytesToData[int64](vv))
fmt.Println(string(vv))
}
func TestFloat32(t *testing.T) {
v := DataToBytes(1645798603.123)
fmt.Println(v)
fmt.Println(BytesToData[float64](DataToBytes(1645798603.123)))
}
func TestFloat64(t *testing.T) {
v := DataToBytes(1645798603.123)
fmt.Println(v)
fmt.Println(BytesToData[float64](DataToBytes(1645798603.123)))
}
func TestStr(t *testing.T) {
fmt.Println(StrFmt(`
{{ if or .a .b .c .d }}
jdfkasfjlkasd
{{ end }}
`, map[string]any{
"a": 1,
}))
}