X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=code_c%2FMaasha%2Fsrc%2Ftest%2Ftest_barray.c;h=c7d26081685fc67407373bf1de5480da61278a61;hb=0f0dd167be99f185b327beee5c49363ae2e1c8b2;hp=10aa9fe06f7198274319b5c2b9b99ff3a51fba1c;hpb=b6fd50ed91cb2001e2b564c5b2da1da576c3e54b;p=biopieces.git diff --git a/code_c/Maasha/src/test/test_barray.c b/code_c/Maasha/src/test/test_barray.c index 10aa9fe..c7d2608 100644 --- a/code_c/Maasha/src/test/test_barray.c +++ b/code_c/Maasha/src/test/test_barray.c @@ -9,6 +9,7 @@ static void test_barray_resize(); static void test_barray_print(); static void test_barray_interval_inc(); static void test_barray_interval_scan(); +static void test_barray_interval_max(); static void test_barray_destroy(); @@ -22,6 +23,7 @@ int main() test_barray_print(); test_barray_interval_inc(); test_barray_interval_scan(); + test_barray_interval_max(); test_barray_destroy(); fprintf( stderr, "Done\n\n" ); @@ -123,10 +125,10 @@ void test_barray_interval_scan() ba = barray_new( nmemb ); +/* barray_interval_inc( ba, 1, 2, 1 ); barray_interval_inc( ba, 4, 5, 1 ); -/* barray_interval_inc( ba, 0, 0, 3 ); barray_interval_inc( ba, 0, 3, 3 ); barray_interval_inc( ba, 9, 9, 3 ); @@ -135,10 +137,46 @@ void test_barray_interval_scan() barray_interval_inc( ba, 25, 35, 2 ); */ +// barray_print( ba ); + while ( barray_interval_scan( ba, &pos, &beg, &end ) ) { // printf( "beg: %zu end: %zu\n", beg, end ); } + fprintf( stderr, "OK\n" ); +} + + +void test_barray_interval_max() +{ + fprintf( stderr, " Testing barray_interval_max ... " ); + + size_t nmemb = 100; + size_t pos = 0; + size_t beg = 0; + size_t end = 0; + ushort max = 0; + barray *ba = NULL; + + ba = barray_new( nmemb ); + + barray_interval_inc( ba, 1, 2, 1 ); + barray_interval_inc( ba, 4, 5, 1 ); + barray_interval_inc( ba, 0, 0, 3 ); + barray_interval_inc( ba, 0, 3, 3 ); + barray_interval_inc( ba, 9, 9, 3 ); + barray_interval_inc( ba, 11, 11, 3 ); + barray_interval_inc( ba, 19, 29, 3 ); + barray_interval_inc( ba, 25, 35, 2 ); + barray_interval_inc( ba, 35, 35, 10 ); + + while ( barray_interval_scan( ba, &pos, &beg, &end ) ) + { + max = barray_interval_max( ba, beg, end ); + +// printf( "beg: %zu end: %zu max: %hd\n", beg, end, max ); + } + // barray_print( ba ); fprintf( stderr, "OK\n" );