| 872 | } |
| 873 | |
| 874 | func TestExactly(t *testing.T) { |
| 875 | |
| 876 | mockT := new(testing.T) |
| 877 | |
| 878 | a := float32(1) |
| 879 | b := float64(1) |
| 880 | c := float32(1) |
| 881 | d := float32(2) |
| 882 | cases := []struct { |
| 883 | expected interface{} |
| 884 | actual interface{} |
| 885 | result bool |
| 886 | }{ |
| 887 | {a, b, false}, |
| 888 | {a, d, false}, |
| 889 | {a, c, true}, |
| 890 | {nil, a, false}, |
| 891 | {a, nil, false}, |
| 892 | } |
| 893 | |
| 894 | for _, c := range cases { |
| 895 | t.Run(fmt.Sprintf("Exactly(%#v, %#v)", c.expected, c.actual), func(t *testing.T) { |
| 896 | res := Exactly(mockT, c.expected, c.actual) |
| 897 | |
| 898 | if res != c.result { |
| 899 | t.Errorf("Exactly(%#v, %#v) should return %#v", c.expected, c.actual, c.result) |
| 900 | } |
| 901 | }) |
| 902 | } |
| 903 | } |
| 904 | |
| 905 | func TestNotEqual(t *testing.T) { |
| 906 | |