aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Turner <thomastdt@googlemail.com>2016-12-22 16:12:36 -0800
committerMichael Niedermayer <michael@niedermayer.cc>2016-12-23 02:57:20 +0100
commit8dcb28cf6dd1c68810e7aa857bb6f2a778bef4de (patch)
tree3d687545e6be1b294e55887beabb534c83aeda3b
parent73651090ca1183f37753ee30a7e206ca4fb9f4f0 (diff)
downloadffmpeg-8dcb28cf6dd1c68810e7aa857bb6f2a778bef4de.tar.gz
avutil/tests: Improved code coverage for random_seed
Signed-off-by: Thomas Turner <thomastdt@googlemail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavutil/tests/random_seed.c34
-rw-r--r--tests/ref/fate/random_seed1
2 files changed, 22 insertions, 13 deletions
diff --git a/libavutil/tests/random_seed.c b/libavutil/tests/random_seed.c
index ebe9b3e7dd..f45e198213 100644
--- a/libavutil/tests/random_seed.c
+++ b/libavutil/tests/random_seed.c
@@ -23,24 +23,32 @@
#undef printf
#define N 256
+#define F 2
#include <stdio.h>
+typedef uint32_t (*random_seed_ptr_t)(void);
+
int main(void)
{
- int i, j, retry;
+ int i, j, rsf, retry;
uint32_t seeds[N];
+ random_seed_ptr_t random_seed[F] = {av_get_random_seed, get_generic_seed};
- for (retry=0; retry<3; retry++){
- for (i=0; i<N; i++){
- seeds[i] = av_get_random_seed();
- for (j=0; j<i; j++)
- if (seeds[j] == seeds[i])
- goto retry;
+ for (rsf=0; rsf<F; ++rsf){
+ for (retry=0; retry<3; retry++){
+ for (i=0; i<N; i++){
+ seeds[i] = random_seed[rsf]();
+ for (j=0; j<i; j++)
+ if (seeds[j] == seeds[i])
+ goto retry;
+ }
+ printf("seeds OK\n");
+ goto next;
+ retry:;
}
- printf("seeds OK\n");
- return 0;
- retry:;
+ printf("rsf %d: FAIL at %d with %X\n", rsf, j, seeds[j]);
+ return 1;
+ next:;
}
- printf("FAIL at %d with %X\n", j, seeds[j]);
- return 1;
-}
+ return 0;
+ }
diff --git a/tests/ref/fate/random_seed b/tests/ref/fate/random_seed
index 2b5b3afe72..ef0eef2603 100644
--- a/tests/ref/fate/random_seed
+++ b/tests/ref/fate/random_seed
@@ -1 +1,2 @@
seeds OK
+seeds OK