Skip to content

Commit

Permalink
Add a testcase for getentropy (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
caspervonb authored Jul 26, 2023
1 parent 00cb3b2 commit 7c0558b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/general/getentropy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <assert.h>
#include <unistd.h>

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;
}

0 comments on commit 7c0558b

Please sign in to comment.