nim-drchaos/tests/tvariants2.nim

27 lines
606 B
Nim

import drchaos
type
ContentNodeKind = enum
P, Br, Text
ContentNode = object
case kind: ContentNodeKind
of P: pChildren: seq[ContentNode]
of Br: discard
of Text: textStr: string
func `==`(a, b: ContentNode): bool =
if a.kind != b.kind: return false
case a.kind
of P: return a.pChildren == b.pChildren
of Br: return true
of Text: return a.textStr == b.textStr
func fuzzTarget(x: ContentNode) =
let data = ContentNode(kind: P, pChildren: @[
ContentNode(kind: Text, textStr: "mychild"),
ContentNode(kind: Br)
])
doAssert x != data
defaultMutator(fuzzTarget)