(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestCompressionRLEncodeBytes(t *testing.T) { |
| 75 | tests := []struct { |
| 76 | name string |
| 77 | data []byte |
| 78 | want []byte |
| 79 | }{ |
| 80 | { |
| 81 | name: "test 1", |
| 82 | data: []byte("WWWWWWWWWWWWBWWWWWWWWWWWWBBB"), |
| 83 | want: []byte{12, 'W', 1, 'B', 12, 'W', 3, 'B'}, |
| 84 | }, |
| 85 | { |
| 86 | name: "test 2", |
| 87 | data: []byte("AABCCCDEEEE"), |
| 88 | want: []byte{2, 'A', 1, 'B', 3, 'C', 1, 'D', 4, 'E'}, |
| 89 | }, |
| 90 | { |
| 91 | name: "test 3", |
| 92 | data: []byte("AAAABBBCCDA"), |
| 93 | want: []byte{4, 'A', 3, 'B', 2, 'C', 1, 'D', 1, 'A'}, |
| 94 | }, |
| 95 | } |
| 96 | |
| 97 | for _, tt := range tests { |
| 98 | t.Run(tt.name, func(t *testing.T) { |
| 99 | if got := compression.RLEncodebytes(tt.data); !bytes.Equal(got, tt.want) { |
| 100 | t.Errorf("RLEncodebytes() = %v, want %v", got, tt.want) |
| 101 | } |
| 102 | }) |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | func TestCompressionRLEDecodeBytes(t *testing.T) { |
| 107 | tests := []struct { |
nothing calls this directly
no test coverage detected