(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestByteViewEqual(t *testing.T) { |
| 68 | tests := []struct { |
| 69 | a interface{} // string or []byte |
| 70 | b interface{} // string or []byte |
| 71 | want bool |
| 72 | }{ |
| 73 | {"x", "x", true}, |
| 74 | {"x", "y", false}, |
| 75 | {"x", "yy", false}, |
| 76 | {[]byte("x"), []byte("x"), true}, |
| 77 | {[]byte("x"), []byte("y"), false}, |
| 78 | {[]byte("x"), []byte("yy"), false}, |
| 79 | {[]byte("x"), "x", true}, |
| 80 | {[]byte("x"), "y", false}, |
| 81 | {[]byte("x"), "yy", false}, |
| 82 | {"x", []byte("x"), true}, |
| 83 | {"x", []byte("y"), false}, |
| 84 | {"x", []byte("yy"), false}, |
| 85 | } |
| 86 | for i, tt := range tests { |
| 87 | va := of(tt.a) |
| 88 | if bytes, ok := tt.b.([]byte); ok { |
| 89 | if got := va.EqualBytes(bytes); got != tt.want { |
| 90 | t.Errorf("%d. EqualBytes = %v; want %v", i, got, tt.want) |
| 91 | } |
| 92 | } else { |
| 93 | if got := va.EqualString(tt.b.(string)); got != tt.want { |
| 94 | t.Errorf("%d. EqualString = %v; want %v", i, got, tt.want) |
| 95 | } |
| 96 | } |
| 97 | if got := va.Equal(of(tt.b)); got != tt.want { |
| 98 | t.Errorf("%d. Equal = %v; want %v", i, got, tt.want) |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | func TestByteViewSlice(t *testing.T) { |
| 104 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…