Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a test enforcing that the route redefinition (when symmetrical=yes) is correctly...
[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 753 "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   int cursor,cpt;
177
178   xbt_test_add1("==== Insert %d int, traverse them, remove them",NB_ELEM);
179   /* Populate_ints [doxygen cruft] */
180   /* 1. Populate the dynar */
181   for (cpt = 0; cpt < NB_ELEM; cpt++) {
182     xbt_dynar_insert_at(d, cpt, &cpt);
183     xbt_test_log2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
184   }
185
186   /* 3. Traverse the dynar */
187   xbt_dynar_foreach(d, cursor, cpt) {
188     xbt_test_assert2(cursor == cpt,
189                      "The retrieved value is not the same than the injected one (%d!=%d)",
190                      cursor, cpt);
191   }
192   /* end_of_traversal */
193
194   /* Re-fill with the same values using set_as (and re-verify) */
195   for (cpt = 0; cpt < NB_ELEM; cpt++)
196     xbt_dynar_set_as(d, cpt, int, cpt);
197   xbt_dynar_foreach(d, cursor, cpt)
198     xbt_test_assert2(cursor == cpt,
199                      "The retrieved value is not the same than the injected one (%d!=%d)",
200                      cursor, cpt);
201
202   for (cpt = 0; cpt < NB_ELEM; cpt++) {
203     int val;
204     xbt_dynar_remove_at(d,0,&val);
205     xbt_test_assert2(cpt == val,
206                      "The retrieved value is not the same than the injected one (%d!=%d)",
207                      cursor, cpt);
208   }
209   xbt_test_assert1(xbt_dynar_length(d) == 0,
210                    "There is still %d elements in the dynar after removing everything",
211                    xbt_dynar_length(d));
212   xbt_dynar_free(&d);
213
214   /* ********************* */
215   xbt_test_add1("==== Insert %d int in reverse order, traverse them, remove them",NB_ELEM);
216   d = xbt_dynar_new(sizeof(int), NULL);
217   for (cpt = NB_ELEM-1; cpt >=0; cpt--) {
218     xbt_dynar_replace(d, cpt, &cpt);
219     xbt_test_log2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
220   }
221
222   /* 3. Traverse the dynar */
223   xbt_dynar_foreach(d, cursor, cpt) {
224     xbt_test_assert2(cursor == cpt,
225                      "The retrieved value is not the same than the injected one (%d!=%d)",
226                      cursor, cpt);
227   }
228   /* end_of_traversal */
229
230   for (cpt =NB_ELEM-1; cpt >=0; cpt--) {
231     int val;
232     xbt_dynar_remove_at(d,xbt_dynar_length(d)-1,&val);
233     xbt_test_assert2(cpt == val,
234                      "The retrieved value is not the same than the injected one (%d!=%d)",
235                      cursor, cpt);
236   }
237   xbt_test_assert1(xbt_dynar_length(d) == 0,
238                    "There is still %d elements in the dynar after removing everything",
239                    xbt_dynar_length(d));
240   xbt_dynar_free(&d);
241 }
242
243 /*******************************************************************************/
244 /*******************************************************************************/
245 /*******************************************************************************/
246 XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
247 {
248   xbt_dynar_t d;
249   int cpt;
250   unsigned int cursor;
251   double d1, d2;
252
253   xbt_test_add0("==== Traverse the empty dynar");
254   d = xbt_dynar_new(sizeof(int), NULL);
255   xbt_dynar_foreach(d, cursor, cpt) {
256     xbt_test_assert0(FALSE,
257                      "Damnit, there is something in the empty dynar");
258   }
259   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
260   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
261   /* in your code is naturally the way to go outside a regression test */
262
263   xbt_test_add0("==== Push/shift 5000 doubles");
264   d = xbt_dynar_new(sizeof(double), NULL);
265   for (cpt = 0; cpt < 5000; cpt++) {
266     d1 = (double) cpt;
267     xbt_dynar_push(d, &d1);
268   }
269   xbt_dynar_foreach(d, cursor, d2) {
270     d1 = (double) cursor;
271     xbt_test_assert2(d1 == d2,
272                      "The retrieved value is not the same than the injected one (%f!=%f)",
273                      d1, d2);
274   }
275   for (cpt = 0; cpt < 5000; cpt++) {
276     d1 = (double) cpt;
277     xbt_dynar_shift(d, &d2);
278     xbt_test_assert2(d1 == d2,
279                      "The retrieved value is not the same than the injected one (%f!=%f)",
280                      d1, d2);
281   }
282   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
283   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
284   /* in your code is naturally the way to go outside a regression test */
285
286   xbt_test_add0("==== Unshift/pop 5000 doubles");
287   d = xbt_dynar_new(sizeof(double), NULL);
288   for (cpt = 0; cpt < 5000; cpt++) {
289     d1 = (double) cpt;
290     xbt_dynar_unshift(d, &d1);
291   }
292   for (cpt = 0; cpt < 5000; cpt++) {
293     d1 = (double) cpt;
294     xbt_dynar_pop(d, &d2);
295     xbt_test_assert2(d1 == d2,
296                      "The retrieved value is not the same than the injected one (%f!=%f)",
297                      d1, d2);
298   }
299   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
300   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
301   /* in your code is naturally the way to go outside a regression test */
302
303
304
305   xbt_test_add0
306       ("==== Push 5000 doubles, insert 1000 doubles in the middle, shift everything");
307   d = xbt_dynar_new(sizeof(double), NULL);
308   for (cpt = 0; cpt < 5000; cpt++) {
309     d1 = (double) cpt;
310     xbt_dynar_push(d, &d1);
311   }
312   for (cpt = 0; cpt < 1000; cpt++) {
313     d1 = (double) cpt;
314     xbt_dynar_insert_at(d, 2500, &d1);
315   }
316
317   for (cpt = 0; cpt < 2500; cpt++) {
318     d1 = (double) cpt;
319     xbt_dynar_shift(d, &d2);
320     xbt_test_assert2(d1 == d2,
321                      "The retrieved value is not the same than the injected one at the begining (%f!=%f)",
322                      d1, d2);
323     DEBUG2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
324   }
325   for (cpt = 999; cpt >= 0; cpt--) {
326     d1 = (double) cpt;
327     xbt_dynar_shift(d, &d2);
328     xbt_test_assert2(d1 == d2,
329                      "The retrieved value is not the same than the injected one in the middle (%f!=%f)",
330                      d1, d2);
331   }
332   for (cpt = 2500; cpt < 5000; cpt++) {
333     d1 = (double) cpt;
334     xbt_dynar_shift(d, &d2);
335     xbt_test_assert2(d1 == d2,
336                      "The retrieved value is not the same than the injected one at the end (%f!=%f)",
337                      d1, d2);
338   }
339   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
340   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
341   /* in your code is naturally the way to go outside a regression test */
342
343
344   xbt_test_add0("==== Push 5000 double, remove 2000-4000. free the rest");
345   d = xbt_dynar_new(sizeof(double), NULL);
346   for (cpt = 0; cpt < 5000; cpt++) {
347     d1 = (double) cpt;
348     xbt_dynar_push(d, &d1);
349   }
350   for (cpt = 2000; cpt < 4000; cpt++) {
351     d1 = (double) cpt;
352     xbt_dynar_remove_at(d, 2000, &d2);
353     xbt_test_assert2(d1 == d2,
354                      "Remove a bad value. Got %f, expected %f", d2, d1);
355   }
356   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
357   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
358   /* in your code is naturally the way to go outside a regression test */
359 }
360
361
362 /* doxygen_string_cruft */
363
364 /*******************************************************************************/
365 /*******************************************************************************/
366 /*******************************************************************************/
367 XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
368 {
369   xbt_dynar_t d;
370   int cpt;
371   unsigned int iter;
372   char buf[1024];
373   char *s1, *s2;
374
375   xbt_test_add0("==== Traverse the empty dynar");
376   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
377   xbt_dynar_foreach(d, iter, s1) {
378     xbt_test_assert0(FALSE,
379                      "Damnit, there is something in the empty dynar");
380   }
381   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
382   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
383   /* in your code is naturally the way to go outside a regression test */
384
385   xbt_test_add1("==== Push %d strings, set them again 3 times, shift them",
386                 NB_ELEM);
387   /* Populate_str [doxygen cruft] */
388   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
389   /* 1. Populate the dynar */
390   for (cpt = 0; cpt < NB_ELEM; cpt++) {
391     sprintf(buf, "%d", cpt);
392     s1 = strdup(buf);
393     xbt_dynar_push(d, &s1);
394   }
395   for (cpt = 0; cpt < NB_ELEM; cpt++) {
396     sprintf(buf, "%d", cpt);
397     s1 = strdup(buf);
398     xbt_dynar_replace(d, cpt, &s1);
399   }
400   for (cpt = 0; cpt < NB_ELEM; cpt++) {
401     sprintf(buf, "%d", cpt);
402     s1 = strdup(buf);
403     xbt_dynar_replace(d, cpt, &s1);
404   }
405   for (cpt = 0; cpt < NB_ELEM; cpt++) {
406     sprintf(buf, "%d", cpt);
407     s1 = strdup(buf);
408     xbt_dynar_replace(d, cpt, &s1);
409   }
410   for (cpt = 0; cpt < NB_ELEM; cpt++) {
411     sprintf(buf, "%d", cpt);
412     xbt_dynar_shift(d, &s2);
413     xbt_test_assert2(!strcmp(buf, s2),
414                      "The retrieved value is not the same than the injected one (%s!=%s)",
415                      buf, s2);
416     free(s2);
417   }
418   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
419   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
420   /* in your code is naturally the way to go outside a regression test */
421
422   xbt_test_add1("==== Unshift, traverse and pop %d strings", NB_ELEM);
423   d = xbt_dynar_new(sizeof(char **), &xbt_free_ref);
424   for (cpt = 0; cpt < NB_ELEM; cpt++) {
425     sprintf(buf, "%d", cpt);
426     s1 = strdup(buf);
427     xbt_dynar_unshift(d, &s1);
428   }
429   /* 2. Traverse the dynar with the macro */
430   xbt_dynar_foreach(d, iter, s1) {
431     sprintf(buf, "%d", NB_ELEM - iter - 1);
432     xbt_test_assert2(!strcmp(buf, s1),
433                      "The retrieved value is not the same than the injected one (%s!=%s)",
434                      buf, s1);
435   }
436   /* 3. Traverse the dynar with the macro */
437   for (cpt = 0; cpt < NB_ELEM; cpt++) {
438     sprintf(buf, "%d", cpt);
439     xbt_dynar_pop(d, &s2);
440     xbt_test_assert2(!strcmp(buf, s2),
441                      "The retrieved value is not the same than the injected one (%s!=%s)",
442                      buf, s2);
443     free(s2);
444   }
445   /* 4. Free the resources */
446   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
447   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
448   /* in your code is naturally the way to go outside a regression test */
449
450
451   xbt_test_add2
452       ("==== Push %d strings, insert %d strings in the middle, shift everything",
453        NB_ELEM, NB_ELEM / 5);
454   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
455   for (cpt = 0; cpt < NB_ELEM; cpt++) {
456     sprintf(buf, "%d", cpt);
457     s1 = strdup(buf);
458     xbt_dynar_push(d, &s1);
459   }
460   for (cpt = 0; cpt < NB_ELEM / 5; cpt++) {
461     sprintf(buf, "%d", cpt);
462     s1 = strdup(buf);
463     xbt_dynar_insert_at(d, NB_ELEM / 2, &s1);
464   }
465
466   for (cpt = 0; cpt < NB_ELEM / 2; cpt++) {
467     sprintf(buf, "%d", cpt);
468     xbt_dynar_shift(d, &s2);
469     xbt_test_assert2(!strcmp(buf, s2),
470                      "The retrieved value is not the same than the injected one at the begining (%s!=%s)",
471                      buf, s2);
472     free(s2);
473   }
474   for (cpt = (NB_ELEM / 5) - 1; cpt >= 0; cpt--) {
475     sprintf(buf, "%d", cpt);
476     xbt_dynar_shift(d, &s2);
477     xbt_test_assert2(!strcmp(buf, s2),
478                      "The retrieved value is not the same than the injected one in the middle (%s!=%s)",
479                      buf, s2);
480     free(s2);
481   }
482   for (cpt = NB_ELEM / 2; cpt < NB_ELEM; cpt++) {
483     sprintf(buf, "%d", cpt);
484     xbt_dynar_shift(d, &s2);
485     xbt_test_assert2(!strcmp(buf, s2),
486                      "The retrieved value is not the same than the injected one at the end (%s!=%s)",
487                      buf, s2);
488     free(s2);
489   }
490   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
491   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
492   /* in your code is naturally the way to go outside a regression test */
493
494
495   xbt_test_add3("==== Push %d strings, remove %d-%d. free the rest",
496                 NB_ELEM, 2 * (NB_ELEM / 5), 4 * (NB_ELEM / 5));
497   d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
498   for (cpt = 0; cpt < NB_ELEM; cpt++) {
499     sprintf(buf, "%d", cpt);
500     s1 = strdup(buf);
501     xbt_dynar_push(d, &s1);
502   }
503   for (cpt = 2 * (NB_ELEM / 5); cpt < 4 * (NB_ELEM / 5); cpt++) {
504     sprintf(buf, "%d", cpt);
505     xbt_dynar_remove_at(d, 2 * (NB_ELEM / 5), &s2);
506     xbt_test_assert2(!strcmp(buf, s2),
507                      "Remove a bad value. Got %s, expected %s", s2, buf);
508     free(s2);
509   }
510   xbt_dynar_free(&d);           /* end_of_doxygen */
511 }
512
513
514 /*******************************************************************************/
515 /*******************************************************************************/
516 /*******************************************************************************/
517 #include "xbt/synchro.h"
518 static void pusher_f(void *a)
519 {
520   xbt_dynar_t d = (xbt_dynar_t) a;
521   int i;
522   for (i = 0; i < 500; i++) {
523     xbt_dynar_push(d, &i);
524   }
525 }
526
527 static void poper_f(void *a)
528 {
529   xbt_dynar_t d = (xbt_dynar_t) a;
530   int i;
531   int data;
532   xbt_ex_t e;
533
534   for (i = 0; i < 500; i++) {
535     TRY {
536       xbt_dynar_pop(d, &data);
537     }
538     CATCH(e) {
539       if (e.category == bound_error) {
540         xbt_ex_free(e);
541         i--;
542       } else {
543         RETHROW;
544       }
545     }
546   }
547 }
548
549
550 XBT_TEST_UNIT("synchronized int", test_dynar_sync_int, "Synchronized dynars of integers")
551 {
552   /* Vars_decl [doxygen cruft] */
553   xbt_dynar_t d;
554   xbt_thread_t pusher, poper;
555
556   xbt_test_add0("==== Have a pusher and a popper on the dynar");
557   d = xbt_dynar_new_sync(sizeof(int), NULL);
558   pusher = xbt_thread_create("pusher", pusher_f, d, 0 /*not joinable */ );
559   poper = xbt_thread_create("poper", poper_f, d, 0 /*not joinable */ );
560   xbt_thread_join(pusher);
561   xbt_thread_join(poper);
562   xbt_dynar_free(&d);
563 }
564
565 /*******************************/
566 /* GENERATED FILE, DO NOT EDIT */
567 /*******************************/
568