(t *testing.T)
| 104 | } |
| 105 | |
| 106 | func TestCompressionRLEDecodeBytes(t *testing.T) { |
| 107 | tests := []struct { |
| 108 | name string |
| 109 | data []byte |
| 110 | want []byte |
| 111 | }{ |
| 112 | { |
| 113 | name: "test 1", |
| 114 | data: []byte{12, 'W', 1, 'B', 12, 'W', 3, 'B'}, |
| 115 | want: []byte("WWWWWWWWWWWWBWWWWWWWWWWWWBBB"), |
| 116 | }, |
| 117 | { |
| 118 | name: "test 2", |
| 119 | data: []byte{2, 'A', 1, 'B', 3, 'C', 1, 'D', 4, 'E'}, |
| 120 | want: []byte("AABCCCDEEEE"), |
| 121 | }, |
| 122 | { |
| 123 | name: "test 3", |
| 124 | data: []byte{4, 'A', 3, 'B', 2, 'C', 1, 'D', 1, 'A'}, |
| 125 | want: []byte("AAAABBBCCDA"), |
| 126 | }, |
| 127 | } |
| 128 | |
| 129 | for _, tt := range tests { |
| 130 | t.Run(tt.name, func(t *testing.T) { |
| 131 | if got := compression.RLEdecodebytes(tt.data); !bytes.Equal(got, tt.want) { |
| 132 | t.Errorf("RLEdecodebytes() = %v, want %v", got, tt.want) |
| 133 | } |
| 134 | }) |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | /* --- BENCHMARKS --- */ |
| 139 | func BenchmarkRLEncode(b *testing.B) { |
nothing calls this directly
no test coverage detected