From 7c0558ba41594c0a54b7341a210e667fc5abd6c1 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Wed, 26 Jul 2023 09:02:07 +0800 Subject: [PATCH] Add a testcase for getentropy (#169) --- tests/general/getentropy.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/general/getentropy.c diff --git a/tests/general/getentropy.c b/tests/general/getentropy.c new file mode 100644 index 0000000..3b7fe0e --- /dev/null +++ b/tests/general/getentropy.c @@ -0,0 +1,17 @@ +#include +#include + +int main() { + char buf[256] = {0}; + int ret = getentropy(buf, 256); + assert(ret == 0); + + int sum = 0; + for (int i = 0; i < 256; i++) { + sum += buf[i]; + } + + assert(sum != 0); + + return 0; +}