IronGOLEM/tests/galloc.🗿

25 lines
408 B
Plaintext
Raw Permalink Normal View History

2023-06-18 09:16:58 -04:00
global HEAP_SIZE = 0x0030;
main()
{
2023-06-18 05:11:23 -04:00
local ptr1;
local ptr2;
name = "galloc";
2023-06-18 05:11:23 -04:00
ptr1 = galloc(1);
2023-07-26 13:35:27 -04:00
test_num(ptr1, heap + GALLOC_DATA, "");
2023-06-18 05:11:23 -04:00
free(ptr1);
2023-06-18 09:16:58 -04:00
2023-06-18 05:11:23 -04:00
ptr1 = galloc(1);
2023-07-26 13:35:27 -04:00
test_num(ptr1, heap + GALLOC_DATA, "alloc after free");
2023-06-18 09:16:58 -04:00
free(ptr1);
ptr2 = galloc(0x9000);
2023-06-18 14:03:27 -04:00
test_num(ptr2, 0, "alloc too big");
2023-07-23 09:35:16 -04:00
test_num(leaks(), 0, "leaks");
ptr1 = galloc(1);
2023-07-23 09:35:16 -04:00
test_num(leaks(), 1, "leaks");
free(ptr1);
}