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 gras_exit now that it exists and not xbt_exit
[simgrid.git]
/
testsuite
/
xbt
/
dynar_double.c
diff --git
a/testsuite/xbt/dynar_double.c
b/testsuite/xbt/dynar_double.c
index
09c295d
..
bfd0641
100644
(file)
--- a/
testsuite/xbt/dynar_double.c
+++ b/
testsuite/xbt/dynar_double.c
@@
-2,123
+2,126
@@
/* dynar_double: A test case for the dynar using doubles as content */
/* dynar_double: A test case for the dynar using doubles as content */
-/* Authors: Martin Quinson */
-/* Copyright (C) 2003 the OURAGAN project. */
+/* Copyright (c) 2003,2004 Martin Quinson. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
/* This program is free software; you can redistribute it and/or modify it
-
under the terms of the license (GNU LGPL) which comes with this package. */
+
*
under the terms of the license (GNU LGPL) which comes with this package. */
-#include <stdio.h>
-#include <gras.h>
+#include "gras.h"
-
GRAS
_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
+
XBT
_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
int main(int argc,char *argv[]) {
int main(int argc,char *argv[]) {
-
gras_dynar_t *
d;
-
gras
_error_t errcode;
+
xbt_dynar_t
d;
+
xbt
_error_t errcode;
int cpt,cursor;
double d1,d2;
int cpt,cursor;
double d1,d2;
-
gras
_init_defaultlog(&argc,argv,"dynar.thresh=debug");
+
xbt
_init_defaultlog(&argc,argv,"dynar.thresh=debug");
INFO0("==== Traverse the empty dynar");
INFO0("==== Traverse the empty dynar");
- d=
gras
_dynar_new(sizeof(int),NULL);
-
gras
_dynar_foreach(d,cursor,cpt){
-
gras
_assert0(FALSE,
+ d=
xbt
_dynar_new(sizeof(int),NULL);
+
xbt
_dynar_foreach(d,cursor,cpt){
+
xbt
_assert0(FALSE,
"Damnit, there is something in the empty dynar");
}
"Damnit, there is something in the empty dynar");
}
- gras_dynar_free(d);
+ xbt_dynar_free(&d);
+ xbt_dynar_free(&d);
INFO0("==== Push/shift 5000 doubles");
INFO0("==== Push/shift 5000 doubles");
- d=
gras
_dynar_new(sizeof(double),NULL);
+ d=
xbt
_dynar_new(sizeof(double),NULL);
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
-
gras
_dynar_push(d,&d1);
+
xbt
_dynar_push(d,&d1);
}
}
-
gras
_dynar_foreach(d,cursor,d2){
+
xbt
_dynar_foreach(d,cursor,d2){
d1=(double)cursor;
d1=(double)cursor;
-
gras
_assert2(d1 == d2,
+
xbt
_assert2(d1 == d2,
"The retrieved value is not the same than the injected one (%f!=%f)",
d1,d2);
}
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
"The retrieved value is not the same than the injected one (%f!=%f)",
d1,d2);
}
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
-
gras
_dynar_shift(d,&d2);
-
gras
_assert2(d1 == d2,
+
xbt
_dynar_shift(d,&d2);
+
xbt
_assert2(d1 == d2,
"The retrieved value is not the same than the injected one (%f!=%f)",
d1,d2);
}
"The retrieved value is not the same than the injected one (%f!=%f)",
d1,d2);
}
- gras_dynar_free(d);
+ xbt_dynar_free(&d);
+ xbt_dynar_free(&d);
INFO0("==== Unshift/pop 5000 doubles");
INFO0("==== Unshift/pop 5000 doubles");
- d=
gras
_dynar_new(sizeof(double),NULL);
+ d=
xbt
_dynar_new(sizeof(double),NULL);
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
-
gras
_dynar_unshift(d,&d1);
+
xbt
_dynar_unshift(d,&d1);
}
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
}
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
-
gras
_dynar_pop(d,&d2);
-
gras
_assert2 (d1 == d2,
+
xbt
_dynar_pop(d,&d2);
+
xbt
_assert2 (d1 == d2,
"The retrieved value is not the same than the injected one (%f!=%f)",
d1,d2);
}
"The retrieved value is not the same than the injected one (%f!=%f)",
d1,d2);
}
- gras_dynar_free(d);
+ xbt_dynar_free(&d);
+ xbt_dynar_free(&d);
INFO0("==== Push 5000 doubles, insert 1000 doubles in the middle, shift everything");
INFO0("==== Push 5000 doubles, insert 1000 doubles in the middle, shift everything");
- d=
gras
_dynar_new(sizeof(double),NULL);
+ d=
xbt
_dynar_new(sizeof(double),NULL);
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
-
gras
_dynar_push(d,&d1);
+
xbt
_dynar_push(d,&d1);
}
for (cpt=0; cpt< 1000; cpt++) {
d1=(double)cpt;
}
for (cpt=0; cpt< 1000; cpt++) {
d1=(double)cpt;
-
gras
_dynar_insert_at(d,2500,&d1);
+
xbt
_dynar_insert_at(d,2500,&d1);
}
for (cpt=0; cpt< 2500; cpt++) {
d1=(double)cpt;
}
for (cpt=0; cpt< 2500; cpt++) {
d1=(double)cpt;
-
gras
_dynar_shift(d,&d2);
-
gras
_assert2(d1 == d2,
+
xbt
_dynar_shift(d,&d2);
+
xbt
_assert2(d1 == d2,
"The retrieved value is not the same than the injected one at the begining (%f!=%f)",
d1,d2);
"The retrieved value is not the same than the injected one at the begining (%f!=%f)",
d1,d2);
- DEBUG2("Pop %d, length=%lu",cpt,
gras
_dynar_length(d));
+ DEBUG2("Pop %d, length=%lu",cpt,
xbt
_dynar_length(d));
}
for (cpt=999; cpt>=0; cpt--) {
d1=(double)cpt;
}
for (cpt=999; cpt>=0; cpt--) {
d1=(double)cpt;
-
gras
_dynar_shift(d,&d2);
-
gras
_assert2 (d1 == d2,
+
xbt
_dynar_shift(d,&d2);
+
xbt
_assert2 (d1 == d2,
"The retrieved value is not the same than the injected one in the middle (%f!=%f)",
d1,d2);
}
for (cpt=2500; cpt< 5000; cpt++) {
d1=(double)cpt;
"The retrieved value is not the same than the injected one in the middle (%f!=%f)",
d1,d2);
}
for (cpt=2500; cpt< 5000; cpt++) {
d1=(double)cpt;
-
gras
_dynar_shift(d,&d2);
-
gras
_assert2 (d1 == d2,
+
xbt
_dynar_shift(d,&d2);
+
xbt
_assert2 (d1 == d2,
"The retrieved value is not the same than the injected one at the end (%f!=%f)",
d1,d2);
}
"The retrieved value is not the same than the injected one at the end (%f!=%f)",
d1,d2);
}
- gras_dynar_free(d);
+ xbt_dynar_free(&d);
+ xbt_dynar_free(&d);
INFO0("==== Push 5000 double, remove 2000-4000. free the rest");
INFO0("==== Push 5000 double, remove 2000-4000. free the rest");
- d=
gras
_dynar_new(sizeof(double),NULL);
+ d=
xbt
_dynar_new(sizeof(double),NULL);
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
for (cpt=0; cpt< 5000; cpt++) {
d1=(double)cpt;
-
gras
_dynar_push(d,&d1);
+
xbt
_dynar_push(d,&d1);
}
for (cpt=2000; cpt< 4000; cpt++) {
d1=(double)cpt;
}
for (cpt=2000; cpt< 4000; cpt++) {
d1=(double)cpt;
-
gras
_dynar_remove_at(d,2000,&d2);
-
gras
_assert2 (d1 == d2,
+
xbt
_dynar_remove_at(d,2000,&d2);
+
xbt
_assert2 (d1 == d2,
"Remove a bad value. Got %f, expected %f",
d2,d1);
}
"Remove a bad value. Got %f, expected %f",
d2,d1);
}
- gras_dynar_free(d);
+ xbt_dynar_free(&d);
+ xbt_dynar_free(&d);
-
gras
_exit();
+
xbt
_exit();
return 0;
}
return 0;
}