Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
DUDES. We need one copy and only one copy of that damn prototype. Problems of hard...
[simgrid.git] / src / dynar_unit.c
1 /*******************************/
2 /* GENERATED FILE, DO NOT EDIT */
3 /*******************************/
4
5 #include <stdio.h>
6 #include "xbt.h"
7 /*******************************/
8 /* GENERATED FILE, DO NOT EDIT */
9 /*******************************/
10
11 #line 790 "xbt/dynar.c" 
12
13 #define NB_ELEM 5000
14
15 XBT_LOG_EXTERNAL_CATEGORY(xbt_dyn);
16 XBT_LOG_DEFAULT_CATEGORY(xbt_dyn);
17
18 XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
19 {
20   /* Vars_decl [doxygen cruft] */
21   xbt_dynar_t d;
22   int i, cpt;
23   unsigned int cursor;
24   int *iptr;
25
26   xbt_test_add0("==== Traverse the empty dynar");
27   d = xbt_dynar_new(sizeof(int), NULL);
28   xbt_dynar_foreach(d, cursor, i) {
29     xbt_assert0(0, "Damnit, there is something in the empty dynar");
30   }
31   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
32   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
33   /* in your code is naturally the way to go outside a regression test */
34
35   xbt_test_add1
36       ("==== Push %d int, set them again 3 times, traverse them, shift them",
37        NB_ELEM);
38   /* Populate_ints [doxygen cruft] */
39   /* 1. Populate the dynar */
40   d = xbt_dynar_new(sizeof(int), NULL);
41   for (cpt = 0; cpt < NB_ELEM; cpt++) {
42     xbt_dynar_push_as(d, int, cpt);     /* This is faster (and possible only with scalars) */
43     /* xbt_dynar_push(d,&cpt);       This would also work */
44     xbt_test_log2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
45   }
46
47   /* 2. Traverse manually the dynar */
48   for (cursor = 0; cursor < NB_ELEM; cursor++) {
49     iptr = xbt_dynar_get_ptr(d, cursor);
50     xbt_test_assert2(cursor == *iptr,
51                      "The retrieved value is not the same than the injected one (%d!=%d)",
52                      cursor, cpt);
53   }
54
55   /* 3. Traverse the dynar using the neat macro to that extend */
56   xbt_dynar_foreach(d, cursor, cpt) {
57     xbt_test_assert2(cursor == cpt,
58                      "The retrieved value is not the same than the injected one (%d!=%d)",
59                      cursor, cpt);
60   }
61   /* end_of_traversal */
62
63   for (cpt = 0; cpt < NB_ELEM; cpt++)
64     *(int *) xbt_dynar_get_ptr(d, cpt) = cpt;
65
66   for (cpt = 0; cpt < NB_ELEM; cpt++)
67     *(int *) xbt_dynar_get_ptr(d, cpt) = cpt;
68   /*     xbt_dynar_set(d,cpt,&cpt); */
69
70   for (cpt = 0; cpt < NB_ELEM; cpt++)
71     *(int *) xbt_dynar_get_ptr(d, cpt) = cpt;
72
73   cpt = 0;
74   xbt_dynar_foreach(d, cursor, i) {
75     xbt_test_assert2(i == cpt,
76                      "The retrieved value is not the same than the injected one (%d!=%d)",
77                      i, cpt);
78     cpt++;
79   }
80   xbt_test_assert2(cpt == NB_ELEM,
81                    "Cannot retrieve my %d values. Last got one is %d",
82                    NB_ELEM, cpt);
83
84   /* shifting [doxygen cruft] */
85   /* 4. Shift all the values */
86   for (cpt = 0; cpt < NB_ELEM; cpt++) {
87     xbt_dynar_shift(d, &i);
88     xbt_test_assert2(i == cpt,
89                      "The retrieved value is not the same than the injected one (%d!=%d)",
90                      i, cpt);
91     xbt_test_log2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
92   }
93
94   /* 5. Free the resources */
95   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
96   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
97   /* in your code is naturally the way to go outside a regression test */
98
99   xbt_test_add1("==== Unshift/pop %d int", NB_ELEM);
100   d = xbt_dynar_new(sizeof(int), NULL);
101   for (cpt = 0; cpt < NB_ELEM; cpt++) {
102     xbt_dynar_unshift(d, &cpt);
103     DEBUG2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
104   }
105   for (cpt = 0; cpt < NB_ELEM; cpt++) {
106     i = xbt_dynar_pop_as(d, int);
107     xbt_test_assert2(i == cpt,
108                      "The retrieved value is not the same than the injected one (%d!=%d)",
109                      i, cpt);
110     xbt_test_log2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
111   }
112   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
113   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
114   /* in your code is naturally the way to go outside a regression test */
115
116
117   xbt_test_add1
118       ("==== Push %d int, insert 1000 int in the middle, shift everything",
119        NB_ELEM);
120   d = xbt_dynar_new(sizeof(int), NULL);
121   for (cpt = 0; cpt < NB_ELEM; cpt++) {
122     xbt_dynar_push_as(d, int, cpt);
123     DEBUG2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
124   }
125   for (cpt = 0; cpt < NB_ELEM/5; cpt++) {
126     xbt_dynar_insert_at_as(d, NB_ELEM/2, int, cpt);
127     DEBUG2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
128   }
129
130   for (cpt = 0; cpt < NB_ELEM/2; cpt++) {
131     xbt_dynar_shift(d, &i);
132     xbt_test_assert2(i == cpt,
133                      "The retrieved value is not the same than the injected one at the begining (%d!=%d)",
134                      i, cpt);
135     DEBUG2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
136   }
137   for (cpt = 999; cpt >= 0; cpt--) {
138     xbt_dynar_shift(d, &i);
139     xbt_test_assert2(i == cpt,
140                      "The retrieved value is not the same than the injected one in the middle (%d!=%d)",
141                      i, cpt);
142   }
143   for (cpt = 2500; cpt < NB_ELEM; cpt++) {
144     xbt_dynar_shift(d, &i);
145     xbt_test_assert2(i == cpt,
146                      "The retrieved value is not the same than the injected one at the end (%d!=%d)",
147                      i, cpt);
148   }
149   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
150   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
151   /* in your code is naturally the way to go outside a regression test */
152
153   xbt_test_add1("==== Push %d int, remove 2000-4000. free the rest",
154                 NB_ELEM);
155   d = xbt_dynar_new(sizeof(int), NULL);
156   for (cpt = 0; cpt < NB_ELEM; cpt++)
157     xbt_dynar_push_as(d, int, cpt);
158
159   for (cpt = 2000; cpt < 4000; cpt++) {
160     xbt_dynar_remove_at(d, 2000, &i);
161     xbt_test_assert2(i == cpt,
162                      "Remove a bad value. Got %d, expected %d", i, cpt);
163     DEBUG2("remove %d, length=%lu", cpt, xbt_dynar_length(d));
164   }
165   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
166   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
167   /* in your code is naturally the way to go outside a regression test */
168 }
169
170 /*******************************************************************************/
171 /*******************************************************************************/
172 /*******************************************************************************/
173 XBT_TEST_UNIT("insert",test_dynar_insert,"Using the xbt_dynar_insert and xbt_dynar_remove functions")
174 {
175   xbt_dynar_t d = xbt_dynar_new(sizeof(int), NULL);
176   unsigned int cursor;
177   int cpt;
178
179   xbt_test_add1("==== Insert %d int, traverse them, remove them",NB_ELEM);
180   /* Populate_ints [doxygen cruft] */
181   /* 1. Populate the dynar */
182   for (cpt = 0; cpt < NB_ELEM; cpt++) {
183     xbt_dynar_insert_at(d, cpt, &cpt);
184     xbt_test_log2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
185   }
186
187   /* 3. Traverse the dynar */
188   xbt_dynar_foreach(d, cursor, cpt) {
189     xbt_test_assert2(cursor == cpt,
190                      "The retrieved value is not the same than the injected one (%d!=%d)",
191                      cursor, cpt);
192   }
193   /* end_of_traversal */
194
195   /* Re-fill with the same values using set_as (and re-verify) */
196   for (cpt = 0; cpt < NB_ELEM; cpt++)
197     xbt_dynar_set_as(d, cpt, int, cpt);
198   xbt_dynar_foreach(d, cursor, cpt)
199     xbt_test_assert2(cursor == cpt,
200                      "The retrieved value is not the same than the injected one (%d!=%d)",
201                      cursor, cpt);
202
203   for (cpt = 0; cpt < NB_ELEM; cpt++) {
204     int val;
205     xbt_dynar_remove_at(d,0,&val);
206     xbt_test_assert2(cpt == val,
207                      "The retrieved value is not the same than the injected one (%d!=%d)",
208                      cursor, cpt);
209   }
210   xbt_test_assert1(xbt_dynar_length(d) == 0,
211                    "There is still %lu elements in the dynar after removing everything",
212                    xbt_dynar_length(d));
213   xbt_dynar_free(&d);
214
215   /* ********************* */
216   xbt_test_add1("==== Insert %d int in reverse order, traverse them, remove them",NB_ELEM);
217   d = xbt_dynar_new(sizeof(int), NULL);
218   for (cpt = NB_ELEM-1; cpt >=0; cpt--) {
219     xbt_dynar_replace(d, cpt, &cpt);
220     xbt_test_log2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
221   }
222
223   /* 3. Traverse the dynar */
224   xbt_dynar_foreach(d, cursor, cpt) {
225     xbt_test_assert2(cursor == cpt,
226                      "The retrieved value is not the same than the injected one (%d!=%d)",
227                      cursor, cpt);
228   }
229   /* end_of_traversal */
230
231   for (cpt =NB_ELEM-1; cpt >=0; cpt--) {
232     int val;
233     xbt_dynar_remove_at(d,xbt_dynar_length(d)-1,&val);
234     xbt_test_assert2(cpt == val,
235                      "The retrieved value is not the same than the injected one (%d!=%d)",
236                      cursor, cpt);
237   }
238   xbt_test_assert1(xbt_dynar_length(d) == 0,
239                    "There is still %lu elements in the dynar after removing everything",
240                    xbt_dynar_length(d));
241   xbt_dynar_free(&d);
242 }
243
244 /*******************************************************************************/
245 /*******************************************************************************/
246 /*******************************************************************************/
247 XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
248 {
249   xbt_dynar_t d;
250   int cpt;
251   unsigned int cursor;
252   double d1, d2;
253
254   xbt_test_add0("==== Traverse the empty dynar");
255   d = xbt_dynar_new(sizeof(int), NULL);
256   xbt_dynar_foreach(d, cursor, cpt) {
257     xbt_test_assert0(FALSE,
258                      "Damnit, there is something in the empty dynar");
259   }
260   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
261   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
262   /* in your code is naturally the way to go outside a regression test */
263
264   xbt_test_add0("==== Push/shift 5000 doubles");
265   d = xbt_dynar_new(sizeof(double), NULL);
266   for (cpt = 0; cpt < 5000; cpt++) {
267     d1 = (double) cpt;
268     xbt_dynar_push(d, &d1);
269   }
270   xbt_dynar_foreach(d, cursor, d2) {
271     d1 = (double) cursor;
272     xbt_test_assert2(d1 == d2,
273                      "The retrieved value is not the same than the injected one (%f!=%f)",
274                      d1, d2);
275   }
276   for (cpt = 0; cpt < 5000; cpt++) {
277     d1 = (double) cpt;
278     xbt_dynar_shift(d, &d2);
279     xbt_test_assert2(d1 == d2,
280                      "The retrieved value is not the same than the injected one (%f!=%f)",
281                      d1, d2);
282   }
283   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
284   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
285   /* in your code is naturally the way to go outside a regression test */
286
287   xbt_test_add0("==== Unshift/pop 5000 doubles");
288   d = xbt_dynar_new(sizeof(double), NULL);
289   for (cpt = 0; cpt < 5000; cpt++) {
290     d1 = (double) cpt;
291     xbt_dynar_unshift(d, &d1);
292   }
293   for (cpt = 0; cpt < 5000; cpt++) {
294     d1 = (double) cpt;
295     xbt_dynar_pop(d, &d2);
296     xbt_test_assert2(d1 == d2,
297                      "The retrieved value is not the same than the injected one (%f!=%f)",
298                      d1, d2);
299   }
300   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
301   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
302   /* in your code is naturally the way to go outside a regression test */
303
304
305
306   xbt_test_add0
307       ("==== Push 5000 doubles, insert 1000 doubles in the middle, shift everything");
308   d = xbt_dynar_new(sizeof(double), NULL);
309   for (cpt = 0; cpt < 5000; cpt++) {
310     d1 = (double) cpt;
311     xbt_dynar_push(d, &d1);
312   }
313   for (cpt = 0; cpt < 1000; cpt++) {
314     d1 = (double) cpt;
315     xbt_dynar_insert_at(d, 2500, &d1);
316   }
317
318   for (cpt = 0; cpt < 2500; cpt++) {
319     d1 = (double) cpt;
320     xbt_dynar_shift(d, &d2);
321     xbt_test_assert2(d1 == d2,
322                      "The retrieved value is not the same than the injected one at the begining (%f!=%f)",
323                      d1, d2);
324     DEBUG2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
325   }
326   for (cpt = 999; cpt >= 0; cpt--) {
327     d1 = (double) cpt;
328     xbt_dynar_shift(d, &d2);
329     xbt_test_assert2(d1 == d2,
330                      "The retrieved value is not the same than the injected one in the middle (%f!=%f)",
331                      d1, d2);
332   }
333   for (cpt = 2500; cpt < 5000; cpt++) {
334     d1 = (double) cpt;
335     xbt_dynar_shift(d, &d2);
336     xbt_test_assert2(d1 == d2,
337                      "The retrieved value is not the same than the injected one at the end (%f!=%f)",
338                      d1, d2);
339   }
340   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
341   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
342   /* in your code is naturally the way to go outside a regression test */
343
344
345   xbt_test_add0("==== Push 5000 double, remove 2000-4000. free the rest");
346   d = xbt_dynar_new(sizeof(double), NULL);
347   for (cpt = 0; cpt < 5000; cpt++) {
348     d1 = (double) cpt;
349     xbt_dynar_push(d, &d1);
350   }
351   for (cpt = 2000; cpt < 4000; cpt++) {
352     d1 = (double) cpt;
353     xbt_dynar_remove_at(d, 2000, &d2);
354     xbt_test_assert2(d1 == d2,
355                      "Remove a bad value. Got %f, expected %f", d2, d1);
356   }
357   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
358   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
359   /* in your code is naturally the way to go outside a regression test */
360 }
361
362
363 /* doxygen_string_cruft */
364
365 /*******************************************************************************/
366 /*******************************************************************************/
367 /*******************************************************************************/
368 XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
369 {
370   xbt_dynar_t d;
371   int cpt;
372   unsigned int iter;
373   char buf[1024];
374   char *s1, *s2;
375
376   xbt_test_add0("==== Traverse the empty dynar");
377   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
378   xbt_dynar_foreach(d, iter, s1) {
379     xbt_test_assert0(FALSE,
380                      "Damnit, there is something in the empty dynar");
381   }
382   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
383   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
384   /* in your code is naturally the way to go outside a regression test */
385
386   xbt_test_add1("==== Push %d strings, set them again 3 times, shift them",
387                 NB_ELEM);
388   /* Populate_str [doxygen cruft] */
389   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
390   /* 1. Populate the dynar */
391   for (cpt = 0; cpt < NB_ELEM; cpt++) {
392     sprintf(buf, "%d", cpt);
393     s1 = strdup(buf);
394     xbt_dynar_push(d, &s1);
395   }
396   for (cpt = 0; cpt < NB_ELEM; cpt++) {
397     sprintf(buf, "%d", cpt);
398     s1 = strdup(buf);
399     xbt_dynar_replace(d, cpt, &s1);
400   }
401   for (cpt = 0; cpt < NB_ELEM; cpt++) {
402     sprintf(buf, "%d", cpt);
403     s1 = strdup(buf);
404     xbt_dynar_replace(d, cpt, &s1);
405   }
406   for (cpt = 0; cpt < NB_ELEM; cpt++) {
407     sprintf(buf, "%d", cpt);
408     s1 = strdup(buf);
409     xbt_dynar_replace(d, cpt, &s1);
410   }
411   for (cpt = 0; cpt < NB_ELEM; cpt++) {
412     sprintf(buf, "%d", cpt);
413     xbt_dynar_shift(d, &s2);
414     xbt_test_assert2(!strcmp(buf, s2),
415                      "The retrieved value is not the same than the injected one (%s!=%s)",
416                      buf, s2);
417     free(s2);
418   }
419   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
420   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
421   /* in your code is naturally the way to go outside a regression test */
422
423   xbt_test_add1("==== Unshift, traverse and pop %d strings", NB_ELEM);
424   d = xbt_dynar_new(sizeof(char **), &xbt_free_ref);
425   for (cpt = 0; cpt < NB_ELEM; cpt++) {
426     sprintf(buf, "%d", cpt);
427     s1 = strdup(buf);
428     xbt_dynar_unshift(d, &s1);
429   }
430   /* 2. Traverse the dynar with the macro */
431   xbt_dynar_foreach(d, iter, s1) {
432     sprintf(buf, "%d", NB_ELEM - iter - 1);
433     xbt_test_assert2(!strcmp(buf, s1),
434                      "The retrieved value is not the same than the injected one (%s!=%s)",
435                      buf, s1);
436   }
437   /* 3. Traverse the dynar with the macro */
438   for (cpt = 0; cpt < NB_ELEM; cpt++) {
439     sprintf(buf, "%d", cpt);
440     xbt_dynar_pop(d, &s2);
441     xbt_test_assert2(!strcmp(buf, s2),
442                      "The retrieved value is not the same than the injected one (%s!=%s)",
443                      buf, s2);
444     free(s2);
445   }
446   /* 4. Free the resources */
447   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
448   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
449   /* in your code is naturally the way to go outside a regression test */
450
451
452   xbt_test_add2
453       ("==== Push %d strings, insert %d strings in the middle, shift everything",
454        NB_ELEM, NB_ELEM / 5);
455   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
456   for (cpt = 0; cpt < NB_ELEM; cpt++) {
457     sprintf(buf, "%d", cpt);
458     s1 = strdup(buf);
459     xbt_dynar_push(d, &s1);
460   }
461   for (cpt = 0; cpt < NB_ELEM / 5; cpt++) {
462     sprintf(buf, "%d", cpt);
463     s1 = strdup(buf);
464     xbt_dynar_insert_at(d, NB_ELEM / 2, &s1);
465   }
466
467   for (cpt = 0; cpt < NB_ELEM / 2; cpt++) {
468     sprintf(buf, "%d", cpt);
469     xbt_dynar_shift(d, &s2);
470     xbt_test_assert2(!strcmp(buf, s2),
471                      "The retrieved value is not the same than the injected one at the begining (%s!=%s)",
472                      buf, s2);
473     free(s2);
474   }
475   for (cpt = (NB_ELEM / 5) - 1; cpt >= 0; cpt--) {
476     sprintf(buf, "%d", cpt);
477     xbt_dynar_shift(d, &s2);
478     xbt_test_assert2(!strcmp(buf, s2),
479                      "The retrieved value is not the same than the injected one in the middle (%s!=%s)",
480                      buf, s2);
481     free(s2);
482   }
483   for (cpt = NB_ELEM / 2; cpt < NB_ELEM; cpt++) {
484     sprintf(buf, "%d", cpt);
485     xbt_dynar_shift(d, &s2);
486     xbt_test_assert2(!strcmp(buf, s2),
487                      "The retrieved value is not the same than the injected one at the end (%s!=%s)",
488                      buf, s2);
489     free(s2);
490   }
491   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
492   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
493   /* in your code is naturally the way to go outside a regression test */
494
495
496   xbt_test_add3("==== Push %d strings, remove %d-%d. free the rest",
497                 NB_ELEM, 2 * (NB_ELEM / 5), 4 * (NB_ELEM / 5));
498   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
499   for (cpt = 0; cpt < NB_ELEM; cpt++) {
500     sprintf(buf, "%d", cpt);
501     s1 = strdup(buf);
502     xbt_dynar_push(d, &s1);
503   }
504   for (cpt = 2 * (NB_ELEM / 5); cpt < 4 * (NB_ELEM / 5); cpt++) {
505     sprintf(buf, "%d", cpt);
506     xbt_dynar_remove_at(d, 2 * (NB_ELEM / 5), &s2);
507     xbt_test_assert2(!strcmp(buf, s2),
508                      "Remove a bad value. Got %s, expected %s", s2, buf);
509     free(s2);
510   }
511   xbt_dynar_free(&d);           /* end_of_doxygen */
512 }
513
514
515 /*******************************************************************************/
516 /*******************************************************************************/
517 /*******************************************************************************/
518 #include "xbt/synchro.h"
519 static void pusher_f(void *a)
520 {
521   xbt_dynar_t d = (xbt_dynar_t) a;
522   int i;
523   for (i = 0; i < 500; i++) {
524     xbt_dynar_push(d, &i);
525   }
526 }
527
528 static void poper_f(void *a)
529 {
530   xbt_dynar_t d = (xbt_dynar_t) a;
531   int i;
532   int data;
533   xbt_ex_t e;
534
535   for (i = 0; i < 500; i++) {
536     TRY {
537       xbt_dynar_pop(d, &data);
538     }
539     CATCH(e) {
540       if (e.category == bound_error) {
541         xbt_ex_free(e);
542         i--;
543       } else {
544         RETHROW;
545       }
546     }
547   }
548 }
549
550
551 XBT_TEST_UNIT("synchronized int", test_dynar_sync_int, "Synchronized dynars of integers")
552 {
553   /* Vars_decl [doxygen cruft] */
554   xbt_dynar_t d;
555   xbt_thread_t pusher, poper;
556
557   xbt_test_add0("==== Have a pusher and a popper on the dynar");
558   d = xbt_dynar_new_sync(sizeof(int), NULL);
559   pusher = xbt_thread_create("pusher", pusher_f, d, 0 /*not joinable */ );
560   poper = xbt_thread_create("poper", poper_f, d, 0 /*not joinable */ );
561   xbt_thread_join(pusher);
562   xbt_thread_join(poper);
563   xbt_dynar_free(&d);
564 }
565
566 /*******************************/
567 /* GENERATED FILE, DO NOT EDIT */
568 /*******************************/
569