diff options
Diffstat (limited to 'src/memfile_test.c')
-rw-r--r-- | src/memfile_test.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/memfile_test.c b/src/memfile_test.c index 0a20330e69..a352619469 100644 --- a/src/memfile_test.c +++ b/src/memfile_test.c @@ -15,11 +15,11 @@ #undef NDEBUG #include <assert.h> -/* Must include main.c because it contains much more than just main() */ +// Must include main.c because it contains much more than just main() #define NO_VIM_MAIN #include "main.c" -/* This file has to be included because the tested functions are static */ +// This file has to be included because the tested functions are static #include "memfile.c" #define index_to_key(i) ((i) ^ 15167) @@ -39,21 +39,21 @@ test_mf_hash(void) mf_hash_init(&ht); - /* insert some items and check invariants */ + // insert some items and check invariants for (i = 0; i < TEST_COUNT; i++) { assert(ht.mht_count == i); - /* check that number of buckets is a power of 2 */ + // check that number of buckets is a power of 2 num_buckets = ht.mht_mask + 1; assert(num_buckets > 0 && (num_buckets & (num_buckets - 1)) == 0); - /* check load factor */ + // check load factor assert(ht.mht_count <= (num_buckets << MHT_LOG_LOAD_FACTOR)); if (i < (MHT_INIT_SIZE << MHT_LOG_LOAD_FACTOR)) { - /* first expansion shouldn't have occurred yet */ + // first expansion shouldn't have occurred yet assert(num_buckets == MHT_INIT_SIZE); assert(ht.mht_buckets == ht.mht_small_buckets); } @@ -66,7 +66,7 @@ test_mf_hash(void) key = index_to_key(i); assert(mf_hash_find(&ht, key) == NULL); - /* allocate and add new item */ + // allocate and add new item item = LALLOC_CLEAR_ONE(mf_hashitem_T); assert(item != NULL); item->mhi_key = key; @@ -76,13 +76,13 @@ test_mf_hash(void) if (ht.mht_mask + 1 != num_buckets) { - /* hash table was expanded */ + // hash table was expanded assert(ht.mht_mask + 1 == num_buckets * MHT_GROWTH_FACTOR); assert(i + 1 == (num_buckets << MHT_LOG_LOAD_FACTOR)); } } - /* check presence of inserted items */ + // check presence of inserted items for (i = 0; i < TEST_COUNT; i++) { key = index_to_key(i); @@ -91,7 +91,7 @@ test_mf_hash(void) assert(item->mhi_key == key); } - /* delete some items */ + // delete some items for (i = 0; i < TEST_COUNT; i++) { if (i % 100 < 70) @@ -114,7 +114,7 @@ test_mf_hash(void) } } - /* check again */ + // check again for (i = 0; i < TEST_COUNT; i++) { key = index_to_key(i); @@ -131,7 +131,7 @@ test_mf_hash(void) } } - /* free hash table and all remaining items */ + // free hash table and all remaining items mf_hash_free_all(&ht); } |