Skip to content

Commit

Permalink
extend test
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Lehner <[email protected]>
  • Loading branch information
florianl committed Nov 18, 2023
1 parent 9a23845 commit e4b6f8f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion f_matchall_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tc

import (
"encoding/binary"
"errors"
"testing"

Expand Down Expand Up @@ -30,7 +31,11 @@ func TestMatchall(t *testing.T) {
}
t.Fatalf("Unexpected error: %v", err1)
}
newData := injectAttribute(t, data, []byte{}, tcaMatchallPad)
pcnt := uint64(1337)
pcntBytes := make([]byte, 8)
binary.LittleEndian.PutUint64(pcntBytes, pcnt)
tmp := injectAttribute(t, data, pcntBytes, tcaMatchallPcnt)
newData := injectAttribute(t, tmp, []byte{}, tcaMatchallPad)
val := Matchall{}
err2 := unmarshalMatchall(newData, &val)
if err2 != nil {
Expand All @@ -40,6 +45,9 @@ func TestMatchall(t *testing.T) {
t.Fatalf("Unexpected error: %v", err2)

}

// Reinject pcnt
testcase.val.Pcnt = uint64Ptr(pcnt)
if diff := cmp.Diff(val, testcase.val); diff != "" {
t.Fatalf("Matchall missmatch (want +got):\n%s", diff)
}
Expand Down

0 comments on commit e4b6f8f

Please sign in to comment.