ab_test.go 927 字节
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))
	}
}