Logo AND Algorithmique Numérique Distribuée

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