(t *testing.T)
| 100 | type AssertionTesterNonConformingObject struct{} |
| 101 | |
| 102 | func TestObjectsAreEqual(t *testing.T) { |
| 103 | t.Parallel() |
| 104 | |
| 105 | cases := []struct { |
| 106 | expected interface{} |
| 107 | actual interface{} |
| 108 | result bool |
| 109 | }{ |
| 110 | // cases that are expected to be equal |
| 111 | {"Hello World", "Hello World", true}, |
| 112 | {123, 123, true}, |
| 113 | {123.5, 123.5, true}, |
| 114 | {[]byte("Hello World"), []byte("Hello World"), true}, |
| 115 | {nil, nil, true}, |
| 116 | |
| 117 | // cases that are expected not to be equal |
| 118 | {map[int]int{5: 10}, map[int]int{10: 20}, false}, |
| 119 | {'x', "x", false}, |
| 120 | {"x", 'x', false}, |
| 121 | {0, 0.1, false}, |
| 122 | {0.1, 0, false}, |
| 123 | {time.Now, time.Now, false}, |
| 124 | {func() {}, func() {}, false}, |
| 125 | {uint32(10), int32(10), false}, |
| 126 | } |
| 127 | |
| 128 | for _, c := range cases { |
| 129 | t.Run(fmt.Sprintf("ObjectsAreEqual(%#v, %#v)", c.expected, c.actual), func(t *testing.T) { |
| 130 | res := ObjectsAreEqual(c.expected, c.actual) |
| 131 | |
| 132 | if res != c.result { |
| 133 | t.Errorf("ObjectsAreEqual(%#v, %#v) should return %#v", c.expected, c.actual, c.result) |
| 134 | } |
| 135 | }) |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | func TestObjectsAreEqualValues(t *testing.T) { |
| 140 | t.Parallel() |
nothing calls this directly
no test coverage detected