Skip to content

Commit

Permalink
feat: add simple fuzz testing for parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
cktii committed May 14, 2024
1 parent a385863 commit af3bc92
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/ntrip_client/nmea_fuzz_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

try:
import atheris
except ImportError:
raise ImportError("You need to install atheris to run this script.")
import sys

with atheris.instrument_imports():
from nmea_parser import NMEAParser


def TestOneInput(data):
parser = NMEAParser()
parser.is_valid_sentence(data)


atheris.Setup(sys.argv, TestOneInput)
atheris.Fuzz()

19 changes: 19 additions & 0 deletions src/ntrip_client/rtcm_fuzz_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

try:
import atheris
except ImportError:
raise ImportError("You need to install atheris to run this script.")
import sys

with atheris.instrument_imports():
from rtcm_parser import RTCMParser


def TestOneInput(data):
parser = RTCMParser()
parser.parse(data)


atheris.Setup(sys.argv, TestOneInput)
atheris.Fuzz()

0 comments on commit af3bc92

Please sign in to comment.