changeset 19796:910fcbab16c7

lib: Minor code cleanup to mempool-alloconly unit test - use test_begin/assert/end()
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sun, 21 Feb 2016 18:58:50 +0200
parents b241c5bbe6cb
children f86de8cf34d9
files src/lib/test-mempool-alloconly.c
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/test-mempool-alloconly.c	Sun Feb 21 18:38:24 2016 +0200
+++ b/src/lib/test-mempool-alloconly.c	Sun Feb 21 18:58:50 2016 +0200
@@ -20,8 +20,8 @@
 	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);
@@ -33,16 +33,13 @@
 				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)