On 02/04/2016 9:20 PM, jkpl wrote:
Let's say I have a ubyte[256]. I want to test all the possible values
this array can have on a function.

Currently I fill it for each new test with std.random.uniform but I'm
sure that I loose some time with randomizing and with the tests that are
repeated. Is there a simple way to do this ? Without thinking much, it
seems that the loops to generate this would be seriously awefull.

By thinking a bit more maybe with a fixed-size big integer it would
work, since the value could be casted as the right array type (as long
as its length is power of 2) ?

Actually I'd use a hex string.

So:
static ubyte[256] DATA = cast(ubyte[256])x"00 01 02 03";
I'm sure you get the idea. That can be created easily enough.

Reply via email to