summaryrefslogtreecommitdiff
path: root/tests/random.c
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2015-04-05 15:12:48 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2015-04-05 15:33:33 +0100
commit1ed5faab24da62d970aa34ec242fa2d95896e5fb (patch)
tree3d9f57e343c76368bc03ec74642bc20ea7e0e34e /tests/random.c
parentf1f4cabd8e8602355630b2b4b5715fc137b4dc71 (diff)
tests/random: return non-zero on test failure
... and wire it up to make check v2: s/rand - state->check/rand != state->check/. (Jan) Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Diffstat (limited to 'tests/random.c')
-rw-r--r--tests/random.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/random.c b/tests/random.c
index db341f9d..13d4c805 100644
--- a/tests/random.c
+++ b/tests/random.c
@@ -98,15 +98,17 @@ int main(void)
{
RandomState *state;
int i;
+ int ret;
unsigned long rand;
state = drmRandomCreate(1);
for (i = 0; i < 10000; i++) {
rand = drmRandom(state);
}
+ ret = rand != state->check;
printf("After 10000 iterations: %lu (%lu expected): %s\n",
rand, state->check,
- rand - state->check ? "*INCORRECT*" : "CORRECT");
+ ret ? "*INCORRECT*" : "CORRECT");
drmRandomDestroy(state);
printf("Checking periods...\n");
@@ -114,5 +116,5 @@ int main(void)
check_period(2);
check_period(31415926);
- return 0;
+ return ret;
}