ab_test.go
927 字节
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
package controllers
import (
"fmt"
"reflect"
"testing"
)
func Test_DeepEqual(t *testing.T) {
input := make(map[string]interface{})
input["A"] =1
input["B"] ="2"
input["C"]=map[string]interface{}{"C1":1,"C2":"2"}
input1 := make(map[string]interface{})
input1["A"] =1
input1["B"] ="2"
input1["C"]=map[string]interface{}{"C1":1,"C2":"2"}
input2 := make(map[string]interface{})
input2["A"] =1
input2["B"] ="3"
input2["C"]=map[string]interface{}{"C1":1,"C2":"2"}
input3 := make(map[string]interface{})
input3["A"] =1
input3["B"] ="2"
input3["C"]=map[string]interface{}{"C1":1,"C2":"3"}
if !reflect.DeepEqual(input,input1){
t.Fatal(fmt.Sprintf("map should equal %v %v",input,input1))
}
if reflect.DeepEqual(input,input2){
t.Fatal(fmt.Sprintf("map should not equal %v %v",input,input2))
}
if reflect.DeepEqual(input,input3){
t.Fatal(fmt.Sprintf("map should not equal %v %v",input,input3))
}
}