From: Sebastian B. <sb...@us...> - 2014-01-19 18:52:49
|
Update of /cvsroot/simplemail/simplemail/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25179/tests Modified Files: index_external_unittest.c Log Message: Now insert duplicates and test them. Index: index_external_unittest.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/index_external_unittest.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- index_external_unittest.c 19 Jan 2014 18:52:28 -0000 1.4 +++ index_external_unittest.c 19 Jan 2014 18:52:47 -0000 1.5 @@ -66,6 +66,35 @@ CU_ASSERT(bp.max_level == 1); } + /* Insert strings again */ + for (i=0;i<number_of_distinct_strings;i++) + { + char buf[16]; + long offset; + snprintf(buf, sizeof(buf), "%03dtest", i); + + rc = index_external_append_string(idx, buf, &offset); + CU_ASSERT(rc != 0); + + rc = bnode_insert_string(idx, i, offset, buf); + CU_ASSERT(rc != 0); + } + + CU_ASSERT(count_index_leaves(idx, idx->root_node, 0) == 2 * number_of_distinct_strings); + + for (i=0;i<number_of_distinct_strings;i++) + { + char buf[16]; + struct bnode_path bp; + + snprintf(buf, sizeof(buf), "%03dtest", i); + + memset(&bp, 0, sizeof(bp)); + rc = bnode_lookup(idx, buf, &bp); + CU_ASSERT(rc != 0); + CU_ASSERT(bp.max_level == 1); + } + printf("%d %d %d %d\n", count_index_leaves(idx, idx->root_node, 0), count_index(idx, idx->root_node, 0), idx->max_elements_per_node, idx->number_of_blocks); |