Found a leak, moving to linux

This commit is contained in:
2022-08-28 23:47:58 +01:00
parent f705d82aee
commit 4fb2dea1b4
5 changed files with 95 additions and 4 deletions

View File

@@ -10,7 +10,6 @@ int main() {
//test a single null literal
Literal literal = TO_NULL_LITERAL;
//
if (!IS_NULL(literal)) {
fprintf(stderr, ERROR "ERROR: null literal failed\n" RESET);
return -1;
@@ -22,7 +21,6 @@ int main() {
Literal t = TO_BOOLEAN_LITERAL(true);
Literal f = TO_BOOLEAN_LITERAL(false);
//
if (!IS_TRUTHY(t) || IS_TRUTHY(f)) {
fprintf(stderr, ERROR "ERROR: boolean literal failed\n" RESET);
return -1;
@@ -30,6 +28,7 @@ int main() {
}
{
//test string literals
char* buffer = ALLOCATE(char, 128);
snprintf(buffer, 128, "Hello world");
@@ -39,6 +38,17 @@ int main() {
freeLiteral(literal);
}
{
//test identifier literals
char* buffer = ALLOCATE(char, 128);
snprintf(buffer, 128, "foobar");
Literal literal = TO_IDENTIFIER_LITERAL(buffer, 128);
freeLiteral(literal);
}
//check allocated memory
if (getAllocatedMemoryCount() != 0) {
fprintf(stderr, ERROR "ERROR: Dangling memory detected: %d byes\n" RESET, getAllocatedMemoryCount());