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

Function TestCompressionRLEDecode

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

Source from the content-addressed store, hash-verified

40}
41
42func TestCompressionRLEDecode(t *testing.T) {
43 tests := []struct {
44 name string
45 data string
46 want string
47 }{
48 {
49 name: "test 1",
50 data: "12W1B12W3B",
51 want: "WWWWWWWWWWWWBWWWWWWWWWWWWBBB",
52 },
53 {
54 name: "test 2",
55 data: "2A1B3C1D4E",
56 want: "AABCCCDEEEE",
57 },
58 {
59 name: "test 3",
60 data: "4A3B2C1D1A",
61 want: "AAAABBBCCDA",
62 },
63 }
64
65 for _, tt := range tests {
66 t.Run(tt.name, func(t *testing.T) {
67 if got := compression.RLEdecode(tt.data); got != tt.want {
68 t.Errorf("RLEdecode() = %v, want %v", got, tt.want)
69 }
70 })
71 }
72}
73
74func TestCompressionRLEncodeBytes(t *testing.T) {
75 tests := []struct {

Callers

nothing calls this directly

Calls 1

RLEdecodeFunction · 0.92

Tested by

no test coverage detected