minor
This commit is contained in:
parent
49a062a20c
commit
ad7dfeab4f
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue