forked from TrueCloudLab/policy-engine
Fix fuzzing functions
Signed-off-by: Roman Ognev <r.ognev@yadro.com>
This commit is contained in:
parent
bb4aacdd39
commit
470ec29a6c
1 changed files with 17 additions and 19 deletions
|
@ -5,30 +5,28 @@ package chain
|
|||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func FuzzUnmarshal(f *testing.F) {
|
||||
for _, id := range generateTestIDs() {
|
||||
for _, rules := range generateTestRules() {
|
||||
for _, matchType := range generateTestMatchTypes() {
|
||||
// for _, id := range generateTestIDs() {
|
||||
// for _, rules := range generateTestRules() {
|
||||
// for _, matchType := range generateTestMatchTypes() {
|
||||
|
||||
chain := Chain{
|
||||
ID: id,
|
||||
Rules: rules,
|
||||
MatchType: matchType,
|
||||
}
|
||||
data, err := chain.MarshalBinary()
|
||||
require.NoError(f, err)
|
||||
f.Add(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
// chain := Chain{
|
||||
// ID: id,
|
||||
// Rules: rules,
|
||||
// MatchType: matchType,
|
||||
// }
|
||||
// data, err := chain.MarshalBinary()
|
||||
// require.NoError(f, err)
|
||||
// f.Add(data)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
require.NotPanics(t, func() {
|
||||
DoFuzzUnmarshal(data)
|
||||
})
|
||||
// require.NotPanics(t, func() {
|
||||
DoFuzzUnmarshal(data)
|
||||
// })
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue