diff --git a/regress/include/bitstring/Makefile b/regress/include/bitstring/Makefile new file mode 100644 index 000000000000..b951364204c5 --- /dev/null +++ b/regress/include/bitstring/Makefile @@ -0,0 +1,26 @@ +# $Id: Makefile,v 1.1 1993/05/22 06:14:08 cgd Exp $ + +PROG= bitstring_test +NOMAN= noman, no way, man + +regress: test-8 test-27 test-32 test-49 test-64 test-67 + +test-8: bitstring_test + bitstring_test 8 | diff - ${.CURDIR}/good/8 + +test-27: bitstring_test + bitstring_test 27 | diff - ${.CURDIR}/good/27 + +test-32: bitstring_test + bitstring_test 32 | diff - ${.CURDIR}/good/32 + +test-49: bitstring_test + bitstring_test 49 | diff - ${.CURDIR}/good/49 + +test-64: bitstring_test + bitstring_test 64 | diff - ${.CURDIR}/good/64 + +test-67: bitstring_test + bitstring_test 67 | diff - ${.CURDIR}/good/67 + +.include diff --git a/regress/include/bitstring/bitstring_test.c b/regress/include/bitstring/bitstring_test.c new file mode 100644 index 000000000000..4d815a1e506d --- /dev/null +++ b/regress/include/bitstring/bitstring_test.c @@ -0,0 +1,215 @@ +/* + * 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 +#if defined (BSD) +#include +#include +#endif /*BSD*/ +#if defined (ATT) +#include +#endif /*ATT*/ + +/* #ifdef NOTSOGOOD */ +#include "bitstring.h" +/* #else */ +/* #include "gbitstring.h" */ +/* #endif */ + +int TEST_LENGTH; +#define DECL_TEST_LENGTH 37 /* a mostly random number */ + +main(int argc, char *argv[]) +{ + void clearbits(); + void printbits(); + int b, 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