This commit is contained in:
Antonis Geralis 2022-08-26 21:36:18 +03:00
parent fd7c1aedba
commit 7893007212
2 changed files with 10 additions and 1 deletions

View File

@ -25,7 +25,7 @@ proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
proc test(name: string, srcDir = "tests/", args = "", lang = "c") =
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
task testDrChaosExamples, "Build & run Dr. Chaos examples":

View File

@ -1,6 +1,15 @@
import std/[random, macros, setutils, enumutils, typetraits, options]
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):
proc LLVMFuzzerInitialize(): cint {.exportc.} =
{.emit: "N_CDECL(void, NimMain)(void); NimMain();".}