From 7090c17f5bec07e832e550e41b4215d91d46ae89 Mon Sep 17 00:00:00 2001 From: Antonis Geralis Date: Wed, 14 Sep 2022 18:32:13 +0300 Subject: [PATCH] test more distinct --- tests/tarrays3.nim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/tarrays3.nim diff --git a/tests/tarrays3.nim b/tests/tarrays3.nim new file mode 100644 index 0000000..10b4b39 --- /dev/null +++ b/tests/tarrays3.nim @@ -0,0 +1,22 @@ +import drchaos/mutator, std/random + +type + DiceFace = distinct int + +const + df1 = 0.DiceFace + df2 = 2.DiceFace + df3 = 4.DiceFace + df4 = 8.DiceFace + df5 = 16.DiceFace + df6 = 32.DiceFace + +proc `==`(a, b: DiceFace): bool {.borrow.} + +proc mutate(value: var DiceFace; sizeIncreaseHint: int; enforceChanges: bool; r: var Rand) = + repeatMutate(r.sample([df1, df2, df3, df4, df5, df6])) + +func fuzzTarget(x: array[10, DiceFace]) = + doAssert x != array[10, DiceFace]([0, 32, 2, 4, 8, 4, 32, 8, 16, 2]) + +defaultMutator(fuzzTarget)