From 5c11c913578f9fe4f2625edc30c9c828935a69f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbjo=CC=88rn=20Einarsson?= Date: Sun, 10 Nov 2024 08:32:40 +0100 Subject: [PATCH] test: add test for avc SliceType strings --- avc/slice_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/avc/slice_test.go b/avc/slice_test.go index fc6d41df..728cc8dd 100644 --- a/avc/slice_test.go +++ b/avc/slice_test.go @@ -22,6 +22,27 @@ func TestSliceTypeParser(t *testing.T) { } } +func TestSliceTypeStrings(t *testing.T) { + cases := []struct { + sliceType SliceType + want string + }{ + {SLICE_P, "P"}, + {SLICE_B, "B"}, + {SLICE_I, "I"}, + {SLICE_SP, "SP"}, + {SLICE_SI, "SI"}, + {SliceType(12), ""}, + } + for _, c := range cases { + got := c.sliceType.String() + if got != c.want { + t.Errorf("got %s want %s", got, c.want) + } + } + +} + func TestParseSliceHeader_BlackFrame(t *testing.T) { wantedHdr := SliceHeader{ SliceType: 7,