(t *testing.T)
| 177 | } |
| 178 | |
| 179 | func TestAppendBytes(t *testing.T) { |
| 180 | for _, tt := range encodeByteTests { |
| 181 | b := enc.AppendBytes([]byte{}, tt.plain) |
| 182 | if got, want := string(b), tt.binary; got != want { |
| 183 | t.Errorf("appendString(%q) = %#q, want %#q", tt.plain, got, want) |
| 184 | } |
| 185 | } |
| 186 | //Test a large string > 65535 length |
| 187 | |
| 188 | inp := []byte{} |
| 189 | for i := 0; i < 0x00011170; i++ { //70,000 character string |
| 190 | inp = append(inp, byte('a')) |
| 191 | } |
| 192 | want := "\x5a\x00\x01\x11\x70" + string(inp) |
| 193 | b := enc.AppendBytes([]byte{}, inp) |
| 194 | if got := string(b); got != want { |
| 195 | t.Errorf("appendString(%q) = %#q, want %#q", inp, got, want) |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | func BenchmarkAppendString(b *testing.B) { |
| 200 | tests := map[string]string{ |
nothing calls this directly
no test coverage detected