This commit is contained in:
Antonis Geralis 2022-09-05 15:09:56 +03:00
parent 49a062a20c
commit ad7dfeab4f
3 changed files with 5 additions and 5 deletions

View File

@ -66,7 +66,8 @@ defaultMutator(fuzzTarget)
Dr. Chaos will generate millions of inputs and run `fuzzTarget` under a few seconds. Dr. Chaos will generate millions of inputs and run `fuzzTarget` under a few seconds.
More articulate examples, such as fuzzing a graph library are in the `examples/` directory. More articulate examples, such as fuzzing a graph library are in the `examples/` directory.
Defining a `==` proc for the input type is necessary. Defining a `==` proc for the input type is necessary. `proc default(_: typedesc[T]): T` can also
be overloaded.
### Post-processors ### Post-processors

View File

@ -506,7 +506,7 @@ proc runPostProcessor*[T: object](x: var T, depth: int; r: var Rand) =
proc runPostProcessor*[T](x: var ref T, depth: int; r: var Rand) = proc runPostProcessor*[T](x: var ref T, depth: int; r: var Rand) =
if depth < 0: if depth < 0:
reset(x) reset(x) # should be `=destroy`
else: else:
when compiles(postProcess(x, r)): when compiles(postProcess(x, r)):
postProcess(x, r) postProcess(x, r)

View File

@ -38,7 +38,7 @@ proc `$`(n: HtmlNode): string =
import drchaos import drchaos
proc default(_: typedesc[HtmlNode]): HtmlNode = proc default(_: typedesc[HtmlNode]): HtmlNode =
HtmlNode(tag: th) HtmlNode(tag: text, s: "")
func `==`(a, b: HtmlNode): bool = func `==`(a, b: HtmlNode): bool =
if a.isNil: if a.isNil:
@ -53,8 +53,7 @@ func `==`(a, b: HtmlNode): bool =
func fuzzTarget(x: HtmlNode) = func fuzzTarget(x: HtmlNode) =
let data = HtmlNode(tag: head, kids: @[ let data = HtmlNode(tag: head, kids: @[
HtmlNode(tag: text, s: "mychild"), HtmlNode(tag: text, s: "Hello World!"),
HtmlNode(tag: body)
]) ])
doAssert $x != $data doAssert $x != $data