1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

random_seed: add selftest

Reviewed-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-02-22 22:25:01 +01:00
parent 1b93244381
commit 946de27d25
2 changed files with 27 additions and 1 deletions

View File

@ -83,7 +83,7 @@ OBJS-$(ARCH_X86) += x86/cpu.o
TESTPROGS = adler32 aes avstring base64 cpu crc des eval file fifo lfg lls \
md5 opt pca parseutils rational sha tree
md5 opt pca parseutils random_seed rational sha tree
TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
TOOLS = ffeval

View File

@ -80,3 +80,29 @@ uint32_t av_get_random_seed(void)
return seed;
return get_generic_seed();
}
#ifdef TEST
#undef printf
#define N 256
#include <stdio.h>
int main(void)
{
int i, j, retry;
uint32_t seeds[N];
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;
}
printf("seeds OK\n");
return 0;
retry:;
}
printf("FAIL at %d with %X\n", j, seeds[j]);
return 1;
}
#endif