when ismain
This commit is contained in:
parent
2c77490357
commit
784e88319f
|
@ -35,26 +35,27 @@ proc `$`(n: HtmlNode): string =
|
|||
result = newStringOfCap(1000)
|
||||
toString n, result
|
||||
|
||||
import drchaos
|
||||
when isMainModule:
|
||||
import drchaos
|
||||
|
||||
proc default(_: typedesc[HtmlNode]): HtmlNode =
|
||||
HtmlNode(tag: text, s: "")
|
||||
proc default(_: typedesc[HtmlNode]): HtmlNode =
|
||||
HtmlNode(tag: text, s: "")
|
||||
|
||||
func `==`(a, b: HtmlNode): bool =
|
||||
if a.isNil:
|
||||
if b.isNil: return true
|
||||
return false
|
||||
elif b.isNil or a.tag != b.tag:
|
||||
return false
|
||||
else:
|
||||
case a.tag
|
||||
of text: return a.s == b.s
|
||||
else: return a.kids == b.kids
|
||||
func `==`(a, b: HtmlNode): bool =
|
||||
if a.isNil:
|
||||
if b.isNil: return true
|
||||
return false
|
||||
elif b.isNil or a.tag != b.tag:
|
||||
return false
|
||||
else:
|
||||
case a.tag
|
||||
of text: return a.s == b.s
|
||||
else: return a.kids == b.kids
|
||||
|
||||
func fuzzTarget(x: HtmlNode) =
|
||||
let data = HtmlNode(tag: head, kids: @[
|
||||
HtmlNode(tag: text, s: "Hello World!"),
|
||||
])
|
||||
doAssert $x != $data
|
||||
func fuzzTarget(x: HtmlNode) =
|
||||
let data = HtmlNode(tag: head, kids: @[
|
||||
HtmlNode(tag: text, s: "Hello World!"),
|
||||
])
|
||||
doAssert $x != $data
|
||||
|
||||
defaultMutator(fuzzTarget)
|
||||
defaultMutator(fuzzTarget)
|
||||
|
|
|
@ -44,12 +44,15 @@ proc eye*(N: static[int], A: typedesc[float32], order: OrderType = colMajor): Ma
|
|||
for i in 0 ..< N:
|
||||
result.data[i + N * i] = 1'f32
|
||||
|
||||
import drchaos
|
||||
when isMainModule:
|
||||
import drchaos
|
||||
|
||||
proc default[M, N: static[int]](_: typedesc[Matrix32[M, N]]): Matrix32[M, N] =
|
||||
zeros(M, N, float32)
|
||||
{.experimental: "strictFuncs".}
|
||||
|
||||
func fuzzTarget(x: Matrix32[2, 2]) =
|
||||
doAssert x != eye(2, float32)
|
||||
proc default[M, N: static[int]](_: typedesc[Matrix32[M, N]]): Matrix32[M, N] =
|
||||
zeros(M, N, float32)
|
||||
|
||||
defaultMutator(fuzzTarget)
|
||||
func fuzzTarget(x: Matrix32[2, 2]) =
|
||||
doAssert x != eye(2, float32)
|
||||
|
||||
defaultMutator(fuzzTarget)
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
@end
|
||||
--passC: "-fsanitize=address,undefined"
|
||||
--passL: "-fsanitize=address,undefined"
|
||||
#--define: release
|
||||
#--define: danger
|
||||
--debugger: native
|
||||
--path: "../"
|
||||
|
|
Loading…
Reference in New Issue