2 * test-mono-handle: tests for MonoHandle and MonoHandleArena
5 * Aleksey Kliger <aleksey@xamarin.com>
7 * Copyright 2015 Xamarin, Inc. (www.xamarin.com)
12 #include <mono/metadata/handle.h>
13 #include <mono/metadata/handle-private.h>
18 for (gsize i = 1; i < 10; ++i) {
19 gsize sz = mono_handle_arena_size(i);
20 g_assert(sz >= i*sizeof(MonoHandle));
25 test2_arena_push_pop ()
27 MonoHandleArena *top = NULL;
29 const int n_handles = 3;
30 MonoHandleArena *new_arena1 = g_malloc0 (mono_handle_arena_size (n_handles));
31 mono_handle_arena_stack_push (&top, new_arena1, n_handles);
33 MonoHandleArena *new_arena2 = g_malloc0 (mono_handle_arena_size (n_handles));
35 mono_handle_arena_stack_push (&top, new_arena2, n_handles);
37 g_assert (top == new_arena2);
39 mono_handle_arena_stack_pop (&top, new_arena2, n_handles);
43 g_assert (top == new_arena1);
45 mono_handle_arena_stack_pop (&top, new_arena1, n_handles);
47 g_assert (top == NULL);
55 main (int argc, const char* argv[])
59 test2_arena_push_pop ();