A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use iterators; try to traverse the empty dynar, just to see ;)
[simgrid.git]
/
testsuite
/
xbt
/
dynar_double.c
diff --git
a/testsuite/xbt/dynar_double.c
b/testsuite/xbt/dynar_double.c
index
9449e7d
..
22590df
100644
(file)
--- a/
testsuite/xbt/dynar_double.c
+++ b/
testsuite/xbt/dynar_double.c
@@
-14,15
+14,33
@@
int main(int argc,char *argv[]) {
gras_dynar_t *d;
gras_error_t errcode;
int main(int argc,char *argv[]) {
gras_dynar_t *d;
gras_error_t errcode;
- int cpt;
+ int cpt
,cursor
;
double d1,d2;
double d1,d2;
+ fprintf(stderr,"==== Traverse the empty dynar\n");
+ TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
+ gras_dynar_foreach(d,cursor,cpt){
+ fprintf(stderr,
+ "Damnit, there is something in the empty dynar\n");
+ abort();
+ }
+ gras_dynar_free(d);
+
fprintf(stderr,"==== Push/shift 5000 doubles\n");
TRYFAIL(gras_dynar_new(&d,sizeof(double),NULL));
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
TRYFAIL(gras_dynar_push(d,&d1));
}
fprintf(stderr,"==== Push/shift 5000 doubles\n");
TRYFAIL(gras_dynar_new(&d,sizeof(double),NULL));
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
TRYFAIL(gras_dynar_push(d,&d1));
}
+ gras_dynar_foreach(d,cursor,d2){
+ d1=(double)cursor;
+ if (d1 != d2) {
+ fprintf(stderr,
+ "The retrieved value is not the same than the injected one (%f!=%f)\n",
+ d1,d2);
+ abort();
+ }
+ }
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
gras_dynar_shift(d,&d2);
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
gras_dynar_shift(d,&d2);