Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extend test #134

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading