2010-05-06 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / eglib / test / memory.c
blobdb7db080915e6b6e89ee68de259178be01440b40
2 #include <glib.h>
3 #include "test.h"
5 RESULT
6 test_memory_zero_size_allocations ()
8 gpointer p;
10 p = g_malloc (0);
11 if (p)
12 return FAILED ("Calling g_malloc with size zero should return NULL.");
14 p = g_malloc0 (0);
15 if (p)
16 return FAILED ("Calling g_malloc0 with size zero should return NULL.");
18 p = g_realloc (NULL, 0);
19 if (p)
20 return FAILED ("Calling g_realloc with size zero should return NULL.");
22 p = g_new (int, 0);
23 if (p)
24 return FAILED ("Calling g_new with size zero should return NULL.");
26 p = g_new0 (int, 0);
27 if (p)
28 return FAILED ("Calling g_new0 with size zero should return NULL.");
30 return OK;
34 static Test memory_tests [] = {
35 { "zero_size_allocations", test_memory_zero_size_allocations},
36 {NULL, NULL}
39 DEFINE_TEST_GROUP_INIT(memory_tests_init, memory_tests)