Skip to content
This repository was archived by the owner on Jul 22, 2020. It is now read-only.

Commit 6f29b14

Browse files
author
Yevgeny Pats
committed
add a simple unit-test example + update fuzzit CLI
1 parent 10e8dfb commit 6f29b14

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

fuzzit.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ clang -fsanitize=fuzzer parse-complex.a -o parse-complex
2222

2323
## Install fuzzit specific version for production or latest version for development :
2424
# https://github.com/fuzzitdev/fuzzit/releases/latest/download/fuzzit_Linux_x86_64
25-
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.29/fuzzit_Linux_x86_64
25+
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.46/fuzzit_Linux_x86_64
2626
chmod a+x fuzzit
2727

2828
## upload fuzz target for long fuzz testing on fuzzit.dev server or run locally for regression

parse_complex_test.go

+20-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,33 @@ package parser
44
// This won't find the results for never probabbly ...
55

66
import (
7-
"github.com/google/gofuzz"
7+
fuzz "github.com/google/gofuzz"
88
"testing"
99
)
1010

11-
func TestParseComplex(t *testing.T) {
11+
func TestGenerationalFuzzerParseComplex(t *testing.T) {
1212
f := fuzz.New()
1313
var inputString string
1414
for true {
1515
f.Fuzz(&inputString)
1616
ParseComplex([]byte(inputString))
1717
}
1818
}
19+
20+
func TestParseComplex(t *testing.T) {
21+
var parseTests = []struct {
22+
in string
23+
out bool
24+
}{
25+
{"invalid", false},
26+
{"invalid2", false},
27+
{"invalid3", false},
28+
}
29+
30+
for _, tc := range parseTests {
31+
res := ParseComplex([]byte(tc.in))
32+
if res != tc.out{
33+
t.Errorf("was expecting %v but receieved %v", tc.out, res)
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)