Commit f6252b48 authored by Mans Rullgard's avatar Mans Rullgard

adler32: make test program more useful and add fate test

Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent e0b8fff6
......@@ -52,22 +52,30 @@ unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigne
}
#ifdef TEST
#include <string.h>
#include "log.h"
#include "timer.h"
#define LEN 7001
volatile int checksum;
int main(void){
int main(int argc, char **argv)
{
int i;
char data[LEN];
av_log_set_level(AV_LOG_DEBUG);
for(i=0; i<LEN; i++)
data[i]= ((i*i)>>3) + 123*i;
for(i=0; i<1000; i++){
START_TIMER
checksum= av_adler32_update(1, data, LEN);
STOP_TIMER("adler")
if (argc > 1 && !strcmp(argv[1], "-t")) {
for (i = 0; i < 1000; i++) {
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
......@@ -217,6 +217,11 @@ FATE_TESTS += fate-sha
fate-sha: libavutil/sha-test$(EXESUF)
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-musepack7: CMD = pcm -i $(SAMPLES)/musepack/inside-mp7.mpc
fate-musepack7: CMP = oneoff
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment