diff options
Diffstat (limited to 'mempool/test/mempool_test.c')
-rw-r--r-- | mempool/test/mempool_test.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mempool/test/mempool_test.c b/mempool/test/mempool_test.c index 4c55e4b..6d904bc 100644 --- a/mempool/test/mempool_test.c +++ b/mempool/test/mempool_test.c | |||
@@ -39,7 +39,7 @@ TEST_CASE(mempool_allocate_until_full) { | |||
39 | 39 | ||
40 | for (int i = 0; i < NUM_BLOCKS; ++i) { | 40 | for (int i = 0; i < NUM_BLOCKS; ++i) { |
41 | const int* block = mempool_alloc(&pool); | 41 | const int* block = mempool_alloc(&pool); |
42 | TEST_TRUE(block != 0); | 42 | TEST_TRUE(block != nullptr); |
43 | } | 43 | } |
44 | 44 | ||
45 | TEST_TRUE(mempool_size(&pool) == NUM_BLOCKS); | 45 | TEST_TRUE(mempool_size(&pool) == NUM_BLOCKS); |
@@ -50,10 +50,10 @@ TEST_CASE(mempool_fill_then_free) { | |||
50 | test_pool pool; | 50 | test_pool pool; |
51 | mempool_make(&pool); | 51 | mempool_make(&pool); |
52 | 52 | ||
53 | int* blocks[NUM_BLOCKS] = {0}; | 53 | int* blocks[NUM_BLOCKS] = {nullptr}; |
54 | for (int i = 0; i < NUM_BLOCKS; ++i) { | 54 | for (int i = 0; i < NUM_BLOCKS; ++i) { |
55 | blocks[i] = mempool_alloc(&pool); | 55 | blocks[i] = mempool_alloc(&pool); |
56 | TEST_TRUE(blocks[i] != 0); | 56 | TEST_TRUE(blocks[i] != nullptr); |
57 | } | 57 | } |
58 | 58 | ||
59 | for (int i = 0; i < NUM_BLOCKS; ++i) { | 59 | for (int i = 0; i < NUM_BLOCKS; ++i) { |
@@ -74,7 +74,7 @@ TEST_CASE(mempool_allocate_beyond_max_size) { | |||
74 | 74 | ||
75 | // Fully allocate the pool. | 75 | // Fully allocate the pool. |
76 | for (int i = 0; i < NUM_BLOCKS; ++i) { | 76 | for (int i = 0; i < NUM_BLOCKS; ++i) { |
77 | TEST_TRUE(mempool_alloc(&pool) != 0); | 77 | TEST_TRUE(mempool_alloc(&pool) != nullptr); |
78 | } | 78 | } |
79 | 79 | ||
80 | // Past the end. | 80 | // Past the end. |
@@ -105,7 +105,7 @@ TEST_CASE(mempool_zero_free_block_after_free) { | |||
105 | mempool_make(&pool); | 105 | mempool_make(&pool); |
106 | 106 | ||
107 | int* val = mempool_alloc(&pool); | 107 | int* val = mempool_alloc(&pool); |
108 | TEST_TRUE(val != 0); | 108 | TEST_TRUE(val != nullptr); |
109 | *val = 177; | 109 | *val = 177; |
110 | 110 | ||
111 | int* old_val = val; | 111 | int* old_val = val; |
@@ -131,7 +131,7 @@ TEST_CASE(mempool_traverse_partially_full) { | |||
131 | 131 | ||
132 | for (int i = 0; i < N; ++i) { | 132 | for (int i = 0; i < N; ++i) { |
133 | int* val = mempool_alloc(&pool); | 133 | int* val = mempool_alloc(&pool); |
134 | TEST_TRUE(val != 0); | 134 | TEST_TRUE(val != nullptr); |
135 | *val = i + 1; | 135 | *val = i + 1; |
136 | } | 136 | } |
137 | 137 | ||
@@ -146,7 +146,7 @@ TEST_CASE(mempool_traverse_full) { | |||
146 | 146 | ||
147 | for (int i = 0; i < NUM_BLOCKS; ++i) { | 147 | for (int i = 0; i < NUM_BLOCKS; ++i) { |
148 | int* val = mempool_alloc(&pool); | 148 | int* val = mempool_alloc(&pool); |
149 | TEST_TRUE(val != 0); | 149 | TEST_TRUE(val != nullptr); |
150 | *val = i + 1; | 150 | *val = i + 1; |
151 | } | 151 | } |
152 | 152 | ||
@@ -161,7 +161,7 @@ TEST_CASE(mempool_get_block) { | |||
161 | 161 | ||
162 | for (int i = 0; i < NUM_BLOCKS; ++i) { | 162 | for (int i = 0; i < NUM_BLOCKS; ++i) { |
163 | int* block = mempool_alloc(&pool); | 163 | int* block = mempool_alloc(&pool); |
164 | TEST_TRUE(block != 0); | 164 | TEST_TRUE(block != nullptr); |
165 | *block = i; | 165 | *block = i; |
166 | TEST_EQUAL(mempool_get_block_index(&pool, block), (size_t)i); | 166 | TEST_EQUAL(mempool_get_block_index(&pool, block), (size_t)i); |
167 | } | 167 | } |