// Copyright 2025 The Go MCP SDK Authors. All rights reserved. // Use of this source code is governed by an MIT-style // license that can be found in the LICENSE file. package jsonschema import "testing" func TestEqual(t *testing.T) { for _, tt := range []struct { x1, x2 any want bool }{ {0, 1, false}, {1, 1.0, true}, {nil, 0, false}, {"0", 0, false}, {2.5, 2.5, true}, {[]int{1, 2}, []float64{1.0, 2.0}, true}, {[]int(nil), []int{}, false}, {[]map[string]any(nil), []map[string]any{}, false}, { map[string]any{"a": 1, "b": 2.0}, map[string]any{"a": 1.0, "b": 2}, true, }, } { check := func(x1, x2 any, want bool) { t.Helper() if got := Equal(x1, x2); got != want { t.Errorf("jsonEqual(%#v, %#v) = %t, want %t", x1, x2, got, want) } } check(tt.x1, tt.x1, true) check(tt.x2, tt.x2, true) check(tt.x1, tt.x2, tt.want) check(tt.x2, tt.x1, tt.want) } }