git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@262
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
gras_error_t test_pbio(gras_socket_t *sock, int direction);
gras_error_t test_pbio(gras_socket_t *sock, int direction);
+/* defined in datadesc_structures.c, which in perl generated */
+gras_error_t test_structures(gras_socket_t *sock, int direction);
+
+
+
gras_error_t test_int(gras_socket_t *sock, int direction) {
gras_error_t errcode;
int i=5,j;
gras_error_t test_int(gras_socket_t *sock, int direction) {
gras_error_t errcode;
int i=5,j;
gras_datadesc_by_name("int")));
TRY(gras_datadesc_declare_struct_append(my_type,"d",
gras_datadesc_by_name("int")));
gras_datadesc_by_name("int")));
TRY(gras_datadesc_declare_struct_append(my_type,"d",
gras_datadesc_by_name("int")));
+ gras_datadesc_declare_struct_close(my_type);
TRY(gras_datadesc_declare_ref("homostruct*",
gras_datadesc_by_name("homostruct"),
&my_type));
TRY(gras_datadesc_declare_ref("homostruct*",
gras_datadesc_by_name("homostruct"),
&my_type));
gras_datadesc_by_name("unsigned char")));
TRY(gras_datadesc_declare_struct_append(my_type,"l2",
gras_datadesc_by_name("unsigned long int")));
gras_datadesc_by_name("unsigned char")));
TRY(gras_datadesc_declare_struct_append(my_type,"l2",
gras_datadesc_by_name("unsigned long int")));
+ gras_datadesc_declare_struct_close(my_type);
TRY(gras_datadesc_declare_ref("hetestruct*",
gras_datadesc_by_name("hetestruct"),
&my_type));
TRY(gras_datadesc_declare_ref("hetestruct*",
gras_datadesc_by_name("hetestruct"),
&my_type));
gras_datadesc_by_name("hetestruct")));
TRY(gras_datadesc_declare_struct_append(my_type,"homo",
gras_datadesc_by_name("homostruct")));
gras_datadesc_by_name("hetestruct")));
TRY(gras_datadesc_declare_struct_append(my_type,"homo",
gras_datadesc_by_name("homostruct")));
+ gras_datadesc_declare_struct_close(my_type);
TRY(gras_datadesc_declare_ref("nestedstruct*",
gras_datadesc_by_name("nestedstruct"),
&my_type));
TRY(gras_datadesc_declare_ref("nestedstruct*",
gras_datadesc_by_name("nestedstruct"),
&my_type));
TRY(gras_datadesc_declare_struct_append(my_type,"v",
gras_datadesc_by_name("int")));
TRY(gras_datadesc_declare_struct_append(my_type,"l",ref_my_type));
TRY(gras_datadesc_declare_struct_append(my_type,"v",
gras_datadesc_by_name("int")));
TRY(gras_datadesc_declare_struct_append(my_type,"l",ref_my_type));
+ gras_datadesc_declare_struct_close(my_type);
double Cdtime;
double Ctime[2];
int Cntens;
double Cdtime;
double Ctime[2];
int Cntens;
double Cdfgrd0[373][3];
double Cdfgrd1[3][3];
double Cstress[106];
double Cddsdde[106][106];
double Cdfgrd0[373][3];
double Cdfgrd1[3][3];
double Cstress[106];
double Cddsdde[106][106];
};
)
typedef struct s_pbio pbio_t;
};
)
typedef struct s_pbio pbio_t;
gras_error_t errcode;
pbio_t i,j;
int cpt;
gras_error_t errcode;
pbio_t i,j;
int cpt;
gras_datadesc_type_t *pbio_type;
INFO0("---- Test on the PBIO IEEE struct (also tests GRAS DEFINE TYPE) ----");
pbio_type = gras_datadesc_by_symbol(s_pbio);
gras_datadesc_type_t *pbio_type;
INFO0("---- Test on the PBIO IEEE struct (also tests GRAS DEFINE TYPE) ----");
pbio_type = gras_datadesc_by_symbol(s_pbio);
- INFO1("sizof(s_pbio)=%d",sizeof(struct s_pbio));
- gras_datadesc_type_dump(gras_datadesc_by_name("double[373]"));
- gras_datadesc_type_dump(pbio_type);
/* Fill in that damn struct */
i.Cnstatv = 325115;
for (cpt=0; cpt<12; cpt++)
/* Fill in that damn struct */
i.Cnstatv = 325115;
for (cpt=0; cpt<12; cpt++)
i.Ctime[0] = 332523.226;
i.Ctime[1] = -26216.113;
i.Cntens = 235211411;
i.Ctime[0] = 332523.226;
i.Ctime[1] = -26216.113;
i.Cntens = 235211411;
for (cpt=0; cpt<3; cpt++) {
for (cpt2=0; cpt2<373; cpt2++)
i.Cdfgrd0[cpt2][cpt] = ((double)cpt) * ((double)cpt2);
for (cpt=0; cpt<3; cpt++) {
for (cpt2=0; cpt2<373; cpt2++)
i.Cdfgrd0[cpt2][cpt] = ((double)cpt) * ((double)cpt2);
i.Cstress[cpt]=(double)cpt * 22.113;
for (cpt2=0; cpt2<106; cpt2++)
i.Cddsdde[cpt][cpt2] = ((double)cpt) * ((double)cpt2);
i.Cstress[cpt]=(double)cpt * 22.113;
for (cpt2=0; cpt2<106; cpt2++)
i.Cddsdde[cpt][cpt2] = ((double)cpt) * ((double)cpt2);
TRY(write_read(gras_datadesc_by_symbol(s_pbio),
&i,&j, sock,direction));
if (direction == READ || direction == RW) {
TRY(write_read(gras_datadesc_by_symbol(s_pbio),
&i,&j, sock,direction));
if (direction == READ || direction == RW) {
gras_assert(i.Ctime[0] == j.Ctime[0]);
gras_assert(i.Ctime[1] == j.Ctime[1]);
gras_assert(i.Cntens == j.Cntens);
gras_assert(i.Ctime[0] == j.Ctime[0]);
gras_assert(i.Ctime[1] == j.Ctime[1]);
gras_assert(i.Cntens == j.Cntens);
for (cpt=0; cpt<3; cpt++) {
for (cpt2=0; cpt2<373; cpt2++)
gras_assert(i.Cdfgrd0[cpt2][cpt] == j.Cdfgrd0[cpt2][cpt]);
for (cpt=0; cpt<3; cpt++) {
for (cpt2=0; cpt2<373; cpt2++)
gras_assert(i.Cdfgrd0[cpt2][cpt] == j.Cdfgrd0[cpt2][cpt]);
gras_assert4(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2],
"%f=i.Cddsdde[%d][%d] != j.Cddsdde[cpt][cpt2]=%f",
i.Cddsdde[cpt][cpt2],cpt,cpt2,j.Cddsdde[cpt][cpt2]);
gras_assert4(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2],
"%f=i.Cddsdde[%d][%d] != j.Cddsdde[cpt][cpt2]=%f",
i.Cddsdde[cpt][cpt2],cpt,cpt2,j.Cddsdde[cpt][cpt2]);
TRYFAIL(test_string(sock,direction));
TRYFAIL(test_string(sock,direction));
+ TRYFAIL(test_structures(sock,direction));
+
TRYFAIL(test_homostruct(sock,direction));
TRYFAIL(test_hetestruct(sock,direction));
TRYFAIL(test_nestedstruct(sock,direction));
TRYFAIL(test_homostruct(sock,direction));
TRYFAIL(test_hetestruct(sock,direction));
TRYFAIL(test_nestedstruct(sock,direction));