feature #2

Closed
thoehne wants to merge 4 commits from feature into main
10 changed files with 387 additions and 72 deletions
Showing only changes of commit 763781b92d - Show all commits

View File

@@ -28,8 +28,9 @@
if (exp != act) \ if (exp != act) \
{ \ { \
test->passed = false; \ test->passed = false; \
test->error_msg = format_string( \ test->error_msg = \
"Expected %d to be %d\n Failed with message: " msg, act, exp); \ format_string("Expected %d to be %d\n Failed with message: %s", \
act, exp, msg); \
return; \ return; \
} }

View File

@@ -28,8 +28,11 @@ struct SETBlockMeta *set_ll_free_one(struct SETBlockMeta *head, void *address)
if (meta == head) if (meta == head)
{ {
struct SETBlockMeta *ret = meta->next; struct SETBlockMeta *ret = meta->next;
ret->prev = NULL; if (ret)
ret->end = meta->end; {
ret->prev = NULL;
ret->end = meta->end;
}
free(meta); free(meta);
return ret; return ret;
} }

View File

@@ -15,7 +15,7 @@ char *format_string(const char *fmt, ...)
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
size_t size = vsnprintf(NULL, 0, fmt, args); size_t size = vsnprintf(NULL, 0, fmt, args);
char *out = (char *)malloc(size + 1); char *out = (char *)set_malloc(size + 1);
if (!out) if (!out)
{ {

View File

@@ -61,6 +61,7 @@ TEST(Other_Basic)
TEST(Other_With_Malloc) TEST(Other_With_Malloc)
{ {
int *some_array = set_malloc(20 * sizeof(int)); int *some_array = set_malloc(20 * sizeof(int));
int *array = set_malloc(20);
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
{ {
@@ -73,6 +74,9 @@ TEST(Other_With_Malloc)
} }
fprintf(stdout, ".\n"); fprintf(stdout, ".\n");
set_free(array);
set_free(some_array);
ASSERT_TRUE(false); ASSERT_TRUE(false);
} }