(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestCompressionRLEncode(t *testing.T) { |
| 11 | tests := []struct { |
| 12 | name string |
| 13 | data string |
| 14 | want string |
| 15 | }{ |
| 16 | { |
| 17 | name: "test 1", |
| 18 | data: "WWWWWWWWWWWWBWWWWWWWWWWWWBBB", |
| 19 | want: "12W1B12W3B", |
| 20 | }, |
| 21 | { |
| 22 | name: "test 2", |
| 23 | data: "AABCCCDEEEE", |
| 24 | want: "2A1B3C1D4E", |
| 25 | }, |
| 26 | { |
| 27 | name: "test 3", |
| 28 | data: "AAAABBBCCDA", |
| 29 | want: "4A3B2C1D1A", |
| 30 | }, |
| 31 | } |
| 32 | |
| 33 | for _, tt := range tests { |
| 34 | t.Run(tt.name, func(t *testing.T) { |
| 35 | if got := compression.RLEncode(tt.data); got != tt.want { |
| 36 | t.Errorf("RLEncode() = %v, want %v", got, tt.want) |
| 37 | } |
| 38 | }) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func TestCompressionRLEDecode(t *testing.T) { |
| 43 | tests := []struct { |
nothing calls this directly
no test coverage detected