MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestCompressionRLEncode

Function TestCompressionRLEncode

compression/rlecoding_test.go:10–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func 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
42func TestCompressionRLEDecode(t *testing.T) {
43 tests := []struct {

Callers

nothing calls this directly

Calls 1

RLEncodeFunction · 0.92

Tested by

no test coverage detected