Skip to content

Commit 22b6063

Browse files
committed
Minor heapmem test fixes.
1 parent cc317d7 commit 22b6063

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/08-native-runs/12-heapmem/test-heapmem.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ UNIT_TEST(do_many_allocations)
8181
unsigned misalignments = 0;
8282
unsigned min_alignment = heapmem_alignment();
8383

84+
/* The minimum alignment value must be a power of two */
8485
UNIT_TEST_ASSERT(min_alignment != 0);
8586
UNIT_TEST_ASSERT(!(min_alignment & (min_alignment - 1)));
8687

@@ -146,6 +147,8 @@ UNIT_TEST(invalid_freeing)
146147
UNIT_TEST_ASSERT(heapmem_free(NULL) == false);
147148

148149
char *ptr = heapmem_alloc(10);
150+
/* This small allocation should succeed. */
151+
UNIT_TEST_ASSERT(ptr != NULL);
149152
/* A single free operation on allocated memory should succeed. */
150153
UNIT_TEST_ASSERT(heapmem_free(ptr) == true);
151154

@@ -168,7 +171,7 @@ UNIT_TEST(max_alloc)
168171

169172
/* The test uses a much smaller size than the theoretical maximum because
170173
the heapmem module is not yet supporting such large allocations. */
171-
printf("Allocate %zu bytes\n", stats_before.available/ 2);
174+
printf("Allocate %zu bytes\n", stats_before.available / 2);
172175
char *ptr = heapmem_alloc(stats_before.available / 2);
173176

174177
UNIT_TEST_ASSERT(ptr != NULL);
@@ -191,7 +194,8 @@ UNIT_TEST(stats_check)
191194
heapmem_stats_t stats;
192195
heapmem_stats(&stats);
193196

194-
printf("* allocated %zu\n* overhead %zu\n* available %zu\n* footprint %zu\n* chunks %zu\n",
197+
printf("* allocated %zu\n* overhead %zu\n* available %zu\n"
198+
"* footprint %zu\n* chunks %zu\n",
195199
stats.allocated, stats.overhead, stats.available,
196200
stats.footprint, stats.chunks);
197201

0 commit comments

Comments
 (0)