diff options
Diffstat (limited to 'test/wasi/c/getentropy.c')
-rw-r--r-- | test/wasi/c/getentropy.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/wasi/c/getentropy.c b/test/wasi/c/getentropy.c new file mode 100644 index 0000000000..75547e1c47 --- /dev/null +++ b/test/wasi/c/getentropy.c @@ -0,0 +1,18 @@ +#include <assert.h> +#include <unistd.h> + +int main() { + char buf[256] = {0}; + int r = getentropy(buf, 256); + assert(r == 0); + + for (int i = 0; i < 256; i++) { + if (buf[i] != 0) { + return 0; + } + } + + // if this ever is reached, we either have a bug or should buy a lottery + // ticket + return 1; +} |