Annotation of embedaddon/miniupnpd/minissdpd/testcodelength.c, revision 1.1

1.1     ! misho       1: /* $Id: testcodelength.c,v 1.3 2012/05/02 10:30:26 nanard Exp $ */
        !             2: /* Project : miniupnp
        !             3:  * Author : Thomas BERNARD
        !             4:  * copyright (c) 2005-2018 Thomas Bernard
        !             5:  * This software is subjet to the conditions detailed in the
        !             6:  * provided LICENCE file. */
        !             7: #include <stdio.h>
        !             8: #include "codelength.h"
        !             9: 
        !            10: int main(int argc, char * * argv)
        !            11: {
        !            12:        unsigned char buf[256];
        !            13:        unsigned char * p;
        !            14:        long i, j;
        !            15:        (void)argc; (void)argv;
        !            16: 
        !            17:        for(i = 1; i < 1000000000; i *= 2) {
        !            18:                /* encode i, decode to j */
        !            19:                printf("%ld ", i);
        !            20:                p = buf;
        !            21:                CODELENGTH(i, p);
        !            22:                p = buf;
        !            23:                DECODELENGTH(j, p);
        !            24:                if(i != j) {
        !            25:                        fprintf(stderr, "Error ! encoded %ld, decoded %ld.\n", i, j);
        !            26:                        return 1;
        !            27:                }
        !            28:        }
        !            29:        printf("Test successful\n");
        !            30:        return 0;
        !            31: }

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