File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / miniupnpd / minissdpd / testcodelength.c
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Wed Sep 27 11:25:11 2023 UTC (15 months ago) by misho
CVS tags: MAIN, HEAD
Initial revision

/* $Id: testcodelength.c,v 1.1 2023/09/27 11:25:11 misho Exp $ */
/* Project : miniupnp
 * Author : Thomas BERNARD
 * copyright (c) 2005-2018 Thomas Bernard
 * This software is subjet to the conditions detailed in the
 * provided LICENCE file. */
#include <stdio.h>
#include "codelength.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 successful\n");
	return 0;
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>