1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

adler32: make test program more useful and add fate test

Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
Mans Rullgard 2011-06-29 19:33:10 +01:00
parent e0b8fff6c7
commit f6252b4845
2 changed files with 20 additions and 7 deletions

View File

@ -52,22 +52,30 @@ unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigne
} }
#ifdef TEST #ifdef TEST
#include <string.h>
#include "log.h" #include "log.h"
#include "timer.h" #include "timer.h"
#define LEN 7001 #define LEN 7001
volatile int checksum; volatile int checksum;
int main(void){ int main(int argc, char **argv)
{
int i; int i;
char data[LEN]; char data[LEN];
av_log_set_level(AV_LOG_DEBUG); av_log_set_level(AV_LOG_DEBUG);
for(i=0; i<LEN; i++) for(i=0; i<LEN; i++)
data[i]= ((i*i)>>3) + 123*i; data[i]= ((i*i)>>3) + 123*i;
for(i=0; i<1000; i++){
START_TIMER if (argc > 1 && !strcmp(argv[1], "-t")) {
checksum= av_adler32_update(1, data, LEN); for (i = 0; i < 1000; i++) {
STOP_TIMER("adler") START_TIMER;
checksum = av_adler32_update(1, data, LEN);
STOP_TIMER("adler");
}
} else {
checksum = av_adler32_update(1, data, LEN);
} }
av_log(NULL, AV_LOG_DEBUG, "%X == 50E6E508\n", checksum);
return 0; av_log(NULL, AV_LOG_DEBUG, "%X (expected 50E6E508)\n", checksum);
return checksum == 0x50e6e508? 0 : 1;
} }
#endif #endif

View File

@ -217,6 +217,11 @@ FATE_TESTS += fate-sha
fate-sha: libavutil/sha-test$(EXESUF) fate-sha: libavutil/sha-test$(EXESUF)
fate-sha: CMD = run libavutil/sha-test fate-sha: CMD = run libavutil/sha-test
FATE_TESTS += fate-adler32
fate-adler32: libavutil/adler32-test$(EXESUF)
fate-adler32: CMD = run libavutil/adler32-test
fate-adler32: REF = /dev/null
FATE_TESTS += fate-musepack7 FATE_TESTS += fate-musepack7
fate-musepack7: CMD = pcm -i $(SAMPLES)/musepack/inside-mp7.mpc fate-musepack7: CMD = pcm -i $(SAMPLES)/musepack/inside-mp7.mpc
fate-musepack7: CMP = oneoff fate-musepack7: CMP = oneoff