You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
716 B

/* $Id: testcodelength.c,v 1.3 2012/05/02 10:30:26 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas BERNARD
* copyright (c) 2005-2008 Thomas Bernard
* This software is subjet to the conditions detailed in the
* provided LICENCE file. */
#include "codelength.h"
#include <stdio.h>
int main(int argc, char ** argv)
{
unsigned char buf[256];
unsigned char * p;
long i, j;
(void) argc;
(void) argv;
for (i = 1; i < 1000000000; i *= 2)
{
/* encode i, decode to j */
printf("%ld ", i);
p = buf;
CODELENGTH(i, p);
p = buf;
DECODELENGTH(j, p);
if (i != j)
{
fprintf(stderr, "Error ! encoded %ld, decoded %ld.\n", i, j);
return 1;
}
}
printf("Test succesful\n");
return 0;
}