[System] Add new 'Mono.Security.Interface.MonoTlsProviderFactory' callback to let...
[mono.git] / mono / unit-tests / test-mono-handle.c
1 /*
2  * test-mono-handle: tests for MonoHandle and MonoHandleArena
3  *
4  * Authors:
5  *   Aleksey Kliger <aleksey@xamarin.com>
6  *
7  * Copyright 2015 Xamarin, Inc. (www.xamarin.com)
8  */
9
10 #include <config.h>
11 #include <glib.h>
12 #include <mono/metadata/handle.h>
13
14 static void
15 test2_arena_push_pop ()
16 {
17         MonoHandleArena *top = NULL;
18
19         MonoHandleArena *new_arena1 = g_malloc0 (mono_handle_arena_size ());
20         mono_handle_arena_stack_push (&top, new_arena1);
21
22         MonoHandleArena *new_arena2 = g_malloc0 (mono_handle_arena_size ());
23
24         mono_handle_arena_stack_push (&top, new_arena2);
25
26         g_assert (top == new_arena2);
27
28         mono_handle_arena_stack_pop (&top, new_arena2);
29
30         g_free (new_arena2);
31
32         g_assert (top == new_arena1);
33
34         mono_handle_arena_stack_pop (&top, new_arena1);
35
36         g_assert (top == NULL);
37         
38         g_free (new_arena1);
39 }
40
41
42
43 int
44 main (int argc, const char* argv[])
45 {
46         test2_arena_push_pop ();
47
48         return 0;
49 }