summaryrefslogtreecommitdiff
path: root/tests/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/random.c')
-rw-r--r--tests/random.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/random.c b/tests/random.c
index eec83c5..e56e747 100644
--- a/tests/random.c
+++ b/tests/random.c
@@ -4,7 +4,7 @@
static int
test_urandom_bytes(void) {
- int rc = 0;
+ int rc = -1;
test_start("urandom_bytes()");
@@ -17,7 +17,6 @@ test_urandom_bytes(void) {
for (size_t n = 0; n < LEN; n++) {
if (urandom_bytes(n, &arr)) {
logerr("urandom_bytes(n, &arr);\n");
- rc = -1;
goto out;
}
for (size_t i = n; i < LEN; i++) {
@@ -37,7 +36,6 @@ test_urandom_bytes(void) {
if (urandom_bytes(LEN, &arr1)) {
logerr("urandom_bytes(LEN, &arr1);\n");
- rc = -1;
goto out;
}
@@ -45,7 +43,6 @@ test_urandom_bytes(void) {
for (size_t n = 0; n < attempts; n++) {
if (urandom_bytes(LEN, &arr2)) {
logerr("urandom_bytes(LEN, &arr2);\n");
- rc = -1;
goto out;
}
assert(memcmp(arr1, arr2, LEN) != 0);
@@ -54,20 +51,21 @@ test_urandom_bytes(void) {
test_ok();
}
+ rc = 0;
out:
return rc;
}
int
main(void) {
- int rc = 0;
+ int rc = -1;
if (test_urandom_bytes()) {
logerr("test_urandom_bytes();\n");
- rc = -1;
goto out;
}
+ rc = 0;
out:
return !!rc;
}