MCPcopy Create free account
hub / github.com/aws/smithy-go / TestCompareValues

Function TestCompareValues

testing/struct_test.go:14–297  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestCompareValues(t *testing.T) {
15 const float64NaN = 0x7fffffff_ffffffff // mantissa flipped all the way on
16
17 cases := map[string]struct {
18 A, B interface{}
19 ExpectErr string
20 }{
21 "totally different types": {
22 A: 1,
23 B: struct {
24 Foo string
25 Bar int
26 }{
27 Foo: "abc",
28 Bar: 123,
29 },
30 ExpectErr: "<root>: kind int != struct",
31 },
32 "simple match": {
33 A: struct {
34 Foo string
35 Bar int
36 Metadata middleware.Metadata
37 }{
38 Foo: "abc",
39 Bar: 123,
40 Metadata: func() middleware.Metadata {
41 var md middleware.Metadata
42 md.Set(1, 1)
43 return md
44 }(),
45 },
46 B: struct {
47 Foo string
48 Bar int
49 Metadata middleware.Metadata
50 }{
51 Foo: "abc",
52 Bar: 123,
53 Metadata: middleware.Metadata{}, // different, shouldn't matter
54 },
55 },
56 "simple diff": {
57 A: struct {
58 Foo string
59 Bar int
60 }{
61 Foo: "abc",
62 Bar: 123,
63 },
64 B: struct {
65 Foo string
66 Bar int
67 }{
68 Foo: "abc",
69 Bar: 456,
70 },
71 ExpectErr: "<root>.Bar: 123 != 456",

Callers

nothing calls this directly

Calls 4

SetMethod · 0.95
IntFunction · 0.92
CompareValuesFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected