/* $NetBSD: bitstring_test.c,v 1.4 1995/04/29 05:44:35 cgd Exp $ */ /* * this is a simple program to test bitstring.h * inspect the ouput, you should notice problems * choose the ATT or BSD flavor */ /*#define ATT /*-*/ #define BSD /*-*/ /* include the following define if you want the * program to link. this corrects a misspeling * in bitstring.h */ #define _bitstr_size bitstr_size #include #include /* #ifdef NOTSOGOOD */ #include "bitstring.h" /* #else */ /* #include "gbitstring.h" */ /* #endif */ int TEST_LENGTH; #define DECL_TEST_LENGTH 37 /* a mostly random number */ int main(int argc, char *argv[]) { void clearbits(); void printbits(); int i; bitstr_t *bs; bitstr_t bit_decl(bss, DECL_TEST_LENGTH); if (argc > 1) TEST_LENGTH = atoi(argv[1]); else TEST_LENGTH = DECL_TEST_LENGTH; if (TEST_LENGTH < 4) { fprintf(stderr, "TEST_LENGTH must be at least 4, but it is %d\n", TEST_LENGTH); exit(1); } (void) printf("Testing with TEST_LENGTH = %d\n\n", TEST_LENGTH); (void) printf("test _bit_byte, _bit_mask, and bitstr_size\n"); (void) printf(" i _bit_byte(i) _bit_mask(i) bitstr_size(i)\n"); for (i=0; i