fix #6
This commit is contained in:
parent
fd7c1aedba
commit
7893007212
|
@ -25,7 +25,7 @@ proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
|
||||||
|
|
||||||
proc test(name: string, srcDir = "tests/", args = "", lang = "c") =
|
proc test(name: string, srcDir = "tests/", args = "", lang = "c") =
|
||||||
buildBinary name, srcDir, "--mm:arc -d:danger"
|
buildBinary name, srcDir, "--mm:arc -d:danger"
|
||||||
# Should ideally run inside build/ because of the artifacts, but it doesn't work!
|
# Should ideally run inside build/ because of the artifacts, but cd doesn't work!
|
||||||
exec "build/" & name & " -max_total_time=3 -runs=10000" & args
|
exec "build/" & name & " -max_total_time=3 -runs=10000" & args
|
||||||
|
|
||||||
task testDrChaosExamples, "Build & run Dr. Chaos examples":
|
task testDrChaosExamples, "Build & run Dr. Chaos examples":
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
import std/[random, macros, setutils, enumutils, typetraits, options]
|
import std/[random, macros, setutils, enumutils, typetraits, options]
|
||||||
import common, private/[sampler, utf8fix]
|
import common, private/[sampler, utf8fix]
|
||||||
|
|
||||||
|
when (NimMajor, NimMinor, NimPatch) < (1, 7, 1):
|
||||||
|
proc rand*[T: Ordinal](r: var Rand; t: typedesc[T]): T =
|
||||||
|
when T is range or T is enum:
|
||||||
|
result = rand(r, low(T)..high(T))
|
||||||
|
elif T is bool:
|
||||||
|
result = cast[int64](r.next) < 0
|
||||||
|
else:
|
||||||
|
result = cast[T](r.next shr (sizeof(uint64)*8 - sizeof(T)*8))
|
||||||
|
|
||||||
when not defined(fuzzerStandalone):
|
when not defined(fuzzerStandalone):
|
||||||
proc LLVMFuzzerInitialize(): cint {.exportc.} =
|
proc LLVMFuzzerInitialize(): cint {.exportc.} =
|
||||||
{.emit: "N_CDECL(void, NimMain)(void); NimMain();".}
|
{.emit: "N_CDECL(void, NimMain)(void); NimMain();".}
|
||||||
|
|
Loading…
Reference in New Issue