From 3b32f5a1abbec9655a93a184ed0a3c5e6e5134fd Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 6 Apr 2024 11:37:04 -0300 Subject: Start "rc = -1" instead of 0 --- tests/random.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'tests/random.c') 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; } -- cgit v1.2.3