Bump API snapshot submodule
[mono.git] / eglib / test / memory.c
1
2 #include <glib.h>
3 #include "test.h"
4
5 RESULT
6 test_memory_zero_size_allocations ()
7 {
8         gpointer p;
9
10         p = g_malloc (0);
11         if (p)
12                 return FAILED ("Calling g_malloc with size zero should return NULL.");
13
14         p = g_malloc0 (0);
15         if (p)
16                 return FAILED ("Calling g_malloc0 with size zero should return NULL.");
17
18         p = g_realloc (NULL, 0);
19         if (p)
20                 return FAILED ("Calling g_realloc with size zero should return NULL.");
21
22         p = g_new (int, 0);
23         if (p)
24                 return FAILED ("Calling g_new with size zero should return NULL.");
25
26         p = g_new0 (int, 0);
27         if (p)
28                 return FAILED ("Calling g_new0 with size zero should return NULL.");
29
30         return OK;
31 }
32
33
34 static Test memory_tests [] = {
35         {       "zero_size_allocations", test_memory_zero_size_allocations},
36         {NULL, NULL}
37 };
38
39 DEFINE_TEST_GROUP_INIT(memory_tests_init, memory_tests)
40