1/*
2 * Copyright © 2020 Benjamin Otte
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authors: Benjamin Otte <otte@gnome.org>
18 */
19
20#include <locale.h>
21
22#include <gtk/gtk.h>
23
24static void
25int_free_func (int data)
26{
27}
28
29#define GDK_ARRAY_ELEMENT_TYPE int
30#define GDK_ARRAY_NAME int_array
31#define GDK_ARRAY_TYPE_NAME IntVector
32#include "arrayimpl.c"
33
34#define GDK_ARRAY_ELEMENT_TYPE int
35#define GDK_ARRAY_NAME pre_int_array
36#define GDK_ARRAY_TYPE_NAME PreIntVector
37#define GDK_ARRAY_PREALLOC 100
38#include "arrayimpl.c"
39
40#define GDK_ARRAY_ELEMENT_TYPE int
41#define GDK_ARRAY_NAME free_int_array
42#define GDK_ARRAY_TYPE_NAME FreeIntVector
43#define GDK_ARRAY_FREE_FUNC int_free_func
44#include "arrayimpl.c"
45
46#define GDK_ARRAY_ELEMENT_TYPE int
47#define GDK_ARRAY_NAME pre_free_int_array
48#define GDK_ARRAY_TYPE_NAME PreFreeIntVector
49#define GDK_ARRAY_PREALLOC 100
50#define GDK_ARRAY_FREE_FUNC int_free_func
51#include "arrayimpl.c"
52
53#define GDK_ARRAY_ELEMENT_TYPE int
54#define GDK_ARRAY_NAME null_int_array
55#define GDK_ARRAY_TYPE_NAME NullIntVector
56#define GDK_ARRAY_NULL_TERMINATED 1
57#include "arrayimpl.c"
58
59#define GDK_ARRAY_ELEMENT_TYPE int
60#define GDK_ARRAY_NAME null_pre_int_array
61#define GDK_ARRAY_TYPE_NAME NullPreIntVector
62#define GDK_ARRAY_PREALLOC 100
63#define GDK_ARRAY_NULL_TERMINATED 1
64#include "arrayimpl.c"
65
66#define GDK_ARRAY_ELEMENT_TYPE int
67#define GDK_ARRAY_NAME null_free_int_array
68#define GDK_ARRAY_TYPE_NAME NullFreeIntVector
69#define GDK_ARRAY_FREE_FUNC int_free_func
70#define GDK_ARRAY_NULL_TERMINATED 1
71#include "arrayimpl.c"
72
73#define GDK_ARRAY_ELEMENT_TYPE int
74#define GDK_ARRAY_NAME null_pre_free_int_array
75#define GDK_ARRAY_TYPE_NAME NullPreFreeIntVector
76#define GDK_ARRAY_PREALLOC 100
77#define GDK_ARRAY_FREE_FUNC int_free_func
78#define GDK_ARRAY_NULL_TERMINATED 1
79#include "arrayimpl.c"
80
81int
82main (int argc, char *argv[])
83{
84 (g_test_init) (argc: &argc, argv: &argv, NULL);
85 setlocale (LC_ALL, locale: "C");
86
87 g_test_add_func (testpath: "/intarray/simple", test_func: int_array_test_simple);
88 g_test_add_func (testpath: "/intarray/prealloc/simple", test_func: pre_int_array_test_simple);
89 g_test_add_func (testpath: "/intarray/freefunc/simple", test_func: free_int_array_test_simple);
90 g_test_add_func (testpath: "/intarray/prealloc/freefunc/simple", test_func: pre_free_int_array_test_simple);
91 g_test_add_func (testpath: "/intarray/null/simple", test_func: null_int_array_test_simple);
92 g_test_add_func (testpath: "/intarray/null/prealloc/simple", test_func: null_pre_int_array_test_simple);
93 g_test_add_func (testpath: "/intarray/null/freefunc/simple", test_func: null_free_int_array_test_simple);
94 g_test_add_func (testpath: "/intarray/null/prealloc/freefunc/simple", test_func: null_pre_free_int_array_test_simple);
95 g_test_add_func (testpath: "/intarray/splice", test_func: int_array_test_splice);
96 g_test_add_func (testpath: "/intarray/prealloc/splice", test_func: pre_int_array_test_splice);
97 g_test_add_func (testpath: "/intarray/freefunc/splice", test_func: free_int_array_test_splice);
98 g_test_add_func (testpath: "/intarray/prealloc/freefunc/splice", test_func: pre_free_int_array_test_splice);
99 g_test_add_func (testpath: "/intarray/null/splice", test_func: null_int_array_test_splice);
100 g_test_add_func (testpath: "/intarray/null/prealloc/splice", test_func: null_pre_int_array_test_splice);
101 g_test_add_func (testpath: "/intarray/null/freefunc/splice", test_func: null_free_int_array_test_splice);
102 g_test_add_func (testpath: "/intarray/null/prealloc/freefunc/splice", test_func: null_pre_free_int_array_test_splice);
103
104 return g_test_run ();
105}
106

source code of gtk/testsuite/gdk/array.c