Unit Tests
Netcap has tests for its core functionality
Prerequisites
$ zeus download-test-pcapwget https://weberblog.net/wp-content/uploads/2020/02/The-Ultimate-PCAP.7zUnit Tests
$ go test -v ./...
=== RUN TestCountRecords
--- PASS: TestCountRecords (0.18s)
=== RUN TestReader
--- PASS: TestReader (0.01s)
=== RUN TestWriter
--- PASS: TestWriter (0.06s)
PASS
ok github.com/dreadl0ck/netcap 0.862s
? github.com/dreadl0ck/netcap/cmd [no test files]
? github.com/dreadl0ck/netcap/cmd/agent [no test files]
? github.com/dreadl0ck/netcap/cmd/capture [no test files]
? github.com/dreadl0ck/netcap/cmd/collect [no test files]
? github.com/dreadl0ck/netcap/cmd/dump [no test files]
? github.com/dreadl0ck/netcap/cmd/export [no test files]
? github.com/dreadl0ck/netcap/cmd/label [no test files]
? github.com/dreadl0ck/netcap/cmd/proxy [no test files]
? github.com/dreadl0ck/netcap/cmd/split [no test files]
? github.com/dreadl0ck/netcap/cmd/transform [no test files]
? github.com/dreadl0ck/netcap/cmd/util [no test files]
=== RUN TestCollectPCA
done in 2.595847118s
--- PASS: TestCollectPCAP (2.60s)
PASS
ok github.com/dreadl0ck/netcap/collector 3.242s
=== RUN TestCorruptedWriter
TestCorruptedWriter: delimited_test.go:46: Put record returned expected error: BAD
--- PASS: TestCorruptedWriter (0.00s)
=== RUN TestGoodWriter
--- PASS: TestGoodWriter (0.00s)
=== RUN TestCorruptedReader
TestCorruptedReader: delimited_test.go:87: Next record returned expected error: unexpected EOF
--- PASS: TestCorruptedReader (0.00s)
=== RUN TestGoodReader
--- PASS: TestGoodReader (0.00s)
=== RUN TestRoundTrip
TestRoundTrip: delimited_test.go:136: After writing: buffer="\x04Some\x02of\x04what\x01a\x04fool\x06thinks\x05often\bremains." len=42
--- PASS: TestRoundTrip (0.00s)
PASS
ok github.com/dreadl0ck/netcap/delimited 0.526s
? github.com/dreadl0ck/netcap/dpi [no test files]
? github.com/dreadl0ck/netcap/decoder [no test files]
? github.com/dreadl0ck/netcap/io [no test files]
? github.com/dreadl0ck/netcap/label [no test files]
? github.com/dreadl0ck/netcap/maltego [no test files]
? github.com/dreadl0ck/netcap/metrics [no test files]
? github.com/dreadl0ck/netcap/resolvers [no test files]
=== RUN TestMarshal
--- PASS: TestMarshal (0.00s)
PASS
ok github.com/dreadl0ck/netcap/types 0.668s
=== RUN TestTimeToString
--- PASS: TestTimeToString (0.00s)
=== RUN TestStringToTime
--- PASS: TestStringToTime (0.00s)
PASS
ok github.com/dreadl0ck/netcap/utils 0.932sBenchmarks
Race Detection Tests
Last updated