-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsonmap_test.go
85 lines (66 loc) · 1.43 KB
/
jsonmap_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
// Copyright 2018 <chaishushan{AT}gmail.com>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package jsonmap
import (
"testing"
)
func TestJsonMap(t *testing.T) {
var m0 JsonMap = map[string]interface{}{
"a": 1,
"b": true,
"c": 3.5,
"d": "value-d",
"z": map[string]interface{}{
"zz": 3,
},
}
m1 := m0.ToFlatMap("/")
Assert(t, len(m0) == len(m1))
Assert(t, m1["/a"].(int) == 1)
Assert(t, m1["/b"].(bool) == true)
Assert(t, m1["/c"].(float64) == 3.5)
Assert(t, m1["/d"].(string) == "value-d")
Assert(t, m1["/z/zz"].(int) == 3)
Assert(t, m1["/z"] == nil)
keys := m0.Keys("/")
Assert(t, len(keys) == 5)
Assert(t, keys[0] == "/a")
Assert(t, keys[1] == "/b")
Assert(t, keys[2] == "/c")
Assert(t, keys[3] == "/d")
Assert(t, keys[4] == "/z/zz")
}
func TestJsonMap_fromKV(t *testing.T) {
// todo
}
func TestJsonMap_fromStruct(t *testing.T) {
// todo
}
func TestJsonMap_Keys(t *testing.T) {
// todo
}
func TestJsonMap_DelValue(t *testing.T) {
// todo
}
func TestJsonMap_DelValues(t *testing.T) {
// todo
}
func TestJsonMap_GetValue(t *testing.T) {
// todo
}
func TestJsonMap_SetValue(t *testing.T) {
// todo
}
func TestJsonMap_SetValuesFromKV(t *testing.T) {
// todo
}
func TestJsonMap_SetValuesFromStruct(t *testing.T) {
// todo
}
func TestJsonMap_ToStruct(t *testing.T) {
// todo
}
func TestJsonMap_ToFlatMap(t *testing.T) {
// todo
}