@@ -81,6 +81,7 @@ UNIT_TEST(do_many_allocations)
81
81
unsigned misalignments = 0 ;
82
82
unsigned min_alignment = heapmem_alignment ();
83
83
84
+ /* The minimum alignment value must be a power of two */
84
85
UNIT_TEST_ASSERT (min_alignment != 0 );
85
86
UNIT_TEST_ASSERT (!(min_alignment & (min_alignment - 1 )));
86
87
@@ -146,6 +147,8 @@ UNIT_TEST(invalid_freeing)
146
147
UNIT_TEST_ASSERT (heapmem_free (NULL ) == false);
147
148
148
149
char * ptr = heapmem_alloc (10 );
150
+ /* This small allocation should succeed. */
151
+ UNIT_TEST_ASSERT (ptr != NULL );
149
152
/* A single free operation on allocated memory should succeed. */
150
153
UNIT_TEST_ASSERT (heapmem_free (ptr ) == true);
151
154
@@ -168,7 +171,7 @@ UNIT_TEST(max_alloc)
168
171
169
172
/* The test uses a much smaller size than the theoretical maximum because
170
173
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 );
172
175
char * ptr = heapmem_alloc (stats_before .available / 2 );
173
176
174
177
UNIT_TEST_ASSERT (ptr != NULL );
@@ -191,7 +194,8 @@ UNIT_TEST(stats_check)
191
194
heapmem_stats_t stats ;
192
195
heapmem_stats (& stats );
193
196
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" ,
195
199
stats .allocated , stats .overhead , stats .available ,
196
200
stats .footprint , stats .chunks );
197
201
0 commit comments