Skip to content

Commit

Permalink
lib: Minor code cleanup to mempool-alloconly unit test - use test_beg…
Browse files Browse the repository at this point in the history
…in/assert/end()
  • Loading branch information
sirainen committed Feb 21, 2016
1 parent b4a7ea6 commit 010341a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/lib/test-mempool-alloconly.c
Expand Up @@ -20,8 +20,8 @@ void test_mempool_alloconly(void)
pool_t pool;
unsigned int i, j, k;
void *mem[PMALLOC_MAX_COUNT + 1];
bool success = TRUE;

test_begin("mempool_alloconly");
for (i = 0; i < 64; i++) {
for (j = 1; j <= 128; j++) {
pool = pool_alloconly_create(MEMPOOL_GROWING"test", i);
Expand All @@ -33,16 +33,13 @@ void test_mempool_alloconly(void)
memset(mem[k], k, k);
}

if (!mem_has_bytes(mem[0], j, j))
success = FALSE;
for (k = 1; k <= PMALLOC_MAX_COUNT; k++) {
if (!mem_has_bytes(mem[k], k, k))
success = FALSE;
}
test_assert(mem_has_bytes(mem[0], j, j));
for (k = 1; k <= PMALLOC_MAX_COUNT; k++)
test_assert(mem_has_bytes(mem[k], k, k));
pool_unref(&pool);
}
}
test_out("mempool_alloconly", success);
test_end();
}

enum fatal_test_state fatal_mempool(int stage)
Expand Down

0 comments on commit 010341a

Please sign in to comment.