annotate tests/test-rbtree_list.c @ 40231:9b3c79fdfe0b

strtod: fix clash with strtold Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817). * lib/strtod.c (compute_minus_zero, minus_zero): Simplify by remving the macro / external variable, and having just a function. User changed. This avoids the need for an external variable that might clash.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 11 Mar 2019 16:40:29 -0700
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of sequential list data type implementation.
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 Copyright (C) 2006-2019 Free Software Foundation, Inc.
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 Written by Bruno Haible <bruno@clisp.org>, 2006.
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8891
diff changeset
5 This program is free software: you can redistribute it and/or modify
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8891
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8891
diff changeset
8 (at your option) any later version.
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18626
diff changeset
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
8891
633babea5f62 Unconditionally include <config.h> in unit tests.
Eric Blake <ebb9@byu.net>
parents: 8754
diff changeset
18 #include <config.h>
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
8298
0afb48f6e566 Avoid link error due to program_name.
Bruno Haible <bruno@clisp.org>
parents: 6980
diff changeset
20 #include "gl_rbtree_list.h"
0afb48f6e566 Avoid link error due to program_name.
Bruno Haible <bruno@clisp.org>
parents: 6980
diff changeset
21
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #include <stdlib.h>
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 #include "gl_array_list.h"
12496
a48d3d749ca5 Refactor common macros used in tests.
Bruno Haible <bruno@clisp.org>
parents: 12445
diff changeset
25 #include "macros.h"
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 extern void gl_rbtree_list_check_invariants (gl_list_t list);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 static const char *objects[15] =
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o"
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 };
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 #define RANDOM(n) (rand () % (n))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 static void
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 check_equals (gl_list_t list1, gl_list_t list2)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 size_t n, i;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 n = gl_list_size (list1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 ASSERT (n == gl_list_size (list2));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 for (i = 0; i < n; i++)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 ASSERT (gl_list_get_at (list1, i) == gl_list_get_at (list2, i));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 static void
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 check_all (gl_list_t list1, gl_list_t list2, gl_list_t list3)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 gl_rbtree_list_check_invariants (list2);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 gl_rbtree_list_check_invariants (list3);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 check_equals (list1, list2);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 check_equals (list1, list3);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 int
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 main (int argc, char *argv[])
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 gl_list_t list1, list2, list3;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 /* Allow the user to provide a non-default random seed on the command line. */
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 if (argc > 1)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 srand (atoi (argv[1]));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 size_t initial_size = RANDOM (50);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 const void **contents =
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 (const void **) malloc (initial_size * sizeof (const void *));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 size_t i;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 unsigned int repeat;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 for (i = 0; i < initial_size; i++)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 contents[i] = RANDOM_OBJECT ();
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 /* Create list1. */
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
79 list1 = gl_list_nx_create (GL_ARRAY_LIST, NULL, NULL, NULL, true,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
80 initial_size, contents);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
81 ASSERT (list1 != NULL);
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82 /* Create list2. */
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
83 list2 = gl_list_nx_create_empty (GL_RBTREE_LIST, NULL, NULL, NULL, true);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
84 ASSERT (list2 != NULL);
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 for (i = 0; i < initial_size; i++)
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
86 ASSERT (gl_list_nx_add_last (list2, contents[i]) != NULL);
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
87
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 /* Create list3. */
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
89 list3 = gl_list_nx_create (GL_RBTREE_LIST, NULL, NULL, NULL, true,
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
90 initial_size, contents);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
91 ASSERT (list3 != NULL);
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 check_all (list1, list2, list3);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 for (repeat = 0; repeat < 10000; repeat++)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 unsigned int operation = RANDOM (16);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98 switch (operation)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 case 0:
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 if (gl_list_size (list1) > 0)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
102 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
103 size_t index = RANDOM (gl_list_size (list1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
104 const char *obj = RANDOM_OBJECT ();
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 gl_list_node_t node1, node2, node3;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
107 node1 = gl_list_nx_set_at (list1, index, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
108 ASSERT (node1 != NULL);
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 ASSERT (gl_list_get_at (list1, index) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 ASSERT (gl_list_node_value (list1, node1) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
112 node2 = gl_list_nx_set_at (list2, index, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
113 ASSERT (node2 != NULL);
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 ASSERT (gl_list_get_at (list2, index) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115 ASSERT (gl_list_node_value (list2, node2) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
117 node3 = gl_list_nx_set_at (list3, index, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
118 ASSERT (node3 != NULL);
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
119 ASSERT (gl_list_get_at (list3, index) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 ASSERT (gl_list_node_value (list3, node3) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122 if (index > 0)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 ASSERT (gl_list_node_value (list1, gl_list_previous_node (list1, node1))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125 == gl_list_get_at (list1, index - 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 ASSERT (gl_list_node_value (list2, gl_list_previous_node (list3, node3))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 == gl_list_get_at (list2, index - 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 ASSERT (gl_list_node_value (list3, gl_list_previous_node (list3, node3))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 == gl_list_get_at (list2, index - 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 if (index + 1 < gl_list_size (list1))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 ASSERT (gl_list_node_value (list1, gl_list_next_node (list1, node1))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 == gl_list_get_at (list1, index + 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135 ASSERT (gl_list_node_value (list2, gl_list_next_node (list3, node3))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 == gl_list_get_at (list2, index + 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 ASSERT (gl_list_node_value (list3, gl_list_next_node (list3, node3))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 == gl_list_get_at (list2, index + 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
140 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
141 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
142 case 1:
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
143 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144 const char *obj = RANDOM_OBJECT ();
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
145 gl_list_node_t node1, node2, node3;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146 node1 = gl_list_search (list1, obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
147 node2 = gl_list_search (list2, obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148 node3 = gl_list_search (list3, obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
149 if (node1 == NULL)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
150 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
151 ASSERT (node2 == NULL);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
152 ASSERT (node3 == NULL);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
153 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154 else
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
156 ASSERT (node2 != NULL);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
157 ASSERT (node3 != NULL);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
158 ASSERT (gl_list_node_value (list1, node1) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
159 ASSERT (gl_list_node_value (list2, node2) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
160 ASSERT (gl_list_node_value (list3, node3) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
161 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
162 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
163 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
164 case 2:
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
165 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
166 const char *obj = RANDOM_OBJECT ();
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
167 size_t index1, index2, index3;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
168 index1 = gl_list_indexof (list1, obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
169 index2 = gl_list_indexof (list2, obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
170 index3 = gl_list_indexof (list3, obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
171 if (index1 == (size_t)(-1))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
172 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
173 ASSERT (index2 == (size_t)(-1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
174 ASSERT (index3 == (size_t)(-1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
175 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
176 else
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
177 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
178 ASSERT (index2 != (size_t)(-1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
179 ASSERT (index3 != (size_t)(-1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
180 ASSERT (gl_list_get_at (list1, index1) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
181 ASSERT (gl_list_get_at (list2, index2) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
182 ASSERT (gl_list_get_at (list3, index3) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
183 ASSERT (index2 == index1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
184 ASSERT (index3 == index1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
185 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
186 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
187 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
188 case 3: /* add 1 element */
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
189 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
190 const char *obj = RANDOM_OBJECT ();
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
191 gl_list_node_t node1, node2, node3;
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
192 node1 = gl_list_nx_add_first (list1, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
193 ASSERT (node1 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
194 node2 = gl_list_nx_add_first (list2, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
195 ASSERT (node2 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
196 node3 = gl_list_nx_add_first (list3, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
197 ASSERT (node3 != NULL);
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
198 ASSERT (gl_list_node_value (list1, node1) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
199 ASSERT (gl_list_node_value (list2, node2) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
200 ASSERT (gl_list_node_value (list3, node3) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
201 ASSERT (gl_list_get_at (list1, 0) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
202 ASSERT (gl_list_get_at (list2, 0) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
203 ASSERT (gl_list_get_at (list3, 0) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
204 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
205 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
206 case 4: /* add 1 element */
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
207 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
208 const char *obj = RANDOM_OBJECT ();
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
209 gl_list_node_t node1, node2, node3;
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
210 node1 = gl_list_nx_add_last (list1, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
211 ASSERT (node1 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
212 node2 = gl_list_nx_add_last (list2, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
213 ASSERT (node2 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
214 node3 = gl_list_nx_add_last (list3, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
215 ASSERT (node3 != NULL);
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
216 ASSERT (gl_list_node_value (list1, node1) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
217 ASSERT (gl_list_node_value (list2, node2) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
218 ASSERT (gl_list_node_value (list3, node3) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
219 ASSERT (gl_list_get_at (list1, gl_list_size (list1) - 1) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
220 ASSERT (gl_list_get_at (list2, gl_list_size (list2) - 1) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
221 ASSERT (gl_list_get_at (list3, gl_list_size (list3) - 1) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
222 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
223 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
224 case 5: /* add 3 elements */
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
225 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
226 const char *obj0 = RANDOM_OBJECT ();
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
227 const char *obj1 = RANDOM_OBJECT ();
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
228 const char *obj2 = RANDOM_OBJECT ();
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
229 gl_list_node_t node1, node2, node3;
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
230 node1 = gl_list_nx_add_first (list1, obj2);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
231 ASSERT (node1 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
232 node1 = gl_list_nx_add_before (list1, node1, obj0);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
233 ASSERT (node1 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
234 node1 = gl_list_nx_add_after (list1, node1, obj1);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
235 ASSERT (node1 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
236 node2 = gl_list_nx_add_first (list2, obj2);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
237 ASSERT (node2 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
238 node2 = gl_list_nx_add_before (list2, node2, obj0);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
239 ASSERT (node2 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
240 node2 = gl_list_nx_add_after (list2, node2, obj1);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
241 ASSERT (node2 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
242 node3 = gl_list_nx_add_first (list3, obj2);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
243 ASSERT (node3 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
244 node3 = gl_list_nx_add_before (list3, node3, obj0);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
245 ASSERT (node3 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
246 node3 = gl_list_nx_add_after (list3, node3, obj1);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
247 ASSERT (node3 != NULL);
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
248 ASSERT (gl_list_node_value (list1, node1) == obj1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
249 ASSERT (gl_list_node_value (list2, node2) == obj1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
250 ASSERT (gl_list_node_value (list3, node3) == obj1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
251 ASSERT (gl_list_get_at (list1, 0) == obj0);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
252 ASSERT (gl_list_get_at (list1, 1) == obj1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
253 ASSERT (gl_list_get_at (list1, 2) == obj2);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
254 ASSERT (gl_list_get_at (list2, 0) == obj0);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
255 ASSERT (gl_list_get_at (list2, 1) == obj1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
256 ASSERT (gl_list_get_at (list2, 2) == obj2);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
257 ASSERT (gl_list_get_at (list3, 0) == obj0);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
258 ASSERT (gl_list_get_at (list3, 1) == obj1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
259 ASSERT (gl_list_get_at (list3, 2) == obj2);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
260 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
261 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
262 case 6: /* add 1 element */
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
263 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
264 size_t index = RANDOM (gl_list_size (list1) + 1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
265 const char *obj = RANDOM_OBJECT ();
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
266 gl_list_node_t node1, node2, node3;
12445
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
267 node1 = gl_list_nx_add_at (list1, index, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
268 ASSERT (node1 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
269 node2 = gl_list_nx_add_at (list2, index, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
270 ASSERT (node2 != NULL);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
271 node3 = gl_list_nx_add_at (list3, index, obj);
a8c91b846640 Move the malloc checking from module 'list' to new module 'xlist'.
Bruno Haible <bruno@clisp.org>
parents: 12421
diff changeset
272 ASSERT (node3 != NULL);
6980
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
273 ASSERT (gl_list_get_at (list1, index) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
274 ASSERT (gl_list_node_value (list1, node1) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
275 ASSERT (gl_list_get_at (list2, index) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
276 ASSERT (gl_list_node_value (list2, node2) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
277 ASSERT (gl_list_get_at (list3, index) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
278 ASSERT (gl_list_node_value (list3, node3) == obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
279 if (index > 0)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
280 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
281 ASSERT (gl_list_node_value (list1, gl_list_previous_node (list1, node1))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
282 == gl_list_get_at (list1, index - 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
283 ASSERT (gl_list_node_value (list2, gl_list_previous_node (list3, node3))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
284 == gl_list_get_at (list2, index - 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
285 ASSERT (gl_list_node_value (list3, gl_list_previous_node (list3, node3))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
286 == gl_list_get_at (list2, index - 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
287 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
288 if (index + 1 < gl_list_size (list1))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
289 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
290 ASSERT (gl_list_node_value (list1, gl_list_next_node (list1, node1))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
291 == gl_list_get_at (list1, index + 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
292 ASSERT (gl_list_node_value (list2, gl_list_next_node (list3, node3))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
293 == gl_list_get_at (list2, index + 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
294 ASSERT (gl_list_node_value (list3, gl_list_next_node (list3, node3))
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
295 == gl_list_get_at (list2, index + 1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
296 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
297 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
298 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
299 case 7: case 8: /* remove 1 element */
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
300 if (gl_list_size (list1) > 0)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
301 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
302 size_t n = gl_list_size (list1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
303 const char *obj = gl_list_get_at (list1, RANDOM (n));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
304 gl_list_node_t node1, node2, node3;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
305 node1 = gl_list_search (list1, obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
306 node2 = gl_list_search (list2, obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
307 node3 = gl_list_search (list3, obj);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
308 ASSERT (node1 != NULL);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
309 ASSERT (node2 != NULL);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
310 ASSERT (node3 != NULL);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
311 ASSERT (gl_list_remove_node (list1, node1));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
312 ASSERT (gl_list_remove_node (list2, node2));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
313 ASSERT (gl_list_remove_node (list3, node3));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
314 ASSERT (gl_list_size (list1) == n - 1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
315 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
316 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
317 case 9: case 10: /* remove 1 element */
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
318 if (gl_list_size (list1) > 0)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
319 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
320 size_t n = gl_list_size (list1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
321 size_t index = RANDOM (n);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
322 ASSERT (gl_list_remove_at (list1, index));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
323 ASSERT (gl_list_remove_at (list2, index));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
324 ASSERT (gl_list_remove_at (list3, index));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
325 ASSERT (gl_list_size (list1) == n - 1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
326 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
327 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
328 case 11: case 12: /* remove 1 element */
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
329 if (gl_list_size (list1) > 0)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
330 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
331 size_t n = gl_list_size (list1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
332 const char *obj = gl_list_get_at (list1, RANDOM (n));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
333 ASSERT (gl_list_remove (list1, obj));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
334 ASSERT (gl_list_remove (list2, obj));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
335 ASSERT (gl_list_remove (list3, obj));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
336 ASSERT (gl_list_size (list1) == n - 1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
337 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
338 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
339 case 13:
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
340 if (gl_list_size (list1) > 0)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
341 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
342 size_t n = gl_list_size (list1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
343 const char *obj = "xyzzy";
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
344 ASSERT (!gl_list_remove (list1, obj));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
345 ASSERT (!gl_list_remove (list2, obj));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
346 ASSERT (!gl_list_remove (list3, obj));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
347 ASSERT (gl_list_size (list1) == n);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
348 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
349 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
350 case 14:
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
351 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
352 size_t n = gl_list_size (list1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
353 gl_list_iterator_t iter1, iter2, iter3;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
354 const void *elt;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
355 iter1 = gl_list_iterator (list1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
356 iter2 = gl_list_iterator (list2);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
357 iter3 = gl_list_iterator (list3);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
358 for (i = 0; i < n; i++)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
359 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
360 ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
361 ASSERT (gl_list_get_at (list1, i) == elt);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
362 ASSERT (gl_list_iterator_next (&iter2, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
363 ASSERT (gl_list_get_at (list2, i) == elt);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
364 ASSERT (gl_list_iterator_next (&iter3, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
365 ASSERT (gl_list_get_at (list3, i) == elt);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
366 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
367 ASSERT (!gl_list_iterator_next (&iter1, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
368 ASSERT (!gl_list_iterator_next (&iter2, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
369 ASSERT (!gl_list_iterator_next (&iter3, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
370 gl_list_iterator_free (&iter1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
371 gl_list_iterator_free (&iter2);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
372 gl_list_iterator_free (&iter3);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
373 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
374 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
375 case 15:
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
376 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
377 size_t end = RANDOM (gl_list_size (list1) + 1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
378 size_t start = RANDOM (end + 1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
379 gl_list_iterator_t iter1, iter2, iter3;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
380 const void *elt;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
381 iter1 = gl_list_iterator_from_to (list1, start, end);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
382 iter2 = gl_list_iterator_from_to (list2, start, end);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
383 iter3 = gl_list_iterator_from_to (list3, start, end);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
384 for (i = start; i < end; i++)
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
385 {
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
386 ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
387 ASSERT (gl_list_get_at (list1, i) == elt);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
388 ASSERT (gl_list_iterator_next (&iter2, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
389 ASSERT (gl_list_get_at (list2, i) == elt);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
390 ASSERT (gl_list_iterator_next (&iter3, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
391 ASSERT (gl_list_get_at (list3, i) == elt);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
392 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
393 ASSERT (!gl_list_iterator_next (&iter1, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
394 ASSERT (!gl_list_iterator_next (&iter2, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
395 ASSERT (!gl_list_iterator_next (&iter3, &elt, NULL));
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
396 gl_list_iterator_free (&iter1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
397 gl_list_iterator_free (&iter2);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
398 gl_list_iterator_free (&iter3);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
399 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
400 break;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
401 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
402 check_all (list1, list2, list3);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
403 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
404
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
405 gl_list_free (list1);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
406 gl_list_free (list2);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
407 gl_list_free (list3);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
408 free (contents);
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
409 }
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
410
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
411 return 0;
9ccb96800d02 Sequential list data type implemented by a binary tree.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
412 }