예제 #1
0
파일: bitmap.c 프로젝트: Abioy/windmill
int
main(void)
{
	fprintf(stderr, "Test begin\n");

	test_bitmap_size();
	test_bitmap_init();
	test_bitmap_set();
	test_bitmap_unset();
	test_bitmap_sfu();

	fprintf(stderr, "Test end\n");
	return (0);
}
예제 #2
0
파일: bitmap.c 프로젝트: GumpChan/ssdb
int
main(void)
{
    malloc_printf("Test begin\n");

    test_bitmap_size();
    test_bitmap_init();
    test_bitmap_set();
    test_bitmap_unset();
    test_bitmap_sfu();

    malloc_printf("Test end\n");
    return (0);
}
예제 #3
0
void test_bitmap_is_set(opal_bitmap_t *bm)
{
    int result=0;

    /* First set some bits */
    test_bitmap_set(bm);
    is_set_bit(bm, 0);
    is_set_bit(bm, 1);
    is_set_bit(bm, 31);
    is_set_bit(bm, 32);

    result = is_set_bit(bm, 1122);
    TEST_AND_REPORT(result,0,"opal_bitmap_is_set_bit");    
    is_set_bit(bm, -33);
    TEST_AND_REPORT(result,0,"opal_bitmap_is_set_bit");    
    is_set_bit(bm, -1);
    TEST_AND_REPORT(result,0,"opal_bitmap_is_set_bit");    
}
예제 #4
0
int main(int argc, char *argv[])
{
    /* Local variables */
    opal_bitmap_t bm;
    int err;
    
    /* Perform overall test initialization */
    test_init("opal_bitmap_t");

#ifdef STANDALONE
    error_out = stderr;
#else
    error_out = fopen( "./opal_bitmap_test_out.txt", "w" );
    if( error_out == NULL ) error_out = stderr;
#endif

    /* Initialize bitmap  */

    PRINT_VALID_ERR;
    err = opal_bitmap_init(NULL, 2);
    if (err == OPAL_ERR_BAD_PARAM)
	fprintf(error_out, "ERROR: Initialization of bitmap failed\n\n");

    PRINT_VALID_ERR;
    err = opal_bitmap_init(&bm, -1);
    if (err == OPAL_ERR_BAD_PARAM)
	fprintf(error_out, "ERROR: Initialization of bitmap failed \n\n");

    err = opal_bitmap_init(&bm, BSIZE);
    if (0 > err) {
	fprintf(error_out, "Error in bitmap create -- aborting \n");
	exit(-1);
    }

    fprintf(error_out, "\nTesting bitmap set... \n");
    test_bitmap_set(&bm);

    fprintf(error_out, "\nTesting bitmap clear ... \n");
    test_bitmap_clear(&bm);

    fprintf(error_out, "\nTesting bitmap is_set ... \n");
    test_bitmap_is_set(&bm);

    fprintf(error_out, "\nTesting bitmap clear_all... \n");
    test_bitmap_clear_all(&bm);

    fprintf(error_out, "\nTesting bitmap set_all... \n");
    test_bitmap_set_all(&bm);

    fprintf(error_out, "\nTesting bitmap find_and_set... \n");
    test_bitmap_find_and_set(&bm);

    fprintf(error_out, "\n~~~~~~     Testing complete     ~~~~~~ \n\n");

    test_finalize();
#ifndef STANDALONE
    fclose(error_out);
#endif

    return 0;
}