From af8137bad7d99e6edd0d66c87c2b99e060c0c9b7 Mon Sep 17 00:00:00 2001 From: Florian Lehner Date: Sat, 18 Jan 2025 11:22:08 +0100 Subject: [PATCH] extend tests Signed-off-by: Florian Lehner --- f_bpf_test.go | 6 ++++++ f_flow_test.go | 6 ++++++ f_flower_test.go | 7 +++++++ f_fw_test.go | 7 +++++++ f_matchall_test.go | 7 +++++++ f_route4_test.go | 7 +++++++ f_rsvp_test.go | 7 +++++++ f_tcindex_test.go | 7 +++++++ f_u32_test.go | 7 +++++++ m_bpf_test.go | 7 +++++++ 10 files changed, 68 insertions(+) diff --git a/f_bpf_test.go b/f_bpf_test.go index f78bb14..db79732 100644 --- a/f_bpf_test.go +++ b/f_bpf_test.go @@ -78,4 +78,10 @@ func TestBpf(t *testing.T) { t.Fatalf("unexpected error: %v", err) } }) + t.Run("unmarshalBpf()", func(t *testing.T) { + err := unmarshalBpf([]byte{0x0}, nil) + if err == nil { + t.Fatalf("expected error but got none") + } + }) } diff --git a/f_flow_test.go b/f_flow_test.go index 96ab853..f2a545f 100644 --- a/f_flow_test.go +++ b/f_flow_test.go @@ -75,4 +75,10 @@ func TestFlow(t *testing.T) { t.Fatalf("unexpected error: %v", err) } }) + t.Run("unmarshalFlow()", func(t *testing.T) { + err := unmarshalFlow([]byte{0x0}, nil) + if err == nil { + t.Fatalf("expected error but got none") + } + }) } diff --git a/f_flower_test.go b/f_flower_test.go index 0fe0f55..36c4890 100644 --- a/f_flower_test.go +++ b/f_flower_test.go @@ -143,4 +143,11 @@ func TestFlower(t *testing.T) { t.Fatalf("unexpected error: %v", err) } }) + + t.Run("unmarshalFlower()", func(t *testing.T) { + err := unmarshalFlower([]byte{0x0}, nil) + if err == nil { + t.Fatalf("expected error but got none") + } + }) } diff --git a/f_fw_test.go b/f_fw_test.go index 714ed34..4223985 100644 --- a/f_fw_test.go +++ b/f_fw_test.go @@ -55,4 +55,11 @@ func TestFw(t *testing.T) { t.Fatalf("unexpected error: %v", err) } }) + + t.Run("unmarshalFw()", func(t *testing.T) { + err := unmarshalFw([]byte{0x0}, nil) + if err == nil { + t.Fatalf("expected error but got none") + } + }) } diff --git a/f_matchall_test.go b/f_matchall_test.go index 9e92422..a13b263 100644 --- a/f_matchall_test.go +++ b/f_matchall_test.go @@ -59,4 +59,11 @@ func TestMatchall(t *testing.T) { t.Fatalf("unexpected error: %v", err) } }) + + t.Run("unmarshalMatchall()", func(t *testing.T) { + err := unmarshalMatchall([]byte{0x0}, nil) + if err == nil { + t.Fatalf("expected error but got none") + } + }) } diff --git a/f_route4_test.go b/f_route4_test.go index 6804c0a..5b7cc65 100644 --- a/f_route4_test.go +++ b/f_route4_test.go @@ -50,4 +50,11 @@ func TestRoute4(t *testing.T) { t.Fatalf("unexpected error: %v", err) } }) + + t.Run("unmarshalRoute4()", func(t *testing.T) { + err := unmarshalRoute4([]byte{0x0}, nil) + if err == nil { + t.Fatalf("expected error but got none") + } + }) } diff --git a/f_rsvp_test.go b/f_rsvp_test.go index e3a19e7..4725f0e 100644 --- a/f_rsvp_test.go +++ b/f_rsvp_test.go @@ -51,4 +51,11 @@ func TestRsvp(t *testing.T) { t.Fatalf("unexpected error: %v", err) } }) + + t.Run("unmarshalRsvp()", func(t *testing.T) { + err := unmarshalRsvp([]byte{0x0}, nil) + if err == nil { + t.Fatalf("expected error but got none") + } + }) } diff --git a/f_tcindex_test.go b/f_tcindex_test.go index ea2e617..9fd6b69 100644 --- a/f_tcindex_test.go +++ b/f_tcindex_test.go @@ -54,4 +54,11 @@ func TestTcIndex(t *testing.T) { t.Fatalf("unexpected error: %v", err) } }) + + t.Run("unmarshalTcIndex()", func(t *testing.T) { + err := unmarshalTcIndex([]byte{0x0}, nil) + if err == nil { + t.Fatalf("expected error but got none") + } + }) } diff --git a/f_u32_test.go b/f_u32_test.go index 78ba5c0..bd65814 100644 --- a/f_u32_test.go +++ b/f_u32_test.go @@ -92,4 +92,11 @@ func TestU32(t *testing.T) { t.Fatalf("unexpected error: %v", err) } }) + + t.Run("unmarshalU32()", func(t *testing.T) { + err := unmarshalU32([]byte{0x0}, nil) + if err == nil { + t.Fatalf("expected error but got none") + } + }) } diff --git a/m_bpf_test.go b/m_bpf_test.go index 44fbf9e..2134e87 100644 --- a/m_bpf_test.go +++ b/m_bpf_test.go @@ -70,4 +70,11 @@ func TestActBpft(t *testing.T) { t.Fatalf("unexpected error: %v", err) } }) + + t.Run("unmarshalActBpf()", func(t *testing.T) { + err := unmarshalActBpf([]byte{0x0}, nil) + if err == nil { + t.Fatalf("expected error but got none") + } + }) }