summaryrefslogtreecommitdiffstats
path: root/tools/h5diff
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5diff')
-rw-r--r--tools/h5diff/h5diff.c1385
-rw-r--r--tools/h5diff/h5difftst.c990
-rw-r--r--tools/h5diff/h5trav.c51
-rw-r--r--tools/h5diff/h5trav.h20
-rwxr-xr-xtools/h5diff/testh5diff.sh418
5 files changed, 1380 insertions, 1484 deletions
diff --git a/tools/h5diff/h5diff.c b/tools/h5diff/h5diff.c
index b80b4f1..a2a17a5 100644
--- a/tools/h5diff/h5diff.c
+++ b/tools/h5diff/h5diff.c
@@ -20,27 +20,30 @@
#include "hdf5.h"
#include "h5trav.h"
+
#if 0
#define H5DIFF_DEBUG
#endif
-
-#define FFORMAT "%-15g %-15g %-15g\n"
+#define FFORMAT "%-15.10g %-15.10g %-15.10g\n"
#define IFORMAT "%-15d %-15d %-15d\n"
#define LIFORMAT "%-15ld %-15ld %-15ld\n"
+/* with -p option */
+#define FPFORMAT "%-15.10g %-15.10g %-15.10g %-14.10g\n"
+#define IPFORMAT "%-15d %-15d %-15d %-14d\n"
+#define LPIFORMAT "%-15ld %-15ld %-15ld %-14ld\n"
#define SPACES " "
typedef struct options_t
{
- int r_; /* report only what objects differ */
- int d_; /* delta difference */
- double d_delta; /* delta value */
- int p_; /* relative error */
- double p_relative; /* relative error value */
- int n_; /* count */
- int n_number_count; /* value */
- int m_; /* do not make the diff on a sequencial match, default yes */
+ int r; /* report only what objects differ */
+ int d; /* delta */
+ double delta; /* delta value */
+ int p; /* relative error */
+ double percent; /* relative error value */
+ int n; /* count */
+ int count; /* count value */
} options_t;
/*-------------------------------------------------------------------------
@@ -50,8 +53,6 @@ typedef struct options_t
int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
const char *obj2_name, options_t options );
-void print_class( H5T_class_t tclass, char *sclass );
-void list( const char *filename, int nobjects, info_t *info );
void diff( hid_t file1_id, const char *obj1_name, hid_t file2_id, const char *obj2_name,
options_t options, int type );
void compare( hid_t file1_id, const char *file1_name, const char *obj1_name,
@@ -62,8 +63,6 @@ void compare( hid_t file1_id, const char *file1_name, const char *obj1_name,
void match( hid_t file1_id, const char *file1_name, int nobjects1, info_t *info1,
hid_t file2_id, const char *file2_name, int nobjects2, info_t *info2,
options_t options );
-void print_pos( int *ph, unsigned int curr_pos, int *acc,
- int *pos, int rank, const char *obj1, const char *obj2 );
int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims,
options_t options, const char *obj1, const char *obj2,
hid_t m_type );
@@ -73,6 +72,9 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
*-------------------------------------------------------------------------
*/
+void list( const char *filename, int nobjects, info_t *info );
+void print_pos( int *ph, int p, unsigned int curr_pos, int *acc,
+ int *pos, int rank, const char *obj1, const char *obj2 );
hid_t fixtype( hid_t f_type );
void print_datatype(hid_t type);
int check_n_input( const char* );
@@ -80,7 +82,13 @@ int check_f_input( const char* );
int get_index( const char *obj, int nobjects, info_t *info );
int compare_object( char *obj1, char *obj2 );
void usage(void);
-void leave(void);
+const char* basename(const char *name);
+const char* get_type(int type);
+const char* get_class(H5T_class_t tclass);
+void print_dims( int r, hsize_t *d );
+void print_sizes( const char *obj1, const char *obj2,
+ hid_t f_type1, hid_t f_type2,
+ hid_t m_type1, hid_t m_type2 );
/*-------------------------------------------------------------------------
@@ -98,33 +106,41 @@ void leave(void);
*/
void usage(void)
{
- printf("Usage: h5diff [obj1_name] [obj2_name] [OPTIONS] file1_name file2_name\n");
- printf("Items in [ ] are optional\n");
- printf("[obj1_name] Name of an HDF5 object\n");
- printf("[obj2_name] Name of an HDF5 object\n");
- printf("file1_name File name of the first HDF5 file\n");
- printf("file2_name File name of the second HDF5 file\n");
+ printf("Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] \n");
+ printf("\n");
+ printf("file1 File name of the first HDF5 file\n");
+ printf("file2 File name of the second HDF5 file\n");
+ printf("[obj1] Name of an HDF5 object, in absolute path\n");
+ printf("[obj2] Name of an HDF5 object, in absolute path\n");
printf("[OPTIONS] are:\n");
- printf("[-h ] Print out this information\n");
- printf("[-r ] Print only what objects differ\n");
- printf("[-n count] Print difference up to count number for each variable\n");
+ printf("[-h] Print out this information\n");
+ printf("[-r] Print only what objects differ, not the differences\n");
+ printf("[-n count] Print difference up to count number\n");
printf("[-d delta] Print difference when it is greater than limit delta\n");
- printf("[-p relative] Print differences which are within a relative error value\n");
- printf("[-m ] Print differences on a sequential match iteration\n");
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: leave
- *
- * Purpose: exit and print newline
- *
- *-------------------------------------------------------------------------
- */
-void leave(void)
-{
- exit(EXIT_SUCCESS);
+ printf("[-p relative] Print difference when it is greater than a relative error\n");
+ printf("\n");
+ printf("Items in [] are optional\n");
+ printf("[obj1] and [obj1] are HDF5 objects (datasets, groups or datatypes)\n");
+ printf("The 'count' value must be a positive integer\n");
+ printf("The 'delta' and 'relative' values must be positive numbers\n");
+ printf("The -d compare criteria is |a - b| > delta\n");
+ printf("The -p compare criteria is |1 - b/a| > relative\n");
+ printf("\n");
+ printf("Examples:\n");
+ printf("\n");
+ printf("1) h5diff file1 file2 /a/b /a/c\n");
+ printf("\n");
+ printf(" Compares object '/a/b' in file1 with '/a/c' in file2\n");
+ printf("\n");
+ printf("2) h5diff file1 file2 /a/b\n");
+ printf("\n");
+ printf(" Compares object '/a/b' in both files\n");
+ printf("\n");
+ printf("3) h5diff file1 file2\n");
printf("\n");
+ printf(" Compares all objects in both files\n");
+ printf("\n");
+ exit(0);
}
@@ -154,15 +170,14 @@ int main(int argc, const char *argv[])
int nobjects1, nobjects2;
info_t *info1=NULL;
info_t *info2=NULL;
- options_t options = {0,0,0,0,0,0,0,0};
+ options_t options = {0,0,0,0,0,0,0};
void *edata;
hid_t (*func)(void*);
-
const char *file1_name;
const char *file2_name;
const char *obj1_name = NULL;
const char *obj2_name = NULL;
-
+
/*-------------------------------------------------------------------------
* print the command line options
*-------------------------------------------------------------------------
@@ -177,111 +192,133 @@ int main(int argc, const char *argv[])
/*-------------------------------------------------------------------------
- * parse command line options
+ * initial check of command line options
*-------------------------------------------------------------------------
*/
-
- if (argc < 3) {
+
+ if ( argc==2 && (strcmp("-h",argv[1])==0) )
+ usage();
+
+ if ( argc<3 )
+ {
printf("Number of arguments is only %d\n", argc );
usage();
- leave();
}
+
+/*-------------------------------------------------------------------------
+ * file names are first
+ *-------------------------------------------------------------------------
+ */
- /* last 2 items are the file names */
- for (i=1; i<argc ; i++)
+ if ( argc>=3 )
+ {
+ file1_name = argv[1];
+ file2_name = argv[2];
+ }
+
+/*-------------------------------------------------------------------------
+ * open the files first; if they are not valid, no point in continuing
+ *-------------------------------------------------------------------------
+ */
+
+ /* disable error reporting */
+ H5Eget_auto(&func, &edata);
+ H5Eset_auto(NULL, NULL);
+
+ /* Open the files */
+ if ((file1_id=H5Fopen(file1_name,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
+ {
+ printf("h5diff: %s: No such file or directory\n", file1_name );
+ exit(1);
+ }
+ if ((file2_id=H5Fopen(file2_name,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
+ {
+ printf("h5diff: %s: No such file or directory\n", file2_name );
+ exit(1);
+ }
+ /* enable error reporting */
+ H5Eset_auto(func, edata);
+
+
+/*-------------------------------------------------------------------------
+ * parse command line options
+ *-------------------------------------------------------------------------
+ */
+ for (i=3; i<argc ; i++)
{
-
/* get the single-letter switches */
if ( '-'==argv[i][0] )
{
-
for (s=argv[i]+1; *s; s++)
{
switch (*s) {
default:
printf("-%s is an invalid option\n", s );
usage();
- leave();
break;
case 'h':
usage();
- leave();
case 'r':
- options.r_ = 1;
- break;
- case 'm':
- options.m_ = 1;
+ options.r = 1;
break;
case 'd':
/* if it is not another option */
- if ( '-' !=argv[i+1][0] )
+ if ( '-' != argv[i+1][0] )
{
- options.d_ = 1;
-
+ options.d=1;
if ( check_f_input(argv[i+1])==-1)
{
printf("<-d %s> is not a valid option\n", argv[i+1] );
usage();
- leave();
}
-
- options.d_delta = atof(argv[i+1]);
+ options.delta = atof(argv[i+1]);
}
else
{
printf("<-d %s> is not a valid option\n", argv[i+1] );
usage();
- leave();
}
break;
case 'p':
if ( '-' !=argv[i+1][0] )
{
- options.p_ = 1;
-
+ options.p=1;
if ( check_f_input(argv[i+1])==-1)
{
printf("<-p %s> is not a valid option\n", argv[i+1] );
usage();
- leave();
}
-
- options.p_relative = atof(argv[i+1]);
+ options.percent = atof(argv[i+1]);
}
break;
case 'n':
if ( '-' !=argv[i+1][0] )
{
- options.n_ = 1;
-
+ options.n=1;
if ( check_n_input(argv[i+1])==-1)
{
printf("<-n %s> is not a valid option\n", argv[i+1] );
usage();
- leave();
}
- options.n_number_count = atoi(argv[i+1]);
+ options.count = atoi(argv[i+1]);
}
break;
} /*switch*/
} /*for*/
} /*if*/
- else
+ else /* not single-letter switches */
{
-
- /* 2 last args are the file names, and it is not a -switch parameter */
- if ( i < argc-2 && '-' !=argv[i-1][0] )
+ /* check if it is not a -d, -p parameter */
+ if ( '-' !=argv[i-1][0] )
{
- if ( obj1_name == NULL )
+ if ( obj1_name==NULL )
obj1_name = argv[i];
-
- if ( obj2_name == NULL )
+ if ( obj2_name==NULL )
{
-
/* check if we have a second object name */
- if ( i+1 < argc-2 && '-' !=argv[i+1][0] )
+ if ( i+1<argc && '-' !=argv[i+1][0] )
/* yes */
obj2_name = argv[i+1];
else
@@ -289,40 +326,12 @@ int main(int argc, const char *argv[])
obj2_name = obj1_name;
}
}
-
}
}/*for*/
-/*-------------------------------------------------------------------------
- * process the files
- *-------------------------------------------------------------------------
- */
-
- file1_name = argv[argc-2];
- file2_name = argv[argc-1];
-
- /* disable error reporting */
- H5Eget_auto(&func, &edata);
- H5Eset_auto(NULL, NULL);
-
-
- /* Open the files */
- if ((file1_id=H5Fopen(file1_name,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
- {
- printf("h5diff: %s: No such file or directory\n", file1_name );
- leave();
- }
-
- if ((file2_id=H5Fopen(file2_name,H5F_ACC_RDONLY,H5P_DEFAULT))<0 )
- {
- printf("h5diff: %s: No such file or directory\n", file2_name );
- leave();
- }
- /* enable error reporting */
- H5Eset_auto(func, edata);
/*-------------------------------------------------------------------------
@@ -340,6 +349,8 @@ int main(int argc, const char *argv[])
info1 = (info_t*) malloc( nobjects1 * sizeof(info_t));
info2 = (info_t*) malloc( nobjects2 * sizeof(info_t));
+ if (info1==NULL || info2==NULL)
+ return 0;
H5get_object_info( file1_id, info1 );
H5get_object_info( file2_id, info2 );
@@ -370,10 +381,8 @@ int main(int argc, const char *argv[])
assert( (H5Fclose(file1_id)) >=0);
assert( (H5Fclose(file2_id)) >=0);
- if ( info1 )
- free(info1);
- if ( info2 )
- free(info2);
+ info_free(info1,nobjects1);
+ info_free(info2,nobjects2);
printf("\n");
return 0;
@@ -406,8 +415,14 @@ int check_n_input( const char *str )
for ( i = 0; i < strlen(str); i++)
{
c = str[i];
- if ( c < 49 || c > 57 ) /* ascii values between 1 and 9 */
- return -1;
+ if ( i==0 )
+ {
+ if ( c < 49 || c > 57 ) /* ascii values between 1 and 9 */
+ return -1;
+ }
+ else
+ if ( c < 48 || c > 57 ) /* 0 also */
+ return -1;
}
return 1;
}
@@ -498,6 +513,159 @@ void list( const char *filename, int nobjects, info_t *info )
/*-------------------------------------------------------------------------
+ * Function: compare_object
+ *
+ * Purpose: do the compare criteria
+ *
+ * Return:
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int compare_object( char *obj1, char *obj2 )
+{
+ int cmp;
+ cmp = strcmp(obj1,obj2);
+ return cmp;
+
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: match
+ *
+ * Purpose: Find commom objects; the algorithm used for this search is the
+ * cosequential match algorithm and is described in
+ * Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley.
+ *
+ * Return:
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void match( hid_t file1_id, const char *file1_name, int nobjects1, info_t *info1,
+ hid_t file2_id, const char *file2_name, int nobjects2, info_t *info2,
+ options_t options )
+{
+ int cmp;
+ int more_names_exist = (nobjects1>0 && nobjects2>0) ? 1 : 0;
+ int curr1=0;
+ int curr2=0;
+ int i;
+ /*build a common list */
+ table_t *table=NULL;
+ unsigned long infile[2];
+ char c1, c2;
+
+/*-------------------------------------------------------------------------
+ * build the list
+ *-------------------------------------------------------------------------
+ */
+ table_init( &table );
+
+
+ while ( more_names_exist )
+ {
+ cmp = compare_object( info1[curr1].name, info2[curr2].name );
+ if ( cmp == 0 )
+ {
+ infile[0]=1; infile[1]=1;
+ table_add(infile, info1[curr1].name, info1[curr1].type, table );
+
+ curr1++;
+ curr2++;
+ }
+ else if ( cmp < 0 )
+ {
+ infile[0]=1; infile[1]=0;
+ table_add(infile, info1[curr1].name, info1[curr1].type, table );
+ curr1++;
+ }
+ else
+ {
+ infile[0]=0; infile[1]=1;
+ table_add(infile, info2[curr2].name, info2[curr2].type, table );
+ curr2++;
+ }
+
+ more_names_exist = (curr1<nobjects1 && curr2<nobjects2) ? 1 : 0;
+
+
+ } /* end while */
+
+ /* list1 did not end */
+ if (curr1<nobjects1)
+ {
+ while ( curr1<nobjects1 )
+ {
+ infile[0]=1; infile[1]=0;
+ table_add(infile, info1[curr1].name, info1[curr1].type, table );
+ curr1++;
+ }
+ }
+
+ /* list2 did not end */
+ if (curr2<nobjects2)
+ {
+ while ( curr2<nobjects2 )
+ {
+ infile[0]=0; infile[1]=1;
+ table_add(infile, info2[curr2].name, info2[curr2].type, table );
+ curr2++;
+ }
+ }
+
+/*-------------------------------------------------------------------------
+ * print the list
+ *-------------------------------------------------------------------------
+ */
+
+ printf("file1 file2\n");
+ printf("---------------------------------------\n");
+ for (i = 0; i < table->nobjs; i++)
+ {
+ c1 = (table->objs[i].objno[0]) ? 'x' : ' ';
+ c2 = (table->objs[i].objno[1]) ? 'x' : ' ';
+ printf("%5c %6c %-15s\n", c1, c2, table->objs[i].objname);
+ }
+ printf("\n");
+
+
+/*-------------------------------------------------------------------------
+ * do the diff for common objects
+ *-------------------------------------------------------------------------
+ */
+
+ for (i = 0; i < table->nobjs; i++)
+ {
+ if ( table->objs[i].objno[0]==1 && table->objs[i].objno[1]==1 )
+ diff( file1_id, table->objs[i].objname, file2_id, table->objs[i].objname, options,
+ table->objs[i].type );
+ }
+
+ /* free table */
+ table_free(table);
+}
+
+
+
+/*-------------------------------------------------------------------------
* Function: get_index
*
* Purpose: get index in list
@@ -523,7 +691,6 @@ int get_index( const char *obj, int nobjects, info_t *info )
for ( i = 0; i < nobjects; i++)
{
-
if ( strcmp(obj,info[i].name)==0 )
return i;
@@ -573,21 +740,25 @@ void compare( hid_t file1_id, const char *file1_name, const char *obj1_name,
printf( "Object <%s> could not be found in <%s>\n", obj1_name, file1_name );
f1=1;
}
-
if ( j == -1 )
{
printf( "Object <%s> could not be found in <%s>\n", obj2_name, file2_name );
f2=1;
}
-
if ( f1 || f2 )
return;
+ /* use the name with "/" first, as obtained by iterator function */
+ obj1_name=info1[i].name;
+ obj2_name=info2[j].name;
+
/* objects are not the same type */
if ( info1[i].type != info2[j].type )
{
- printf( "<%s> in <%s> is of different type than <%s> in <%s>\n",
- obj1_name, file1_name, obj2_name, file2_name );
+ printf("Comparison not supported\n");
+ printf("<%s> is of type %s and <%s> is of type %s\n",
+ obj1_name, get_type(info1[i].type),
+ obj2_name, get_type(info2[j].type) );
return;
}
@@ -618,152 +789,21 @@ void compare( hid_t file1_id, const char *file1_name, const char *obj1_name,
void diff( hid_t file1_id, const char *obj1_name, hid_t file2_id, const char *obj2_name,
options_t options, int type )
{
-
switch ( type )
{
-
case H5G_DATASET:
diff_dataset(file1_id,file2_id,obj1_name,obj2_name,options);
break;
-
- case H5G_GROUP:
- printf( "<%s> and <%s> are of type H5G_GROUP\n", obj1_name, obj2_name );
- break;
-
- case H5G_TYPE:
- printf( "<%s> and <%s> are of type H5G_TYPE\n", obj1_name, obj2_name );
- break;
-
- case H5G_LINK:
- printf( "<%s> and <%s> are of type H5G_LINK\n", obj1_name, obj2_name );
- break;
-
+
default:
- printf( "<%s> and <%s> are user defined types\n", obj1_name, obj2_name );
+ printf("Comparison not supported\n");
+ printf("<%s> is of type %s and <%s> is of type %s\n",
+ obj1_name, get_type(type),
+ obj2_name, get_type(type) );
break;
-
- } /* switch */
-
-}
-
-/*-------------------------------------------------------------------------
- * Function: compare_object
- *
- * Purpose: do the compare criteria
- *
- * Return:
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
- * Comments:
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-int compare_object( char *obj1, char *obj2 )
-{
- int cmp;
- cmp = strcmp(obj1,obj2);
- return cmp;
-
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: match
- *
- * Purpose: Find commom objects; the algorithm used for this search is the
- * cosequential match algorithm and is described in
- * Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley.
- *
- * Return:
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
- * Comments:
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-void match( hid_t file1_id, const char *file1_name, int nobjects1, info_t *info1,
- hid_t file2_id, const char *file2_name, int nobjects2, info_t *info2,
- options_t options )
-{
- int cmp;
- int more_names_exist = (nobjects1>0 && nobjects2>0) ? 1 : 0;
- int curr1=0;
- int curr2=0;
-
- while ( more_names_exist )
- {
-
- cmp = compare_object( info1[curr1].name, info2[curr2].name );
- if ( cmp == 0 )
- {
- printf( "<%s> found in <%s> and <%s> found in <%s>\n",
- info1[curr1].name, file1_name, info2[curr2].name, file2_name);
-
- /* do the diff */
- if ( options.m_ )
- {
- diff( file1_id, info1[curr1].name, file2_id, info1[curr1].name, options,
- info1[curr1].type );
- }
-
- curr1++;
- curr2++;
-
-
- }
- else if ( cmp < 0 )
- {
- printf( "<%s> is in <%s>, but not in <%s>\n", info1[curr1].name,
- file1_name, file2_name);
- curr1++;
- }
- else
- {
- printf( "<%s> is in <%s>, but not in <%s>\n", info2[curr2].name,
- file2_name, file1_name);
- curr2++;
- }
-
- more_names_exist = (curr1<nobjects1 && curr2<nobjects2) ? 1 : 0;
-
+ }
- } /* end while */
-
- /* list1 did not end */
- if (curr1<nobjects1)
- {
- while ( curr1<nobjects1 )
- {
- printf( "<%s> is in <%s>, but not in <%s>\n", info1[curr1].name,
- file1_name, file2_name);
- curr1++;
- }
- }
-
- /* list2 did not end */
- if (curr2<nobjects2)
- {
- while ( curr2<nobjects2 )
- {
- printf( "<%s> is in <%s>, but not in <%s>\n", info2[curr2].name,
- file2_name, file1_name);
- curr2++;
- }
- }
-
-
+ printf("\n");
}
/*-------------------------------------------------------------------------
@@ -803,12 +843,14 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
hsize_t dims1[32], dims2[32], maxdim1[32], maxdim2[32];
H5T_class_t tclass1;
H5T_class_t tclass2;
- int i, j;
- char sclass1[20];
- char sclass2[20];
+ int i;
int nfound;
void *edata;
hid_t (*func)(void*);
+ const char *name1=NULL; /* relative names */
+ const char *name2=NULL;
+ int maxdim_diff=0;
+ int dim_diff=0;
/* disable error reporting */
H5Eget_auto(&func, &edata);
@@ -831,9 +873,6 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
printf("Cannot open dataset <%s>\n", obj2_name );
goto out;
}
-
- printf( "Comparing <%s> with <%s>\n", obj1_name, obj2_name );
-
/* enable error reporting */
H5Eset_auto(func, edata);
@@ -888,10 +927,10 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
if ( tclass1 != tclass2 )
{
- print_class( tclass1, sclass1 );
- print_class( tclass2, sclass2 );
- printf( "<%s> is of class %s and <%s> is of class %s\n",
- obj1_name, sclass1, obj2_name, sclass2 );
+ printf("Comparison not supported\n");
+ printf("<%s> is of class %s and <%s> is of class %s\n",
+ obj1_name, get_class(tclass1),
+ obj2_name, get_class(tclass2) );
goto out;
}
@@ -900,53 +939,28 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
*-------------------------------------------------------------------------
*/
+ assert(tclass1==tclass2);
switch (tclass1)
{
case H5T_TIME:
- printf( "H5T_TIME comparison is not supported\n");
- goto out;
case H5T_STRING:
- printf( "H5T_STRING comparison is not supported\n");
- goto out;
case H5T_BITFIELD:
- printf( "H5T_BITFIELD comparison is not supported\n");
- goto out;
case H5T_OPAQUE:
- printf( "H5T_OPAQUE comparison is not supported\n");
- goto out;
case H5T_COMPOUND:
- printf( "H5T_COMPOUND comparison is not supported\n");
- goto out;
case H5T_REFERENCE:
- printf( "H5T_REFERENCE comparison is not supported\n");
- goto out;
case H5T_ENUM:
- printf( "H5T_ENUM comparison is not supported\n");
- goto out;
case H5T_VLEN:
- printf( "H5T_VLEN comparison is not supported\n");
- goto out;
case H5T_ARRAY:
- printf( "H5T_ARRAY comparison is not supported\n");
+ printf("Comparison not supported\n");
+ printf("<%s> is of class %s and <%s> is of class %s\n",
+ obj1_name, get_class(tclass1),
+ obj2_name, get_class(tclass2) );
goto out;
default:
break;
}
-/*-------------------------------------------------------------------------
- * check for equal datatype
- *-------------------------------------------------------------------------
- */
- if ( (H5Tequal(f_type1, f_type2)==0) )
- {
- printf("Warning: <%s> has different storage datatype than <%s>\n", obj1_name, obj2_name );
- printf("<%s> has datatype ", obj1_name);
- print_datatype(f_type1);
- printf(" and <%s> has datatype ", obj2_name);
- print_datatype(f_type2);
- printf("\n");
- }
/*-------------------------------------------------------------------------
* check for the same rank
@@ -955,70 +969,68 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
if ( rank1 != rank2 )
{
- printf( "<%s> is of rank %d and <%s> is of rank %d\n",
- obj1_name, rank1, obj2_name, rank2 );
- printf( "<%s>: ", obj1_name );
- printf("[ " );
- for (j = 0; j < rank1; j++)
- printf("%d ", (int)dims1[j] );
- printf("]\n" );
- printf( "<%s>: ", obj2_name );
- printf("[ " );
- for (j = 0; j < rank1; j++)
- printf("%d ", (int)dims2[j] );
- printf("]\n" );
+ printf("Comparison not supported\n");
+ printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
+ print_dims(rank1,dims1);
+ printf(", max dimensions ");
+ print_dims(rank1,maxdim1);
+ printf("\n" );
+ printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
+ print_dims(rank2,dims2);
+ printf(", max dimensions ");
+ print_dims(rank2,maxdim2);
goto out;
}
/*-------------------------------------------------------------------------
- * check for different maximum dimensions; just give a warning
+ * check for different dimensions
*-------------------------------------------------------------------------
*/
-
- for (i = 0; i < rank1; i++)
+
+ assert(rank1==rank2);
+ for ( i=0; i<rank1; i++)
{
if ( maxdim1[i] != maxdim2[i] )
- {
- printf( "Warning: <%s> has different maximum dimensions than <%s>\n", obj1_name, obj2_name );
- printf( "<%s>: ", obj1_name );
- printf("[ " );
- for (j = 0; j < rank1; j++)
- printf("%d ", (int)maxdim1[j] );
- printf("]\n" );
- printf( "<%s>: ", obj2_name );
- printf("[ " );
- for (j = 0; j < rank1; j++)
- printf("%d ", (int)maxdim2[j] );
- printf("]\n" );
- }
+ maxdim_diff=1;
+ if ( dims1[i] != dims2[i] )
+ dim_diff=1;
}
-
/*-------------------------------------------------------------------------
- * check for the same dimensionality
+ * current dimensions
*-------------------------------------------------------------------------
*/
- for (i = 0; i < rank1; i++)
+ if (dim_diff==1)
{
- if ( dims1[i] != dims2[i] )
- {
- printf( "<%s> has different dimensions than <%s>\n", obj1_name, obj2_name );
- printf( "<%s>: ", obj1_name );
- printf("[ " );
- for (j = 0; j < rank1; j++)
- printf("%d ", (int)dims1[j] );
- printf("]\n" );
- printf( "<%s>: ", obj2_name );
- printf("[ " );
- for (j = 0; j < rank1; j++)
- printf("%d ", (int)dims2[j] );
- printf("]\n" );
- goto out;
- }
+ printf("Comparison not supported\n");
+ printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
+ print_dims(rank1,dims1);
+ printf(", max dimensions ");
+ print_dims(rank1,maxdim1);
+ printf("\n" );
+ printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
+ print_dims(rank2,dims2);
+ printf(", max dimensions ");
+ print_dims(rank2,maxdim2);
+ goto out;
}
-
+/*-------------------------------------------------------------------------
+ * maximum dimensions; just give a warning
+ *-------------------------------------------------------------------------
+ */
+ if (maxdim_diff==1)
+ {
+ printf( "Warning: Different maximum dimensions\n");
+ printf("<%s> has max dimensions ", obj1_name);
+ print_dims(rank1,maxdim1);
+ printf("\n");
+ printf("<%s> has max dimensions ", obj2_name);
+ print_dims(rank2,maxdim2);
+ printf("\n");
+ }
+
/*-------------------------------------------------------------------------
* get number of elements
*-------------------------------------------------------------------------
@@ -1039,6 +1051,22 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
assert(tot_cnt1==tot_cnt2);
/*-------------------------------------------------------------------------
+ * check for equal file datatype; warning only
+ *-------------------------------------------------------------------------
+ */
+
+ if ( (H5Tequal(f_type1, f_type2)==0) )
+ {
+ printf("Warning: Different storage datatype\n");
+ printf("<%s> has file datatype ", obj1_name);
+ print_datatype(f_type1);
+ printf("\n");
+ printf("<%s> has file datatype ", obj2_name);
+ print_datatype(f_type2);
+ printf("\n");
+ }
+
+/*-------------------------------------------------------------------------
* memory type and sizes
*-------------------------------------------------------------------------
*/
@@ -1052,34 +1080,8 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
m_size2 = H5Tget_size( m_type2 );
#if defined (H5DIFF_DEBUG)
- printf("\n");
- printf("------------------\n");
- printf("sizeof(char) %u\n", sizeof(char) );
- printf("sizeof(short) %u\n", sizeof(short) );
- printf("sizeof(int) %u\n", sizeof(int) );
- printf("sizeof(long) %u\n", sizeof(long) );
- printf("<%s> ------------------\n", obj1_name);
- printf("type on file ");
- print_datatype(f_type1);
- printf("\n");
- printf("size on file %u\n", f_size1 );
-
- printf("type on memory ");
- print_datatype(m_type1);
- printf("\n");
- printf("size on memory %u\n", m_size1 );
-
- printf("<%s> ------------------\n", obj2_name);
- printf("type on file ");
- print_datatype(f_type2);
- printf("\n");
- printf("size on file %u\n", f_size2 );
-
- printf("type on memory ");
- print_datatype(m_type2);
- printf("\n");
- printf("size on memory %u\n", m_size2 );
-#endif /*H5DIFF_DEBUG*/
+ print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2);
+#endif
/*-------------------------------------------------------------------------
@@ -1101,16 +1103,12 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
m_type2 = fixtype( f_type1 );
m_size2 = H5Tget_size( m_type2 );
}
-
- }
-
- assert(m_size1==m_size2);
-
-
#if defined (H5DIFF_DEBUG)
- printf("fixed size on memory %u\n", m_size1 );
- printf("\n");
+ printf("WARNING: Size was upgraded\n");
+ print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2);
#endif
+ }
+ assert(m_size1==m_size2);
buf1 = (void *) malloc((unsigned) (tot_cnt1*m_size1));
buf2 = (void *) malloc((unsigned) (tot_cnt2*m_size2));
@@ -1132,7 +1130,14 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
if ( H5Dread(dset2_id,m_type2,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2) < 0 )
goto out;
- nfound = array_diff(buf1,buf2,tot_cnt1,rank1,dims1,options,obj1_name,obj2_name,m_type1);
+/*-------------------------------------------------------------------------
+ * array compare
+ *-------------------------------------------------------------------------
+ */
+ printf( "Comparing <%s> with <%s>\n", obj1_name, obj2_name );
+ name1=basename(obj1_name);
+ name2=basename(obj2_name);
+ nfound = array_diff(buf1,buf2,tot_cnt1,rank1,dims1,options,name1,name2,m_type1);
printf("%d differences found\n", nfound );
/*-------------------------------------------------------------------------
@@ -1243,15 +1248,15 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
memcpy(&temp1_char, _buf1, sizeof(char));
memcpy(&temp2_char, _buf2, sizeof(char));
/* -d and !-p */
- if (options.d_ && !options.p_)
+ if (options.d && !options.p)
{
- if (abs(temp1_char-temp2_char) > options.d_delta)
+ if (abs(temp1_char-temp2_char) > options.delta)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
}
@@ -1259,45 +1264,47 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
}
}
/* !-d and -p */
- else if (!options.d_ && options.p_)
+ else if (!options.d && options.p)
{
- if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options.p_relative )
+ if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options.percent )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
+ printf(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char),
+ abs(1-temp2_char/temp1_char));
}
nfound++;
}
}
/* -d and -p */
- else if ( options.d_ && options.p_)
+ else if ( options.d && options.p)
{
- if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options.p_relative &&
- abs(temp1_char-temp2_char) > options.d_delta )
+ if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options.percent &&
+ abs(temp1_char-temp2_char) > options.delta )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
+ printf(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char),
+ abs(1-temp2_char/temp1_char));
}
nfound++;
}
}
else if (temp1_char != temp2_char)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char));
}
@@ -1324,15 +1331,15 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
memcpy(&temp1_short, _buf1, sizeof(short));
memcpy(&temp2_short, _buf2, sizeof(short));
/* -d and !-p */
- if (options.d_ && !options.p_)
+ if (options.d && !options.p)
{
- if (abs(temp1_short-temp2_short) > options.d_delta)
+ if (abs(temp1_short-temp2_short) > options.delta)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
}
@@ -1340,45 +1347,47 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
}
}
/* !-d and -p */
- else if (!options.d_ && options.p_)
+ else if (!options.d && options.p)
{
- if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options.p_relative )
+ if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options.percent )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
+ printf(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short),
+ abs(1-temp2_short/temp1_short));
}
nfound++;
}
}
/* -d and -p */
- else if ( options.d_ && options.p_)
+ else if ( options.d && options.p)
{
- if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options.p_relative &&
- abs(temp1_short-temp2_short) > options.d_delta )
+ if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options.percent &&
+ abs(temp1_short-temp2_short) > options.delta )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
+ printf(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short),
+ abs(1-temp2_short/temp1_short));
}
nfound++;
}
}
else if (temp1_short != temp2_short)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short));
}
@@ -1405,15 +1414,15 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
memcpy(&temp1_int, _buf1, sizeof(int));
memcpy(&temp2_int, _buf2, sizeof(int));
/* -d and !-p */
- if (options.d_ && !options.p_)
+ if (options.d && !options.p)
{
- if (abs(temp1_int-temp2_int) > options.d_delta)
+ if (abs(temp1_int-temp2_int) > options.delta)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
}
@@ -1421,45 +1430,47 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
}
}
/* !-d and -p */
- else if (!options.d_ && options.p_)
+ else if (!options.d && options.p)
{
- if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options.p_relative )
+ if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options.percent )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
+ printf(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int),
+ abs(1-temp2_int/temp1_int));
}
nfound++;
}
}
/* -d and -p */
- else if ( options.d_ && options.p_)
+ else if ( options.d && options.p)
{
- if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options.p_relative &&
- abs(temp1_int-temp2_int) > options.d_delta )
+ if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options.percent &&
+ abs(temp1_int-temp2_int) > options.delta )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
+ printf(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int),
+ abs(1-temp2_int/temp1_int));
}
nfound++;
}
}
else if (temp1_int != temp2_int)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int));
}
@@ -1485,15 +1496,15 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
memcpy(&temp1_long, _buf1, sizeof(long));
memcpy(&temp2_long, _buf2, sizeof(long));
/* -d and !-p */
- if (options.d_ && !options.p_)
+ if (options.d && !options.p)
{
- if (labs(temp1_long-temp2_long) > (long)options.d_delta)
+ if (labs(temp1_long-temp2_long) > (long)options.delta)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
}
@@ -1501,45 +1512,47 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
}
}
/* !-d and -p */
- else if (!options.d_ && options.p_)
+ else if (!options.d && options.p)
{
- if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)options.p_relative )
+ if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)options.percent )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
+ printf(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long),
+ labs(1-temp2_long/temp1_long));
}
nfound++;
}
}
/* -d and -p */
- else if ( options.d_ && options.p_)
+ else if ( options.d && options.p)
{
- if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)options.p_relative &&
- labs(temp1_long-temp2_long) > (long)options.d_delta )
+ if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)options.percent &&
+ labs(temp1_long-temp2_long) > (long)options.delta )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
+ printf(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long),
+ labs(1-temp2_long/temp1_long));
}
nfound++;
}
}
else if (temp1_long != temp2_long)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long));
}
@@ -1572,15 +1585,15 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
memcpy(&temp1_float, _buf1, sizeof(float));
memcpy(&temp2_float, _buf2, sizeof(float));
/* -d and !-p */
- if (options.d_ && !options.p_)
+ if (options.d && !options.p)
{
- if (fabs(temp1_float-temp2_float) > options.d_delta)
+ if (fabs(temp1_float-temp2_float) > options.delta)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
}
@@ -1588,45 +1601,47 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
}
}
/* !-d and -p */
- else if (!options.d_ && options.p_)
+ else if (!options.d && options.p)
{
- if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options.p_relative )
+ if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options.percent )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
+ printf(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float),
+ fabs(1-temp2_float/temp1_float));
}
nfound++;
}
}
/* -d and -p */
- else if ( options.d_ && options.p_)
+ else if ( options.d && options.p)
{
- if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options.p_relative &&
- fabs(temp1_float-temp2_float) > options.d_delta )
+ if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options.percent &&
+ fabs(temp1_float-temp2_float) > options.delta )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
+ printf(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float),
+ fabs(1-temp2_float/temp1_float));
}
nfound++;
}
}
else if (temp1_float != temp2_float)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float));
}
@@ -1648,15 +1663,15 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
memcpy(&temp1_double, _buf1, sizeof(double));
memcpy(&temp2_double, _buf2, sizeof(double));
/* -d and !-p */
- if (options.d_ && !options.p_)
+ if (options.d && !options.p)
{
- if (fabs(temp1_double-temp2_double) > options.d_delta)
+ if (fabs(temp1_double-temp2_double) > options.delta)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
}
@@ -1664,45 +1679,47 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
}
}
/* !-d and -p */
- else if (!options.d_ && options.p_)
+ else if (!options.d && options.p)
{
- if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options.p_relative )
+ if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options.percent )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
+ printf(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double),
+ fabs(1-temp2_double/temp1_double));
}
nfound++;
}
}
/* -d and -p */
- else if ( options.d_ && options.p_)
+ else if ( options.d && options.p)
{
- if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options.p_relative &&
- fabs(temp1_double-temp2_double) > options.d_delta )
+ if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options.percent &&
+ fabs(temp1_double-temp2_double) > options.delta )
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
+ printf(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double),
+ fabs(1-temp2_double/temp1_double));
}
nfound++;
}
}
else if (temp1_double != temp2_double)
{
- if (options.n_ && nfound>=options.n_number_count)
+ if (options.n && nfound>=options.count)
return nfound;
- if ( options.r_==0 )
+ if ( options.r==0 )
{
- print_pos(&ph,i,acc,pos,rank,obj1,obj2);
+ print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double));
}
@@ -1731,117 +1748,6 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
/*-------------------------------------------------------------------------
- * Function: print_pos
- *
- * Purpose: convert an array index position to matrix notation
- *
- * Return: pos matrix array
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
- * Comments:
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-void print_pos( int *ph, unsigned int curr_pos, int *acc,
- int *pos, int rank, const char *obj1, const char *obj2 )
-{
- int i;
-
- /* print header */
- if ( *ph==1 )
- {
- printf("%-15s %-15s %-15s %-20s\n", "position", obj1, obj2, "difference");
- printf("------------------------------------------------------------\n");
- *ph=0;
- }
-
- for ( i = 0; i < rank; i++)
- pos[i]=0;
-
- for ( i = 0; i < rank; i++)
- {
- pos[i] = curr_pos/acc[i];
- curr_pos -= acc[i]*pos[i];
- }
- assert( curr_pos == 0 );
-
- printf("[ " );
- for ( i = 0; i < rank; i++)
- {
- printf("%d ", pos[i] );
- }
- printf("]" );
-}
-
-/*-------------------------------------------------------------------------
- * Function: print_class
- *
- * Purpose: print the class name
- *
- * Return:
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
- * Comments:
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-
-void print_class( H5T_class_t tclass, char *sclass )
-{
- switch (tclass)
- {
- default:
- printf("Invalid class");
- break;
- case H5T_TIME:
- strcpy(sclass,"H5T_TIME");
- break;
- case H5T_INTEGER:
- strcpy(sclass,"H5T_INTEGER");
- break;
- case H5T_FLOAT:
- strcpy(sclass,"H5T_FLOAT");
- break;
- case H5T_STRING:
- strcpy(sclass,"H5T_STRING");
- break;
- case H5T_BITFIELD:
- strcpy(sclass,"H5T_BITFIELD");
- break;
- case H5T_OPAQUE:
- strcpy(sclass,"H5T_OPAQUE");
- break;
- case H5T_COMPOUND:
- strcpy(sclass,"H5T_COMPOUND");
- break;
- case H5T_REFERENCE:
- strcpy(sclass,"H5T_REFERENCE");
- break;
- case H5T_ENUM:
- strcpy(sclass,"H5T_ENUM");
- break;
- case H5T_VLEN:
- strcpy(sclass,"H5T_VLEN");
- break;
- case H5T_ARRAY:
- strcpy(sclass,"H5T_ARRAY");
- break;
- }
-}
-
-
-/*-------------------------------------------------------------------------
* Function: fixtype
*
* Purpose: Given a file data type choose a memory data type which is
@@ -1952,6 +1858,89 @@ hid_t fixtype(hid_t f_type)
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_pos
+ *
+ * Purpose: convert an array index position to matrix notation
+ *
+ * Return: pos matrix array
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void print_pos( int *ph, int p, unsigned int curr_pos, int *acc,
+ int *pos, int rank, const char *obj1, const char *obj2 )
+{
+ int i;
+
+ /* print header */
+ if ( *ph==1 )
+ {
+ *ph=0;
+ if (p)
+ {
+ printf("%-15s %-15s %-15s %-15s %-15s\n", "position", obj1, obj2, "difference",
+ "relative");
+ printf("------------------------------------------------------------------------\n");
+ }
+ else
+ {
+ printf("%-15s %-15s %-15s %-20s\n", "position", obj1, obj2, "difference");
+ printf("------------------------------------------------------------\n");
+ }
+ }
+
+ for ( i = 0; i < rank; i++)
+ pos[i]=0;
+
+ for ( i = 0; i < rank; i++)
+ {
+ pos[i] = curr_pos/acc[i];
+ curr_pos -= acc[i]*pos[i];
+ }
+ assert( curr_pos == 0 );
+
+ printf("[ " );
+ for ( i = 0; i < rank; i++)
+ {
+ printf("%d ", pos[i] );
+ }
+ printf("]" );
+}
+
+/*-------------------------------------------------------------------------
+ * Function: print_dims
+ *
+ * Purpose: print dimensions
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+void print_dims( int r, hsize_t *d )
+{
+ int i;
+ printf("[ " );
+ for ( i=0; i<r; i++ )
+ printf("%d ",(int)d[i] );
+ printf("] " );
+}
+
+
/*-------------------------------------------------------------------------
* Function: print_datatype
*
@@ -2057,6 +2046,164 @@ void print_datatype(hid_t type)
+/*-------------------------------------------------------------------------
+ * Function: basename
+ *
+ * Purpose: Returns a pointer to the last component absolute name
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+const char*
+basename(const char *name)
+{
+ size_t i;
+
+ /* Find the end of the base name */
+ i = strlen(name);
+ while (i>0 && '/'==name[i-1])
+ --i;
+
+ /* Skip backward over base name */
+ while (i>0 && '/'!=name[i-1])
+ --i;
+
+ return(name+i);
+}
+/*-------------------------------------------------------------------------
+ * Function: get_type
+ *
+ * Purpose: Returns the type as a string
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+const char*
+get_type(int type)
+{
+ switch (type)
+ {
+ case H5G_DATASET:
+ return("H5G_DATASET");
+ case H5G_GROUP:
+ return("H5G_GROUP");
+ case H5G_TYPE:
+ return("H5G_TYPE");
+ case H5G_LINK:
+ return("H5G_LINK");
+ default:
+ return("user defined type");
+ }
+}
+
+/*-------------------------------------------------------------------------
+ * Function: get_class
+ *
+ * Purpose: Returns the class as a string
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+const char*
+get_class(H5T_class_t tclass)
+{
+ switch (tclass)
+ {
+ default:
+ return("Invalid class");
+ case H5T_TIME:
+ return("H5T_TIME");
+ case H5T_INTEGER:
+ return("H5T_INTEGER");
+ case H5T_FLOAT:
+ return("H5T_FLOAT");
+ case H5T_STRING:
+ return("H5T_STRING");
+ case H5T_BITFIELD:
+ return("H5T_BITFIELD");
+ case H5T_OPAQUE:
+ return("H5T_OPAQUE");
+ case H5T_COMPOUND:
+ return("H5T_COMPOUND");
+ case H5T_REFERENCE:
+ return("H5T_REFERENCE");
+ case H5T_ENUM:
+ return("H5T_ENUM");
+ case H5T_VLEN:
+ return("H5T_VLEN");
+ case H5T_ARRAY:
+ return("H5T_ARRAY");
+ }
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_sizes
+ *
+ * Purpose: Print datatype sizes
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void print_sizes( const char *obj1, const char *obj2,
+ hid_t f_type1, hid_t f_type2,
+ hid_t m_type1, hid_t m_type2 )
+{
+ size_t f_size1, f_size2; /* size of type in file */
+ size_t m_size1, m_size2; /* size of type in memory */
+
+ f_size1 = H5Tget_size( f_type1 );
+ f_size2 = H5Tget_size( f_type2 );
+ m_size1 = H5Tget_size( m_type1 );
+ m_size2 = H5Tget_size( m_type2 );
+
+ printf("\n");
+ printf("------------------\n");
+ printf("sizeof(char) %u\n", sizeof(char) );
+ printf("sizeof(short) %u\n", sizeof(short) );
+ printf("sizeof(int) %u\n", sizeof(int) );
+ printf("sizeof(long) %u\n", sizeof(long) );
+ printf("<%s> ------------------\n", obj1);
+ printf("type on file ");
+ print_datatype(f_type1);
+ printf("\n");
+ printf("size on file %u\n", f_size1 );
+
+ printf("type on memory ");
+ print_datatype(m_type1);
+ printf("\n");
+ printf("size on memory %u\n", m_size1 );
+
+ printf("<%s> ------------------\n", obj2);
+ printf("type on file ");
+ print_datatype(f_type2);
+ printf("\n");
+ printf("size on file %u\n", f_size2 );
+
+ printf("type on memory ");
+ print_datatype(m_type2);
+ printf("\n");
+ printf("size on memory %u\n", m_size2 );
+ printf("\n");
+}
diff --git a/tools/h5diff/h5difftst.c b/tools/h5diff/h5difftst.c
index 5eb2b8b..844d534 100644
--- a/tools/h5diff/h5difftst.c
+++ b/tools/h5diff/h5difftst.c
@@ -18,508 +18,429 @@
#include "hdf5.h"
-/* diff tst*/
-int do_test_files(void);
+
+/* diff test*/
+int do_test_1(const char *file1, const char *file2);
+int do_test_2(const char *file1, const char *file2);
+int do_test_3(const char *file1, const char *file2);
+int do_test_4(const char *file1, const char *file2);
+int do_test_5(const char *file1, const char *file2);
int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
- hid_t type_id, void *data );
+ hid_t type_id, void *buf );
int main(int argc, const char *argv[])
{
- do_test_files();
+ do_test_1("file1.h5","file2.h5");
+ do_test_2("file3.h5",NULL);
+ do_test_3("file4.h5",NULL);
+ do_test_4("file5.h5",NULL);
+ do_test_5("file6.h5",NULL);
return 0;
}
-
/*-------------------------------------------------------------------------
- * these command line options are tested in ./testh5diff.sh
+ * Function: write_dataset
+ *
+ * Purpose: utility function to write a dataset
+ *
+ * Return:
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: April 7, 2003
+ *
*-------------------------------------------------------------------------
*/
-/*
+int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
+ hid_t type_id, void *buf )
+{
+ hid_t dataset_id;
+ hid_t space_id;
+ herr_t status;
-##############################################################################
-# tests 0., Check for individual options
-##############################################################################
+ /* Create a buf space */
+ space_id = H5Screate_simple(rank,dims,NULL);
-# test 0.1: Check if the command line number of arguments is less than 3
-h5diff_test1.h5
+ /* Create a dataset */
+ dataset_id = H5Dcreate(loc_id,dset_name,type_id,space_id,H5P_DEFAULT);
+
+ /* Write the buf */
+ if ( buf )
+ status = H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf);
-# test 0.2: Check for invalid options
--x h5diff_test1.h5 h5diff_test2.h5
+ /* Close */
+ status = H5Dclose(dataset_id);
+ status = H5Sclose(space_id);
-# test 0.3.1: Check for -h option
--h h5diff_test1.h5 h5diff_test2.h5
+ return status;
-# test 0.3.3: Check for -r option
--r h5diff_test1.h5 h5diff_test2.h5
+}
-##############################################################################
-# Test -d option
-##############################################################################
+/*
+# ##############################################################################
+# # Common usage
+# ##############################################################################
-# test 0.4.1: no value
--d h5diff_test1.h5 h5diff_test2.h5
-# test 0.4.2: negative value
--d -4 h5diff_test1.h5 h5diff_test2.h5
+# 1.0
+ -h
-# test 0.4.3: zero
--d 0 h5diff_test1.h5 h5diff_test2.h5
+# 1.1
+ file1.h5 file2.h5 g1/dset1 g1/dset2
-# test 0.4.4: non number
--d u h5diff_test1.h5 h5diff_test2.h5
+# 1.2
+ file1.h5 file2.h5 -n 2 g1/dset1 g1/dset2
-# test 0.4.5: hexadecimal
--d 0x1 h5diff_test1.h5 h5diff_test2.h5
+# 1.3
+ file1.h5 file2.h5 -d 5 g1/dset3 g1/dset4
-# test 0.4.6: string which is a number
--d "1" h5diff_test1.h5 h5diff_test2.h5
+# 1.4
+ file1.h5 file2.h5 -p 0.05 g1/dset3 g1/dset4
-# test 0.4.7: repeated value
--d 1 -d 2 h5diff_test1.h5 h5diff_test2.h5
+# 1.5
+ file1.h5 file2.h5 -r g1/dset1 g1/dset2
-# test 0.4.8: number larger than biggest difference
-dset2.1a dset2.1b -d 7 h5diff_test1.h5 h5diff_test2.h5
+# 1.6
+ file1.h5 file2.h5
-# test 0.4.9: number smaller than smallest difference
-dset2.1a dset2.1b -d 1 h5diff_test1.h5 h5diff_test2.h5
+# ##############################################################################
+# # not comparable types
+# ##############################################################################
-# test 0.4.10: non-integer
-dset2.1a dset2.1b -d 2.3 h5diff_test1.h5 h5diff_test2.h5
+# 2.0
+ file3.h5 file3.h5 dset group
+# 2.1
+ file3.h5 file3.h5 dset link
-##############################################################################
-# Test -p option
-##############################################################################
+# 2.2
+ file3.h5 file3.h5 dset type
+# 2.3
+ file3.h5 file3.h5 group group
-# test 0.5.1: no value
--p h5diff_test1.h5 h5diff_test2.h5
+# 2.4
+ file3.h5 file3.h5 type type
-# test 0.5.2: negative value
--p -4 h5diff_test1.h5 h5diff_test2.h5
+# 2.5
+ file3.h5 file3.h5 link link
-# test 0.5.3: zero
--p 0 h5diff_test1.h5 h5diff_test2.h5
+# ##############################################################################
+# # Class issues
+# ##############################################################################
-# test 0.5.4: non number
--p u h5diff_test1.h5 h5diff_test2.h5
-# test 0.5.5: hexadecimal
--p 0x1 h5diff_test1.h5 h5diff_test2.h5
+# 3.0
+ file4.h5 file4.h5 string
-# test 0.5.6: string
--p "1" h5diff_test1.h5 h5diff_test2.h5
+# 3.1
+ file4.h5 file4.h5 bitfield
-# test 0.5.7: repeated value
--p 1 -p 2 h5diff_test1.h5 h5diff_test2.h5
+# 3.2
+ file4.h5 file4.h5 opaque
-# test 0.5.8: number larger than biggest difference
-dset2.1a dset2.1b -p 7 h5diff_test1.h5 h5diff_test2.h5
+# 3.3
+ file4.h5 file4.h5 compound
-# test 0.5.9: number smaller than smallest difference
-dset2.1a dset2.1b -p 1 h5diff_test1.h5 h5diff_test2.h5
+# 3.4
+ file4.h5 file4.h5 ref
-# test 0.5.10: non-integer
-dset2.1a dset2.1b -p 2.3 h5diff_test1.h5 h5diff_test2.h5
+# 3.5
+ file4.h5 file4.h5 enum
-##############################################################################
-# Test -n option
-##############################################################################
+# 3.6
+ file4.h5 file4.h5 vlen
+# 3.7
+ file4.h5 file4.h5 array
-# test 0.6.1: no value
--n h5diff_test1.h5 h5diff_test2.h5
+# 3.8
+ file4.h5 file4.h5 integer float
-# test 0.6.2: negative value
--n -4 h5diff_test1.h5 h5diff_test2.h5
+# ##############################################################################
+# # Dimensions
+# ##############################################################################
-# test 0.6.3: zero
--n 0 h5diff_test1.h5 h5diff_test2.h5
+# 4.0
+ file5.h5 file5.h5 dset1 dset2
-# test 0.6.4: non number
--n u h5diff_test1.h5 h5diff_test2.h5
+# 4.1
+ file5.h5 file5.h5 dset3 dset4
-# test 0.6.5: hexadecimal
--n 0x1 h5diff_test1.h5 h5diff_test2.h5
+# 4.2
+ file5.h5 file5.h5 dset5 dset6
-# test 0.6.6: string
--n "1" h5diff_test1.h5 h5diff_test2.h5
-# test 0.6.7: repeated value
--n 1 -n 2 h5diff_test1.h5 h5diff_test2.h5
+# ##############################################################################
+# # Dataset types
+# ##############################################################################
-# test 0.6.8: number larger than biggest difference
-dset2.1a dset2.1b -n 7 h5diff_test1.h5 h5diff_test2.h5
+# 5.0
+ file6.h5 file6.h5 dset0a dset0b
-# test 0.6.9: number smaller than smallest difference
-dset2.1a dset2.1b -n 1 h5diff_test1.h5 h5diff_test2.h5
+# 5.1
+ file6.h5 file6.h5 dset1a dset1b
-# test 0.6.10: non-integer
-dset2.1a dset2.1b -n 2.3 h5diff_test1.h5 h5diff_test2.h5
+# 5.2
+ file6.h5 file6.h5 dset2a dset2b
-##############################################################################
-# Test valid files
-##############################################################################
+# 5.3
+ file6.h5 file6.h5 dset3a dset4b
-# test 0.7: Check if the file names supplied are valid files
-h5diff_test1.h6 h5diff_test2.h6
+# 5.4
+ file6.h5 file6.h5 dset4a dset4b
+# 5.5
+ file6.h5 file6.h5 dset5a dset5b
-##############################################################################
-# Check for not comparable issues
-##############################################################################
+# 5.6
+ file6.h5 file6.h5 dset6a dset6b
-##############################################################################
-# Different types
-##############################################################################
+# ##############################################################################
+# # Error messages
+# ##############################################################################
-# test 1.1.1: Compare a dataset with a group
-dset1.1 g1.1 h5diff_test1.h5 h5diff_test2.h5
-# test 1.1.2 Dataset vs Link
-dset1.1 soft h5diff_test1.h5 h5diff_test1.h5
+# 6.0: Check if the command line number of arguments is less than 3
+ h5diff_test1.h5
-# test 1.1.3 Dataset vs Named type
-dset1.1 compound h5diff_test1.h5 h5diff_test1.h5
+# 6.1: Check for invalid options
+ h5diff_test1.h5 h5diff_test2.h5 -x
-##############################################################################
-# not comparable types
-##############################################################################
+# ##############################################################################
+# # -d
+# ##############################################################################
-# test 1.2.1: Group vs Group
-g1.1 g1.1 h5diff_test1.h5 h5diff_test2.h5
+# 6.2: no value
+ file1.h5 file2.h5 -d g1/dset3 g1/dset4
-# test 1.2.2: Type vs Type
-compound h5diff_test1.h5 h5diff_test2.h5
+# 6.3: negative value
+ file1.h5 file2.h5 -d -4 g1/dset3 g1/dset4
-# test 1.2.3: Link vs Link
-soft soft h5diff_test1.h5 h5diff_test1.h5
+# 6.4: zero
+ file1.h5 file2.h5 -d 0 g1/dset3 g1/dset4
+# 6.5: non number
+ file1.h5 file2.h5 -d u g1/dset3 g1/dset4
-##############################################################################
-# Class issues
-##############################################################################
+# 6.6: hexadecimal
+ file1.h5 file2.h5 -d 0x1 g1/dset3 g1/dset4
-# test 1.3.1: H5T_STRING
-dset1.3.1 h5diff_test1.h5 h5diff_test1.h5
+# 6.7: string
+ file1.h5 file2.h5 -d "1" g1/dset3 g1/dset4
-# test 1.3.2: H5T_BITFIELD
-dset1.3.2 h5diff_test1.h5 h5diff_test1.h5
+# 6.8: repeated option
+ file1.h5 file2.h5 -d 1 -d 2 g1/dset3 g1/dset4
-# test 1.3.3: H5T_OPAQUE
-dset1.3.3 h5diff_test1.h5 h5diff_test1.h5
+# 6.9: number larger than biggest difference
+ file1.h5 file2.h5 -d 200 g1/dset3 g1/dset4
-# test 1.3.4: H5T_COMPOUND
-dset1.3.4 h5diff_test1.h5 h5diff_test1.h5
+# 6.10: number smaller than smallest difference
+ file1.h5 file2.h5 -d 1 g1/dset3 g1/dset4
-# test 1.3.5: H5T_REFERENCE
-dset1.3.5 h5diff_test1.h5 h5diff_test1.h5
-# test 1.3.6: H5T_ENUM
-dset1.3.6 h5diff_test1.h5 h5diff_test1.h5
+# ##############################################################################
+# # -p
+# ##############################################################################
-# test 1.3.7: H5T_VLEN
-dset1.3.7 h5diff_test1.h5 h5diff_test1.h5
-# test 1.3.8: H5T_ARRAY
-dset1.3.8 h5diff_test1.h5 h5diff_test1.h5
+# 6.11: no value
+ file1.h5 file2.h5 -p g1/dset3 g1/dset4
+# 6.12: negative value
+ file1.h5 file2.h5 -p -4 g1/dset3 g1/dset4
-# test 1.4: Compare integer with float
-dset1.1 dset1.4 h5diff_test1.h5 h5diff_test2.h5
+# 6.13: zero
+ file1.h5 file2.h5 -p 0 g1/dset3 g1/dset4
-# test 1.5 : Check for the same rank, for datasets
-dset1.1 dset1.5 h5diff_test1.h5 h5diff_test2.h5
+# 6.14: non number
+ file1.h5 file2.h5 -p u g1/dset3 g1/dset4
-# test 1.6: Check for the same current dimensions. Only compare if they are the same.
-dset1.1 dset1.6 h5diff_test1.h5 h5diff_test2.h5
+# 6.15: hexadecimal
+ file1.h5 file2.h5 -p 0x1 g1/dset3 g1/dset4
-# test 1.7: Check for the same maximum dimensions. Give a warning if they are different.
-dset1.7 dset1.7 h5diff_test1.h5 h5diff_test2.h5
+# 6.16: string
+ file1.h5 file2.h5 -p "0.21" g1/dset3 g1/dset4
-# test 1.8: Check for the same storage datatype. Give a warning if they are different.
-dset1.8 dset1.8 h5diff_test1.h5 h5diff_test2.h5
+# 6.17: repeated option
+ file1.h5 file2.h5 -p 0.21 -p 0.22 g1/dset3 g1/dset4
+# 6.18: number larger than biggest difference
+ file1.h5 file2.h5 -p 2 g1/dset3 g1/dset4
-#######################################################
-# Different datatype sizes and different mix of options
-#######################################################
+# 6.19: number smaller than smallest difference
+ file1.h5 file2.h5 -p 0.005 g1/dset3 g1/dset4
-##############################################################################
-# H5T_NATIVE_CHAR
-##############################################################################
-# test 2.1.0
-dset2.1a dset2.1b h5diff_test1.h5 h5diff_test2.h5
-# test 2.1.1
-dset2.1a dset2.1b -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.1.2
-dset2.1a dset2.1b -d 3 h5diff_test1.h5 h5diff_test2.h5
-# test 2.1.3
-dset2.1a dset2.1b -p 3 h5diff_test1.h5 h5diff_test2.h5
-##############################################################################
-# H5T_NATIVE_SHORT
-##############################################################################
+# ##############################################################################
+# # -n
+# ##############################################################################
-# test 2.2.0
-dset2.2a dset2.2b h5diff_test1.h5 h5diff_test2.h5
-# test 2.2.1
-dset2.2a dset2.2b -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.2.2
-dset2.2a dset2.2b -d 3 h5diff_test1.h5 h5diff_test2.h5
-# test 2.2.3
-dset2.2a dset2.2b -p 3 h5diff_test1.h5 h5diff_test2.h5
-##############################################################################
-# H5T_NATIVE_INT
-##############################################################################
+# 6.20: no value
+ file1.h5 file2.h5 -n g1/dset3 g1/dset4
-# test 2.3.0
-dset2.3a dset2.3b h5diff_test1.h5 h5diff_test2.h5
-# test 2.3.1
-dset2.3a dset2.3b -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.3.2
-dset2.3a dset2.3b -d 3 h5diff_test1.h5 h5diff_test2.h5
-# test 2.3.3
-dset2.3a dset2.3b -p 3 h5diff_test1.h5 h5diff_test2.h5
+# 6.21: negative value
+ file1.h5 file2.h5 -n -4 g1/dset3 g1/dset4
-##############################################################################
-# H5T_NATIVE_LONG
-##############################################################################
+# 6.22: zero
+ file1.h5 file2.h5 -n 0 g1/dset3 g1/dset4
-# test 2.4.0
-dset2.4a dset2.4b h5diff_test1.h5 h5diff_test2.h5
-# test 2.4.1
-dset2.4a dset2.4b -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.4.2
-dset2.4a dset2.4b -d 3 h5diff_test1.h5 h5diff_test2.h5
-# test 2.4.3
-dset2.4a dset2.4b -p 3 h5diff_test1.h5 h5diff_test2.h5
+# 6.23: non number
+ file1.h5 file2.h5 -n u g1/dset3 g1/dset4
-##############################################################################
-# H5T_NATIVE_FLOAT
-##############################################################################
+# 6.24: hexadecimal
+ file1.h5 file2.h5 -n 0x1 g1/dset3 g1/dset4
-# test 2.5.0
-dset2.5a dset2.5b h5diff_test1.h5 h5diff_test2.h5
-# test 2.5.1
-dset2.5a dset2.5b -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.5.2
-dset2.5a dset2.5b -d 3 h5diff_test1.h5 h5diff_test2.h5
-# test 2.5.3
-dset2.5a dset2.5b -p 3 h5diff_test1.h5 h5diff_test2.h5
+# 6.25: string
+ file1.h5 file2.h5 -n "2" g1/dset3 g1/dset4
-##############################################################################
-# H5T_NATIVE_DOUBLE
-##############################################################################
-
-# test 2.6.0
-dset2.6a dset2.6b h5diff_test1.h5 h5diff_test2.h5
-# test 2.6.1
-dset2.6a dset2.6b -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.6.2
-dset2.6a dset2.6b -d 3 h5diff_test1.h5 h5diff_test2.h5
-# test 2.6.3
-dset2.6a dset2.6b -p 3 h5diff_test1.h5 h5diff_test2.h5
-
-#######################################################
-# Different combination of objects
-#######################################################
-
-# test 3.0
-h5diff_test3.h5 h5diff_test4.h5
-
-# test 3.1
-dset_A dset_A h5diff_test3.h5 h5diff_test4.h5
-
-# test 3.2
-dset_A dset_B h5diff_test3.h5 h5diff_test4.h5
-
-# test 3.3
-dset_C dset_A h5diff_test3.h5 h5diff_test4.h5
-
-# test 3.4
-dset_C dset_C h5diff_test3.h5 h5diff_test4.h5
-
-#######################################################
-# reverse direction
-#######################################################
-
-# test 3.5
-h5diff_test4.h5 h5diff_test3.h5
-
-#######################################################
-# Different paths
-#######################################################
-
-# test 4.0: should find
-g1/dset1 g2/dset1 h5diff_test5.h5 h5diff_test6.h5
-
-# test 4.1.1: should NOT find
-dset1 dset1 h5diff_test5.h5 h5diff_test6.h5
-
-# test 4.1.2: should NOT find
-/g1/dset1 dset1 h5diff_test5.h5 h5diff_test6.h5
-
-# test 4.1.3: should NOT find
-/g1/dset1 /g1/dset1 h5diff_test5.h5 h5diff_test6.h5
-
-#######################################################
-# paths with several components
-#######################################################
-
-# test 4.2.1:
-/a/b/c /a/b/c h5diff_test5.h5 h5diff_test6.h5
-
-# test 4.2.2:
-/x/a/c /a/b/c h5diff_test5.h5 h5diff_test6.h5
-
-*/
-
-
-int do_test_files(void)
-{
+# 6.26: repeated option
+ file1.h5 file2.h5 -n 2 -n 3 g1/dset3 g1/dset4
- hid_t file1_id, file2_id, file3_id, file4_id;
- hid_t file5_id, file6_id;
- hid_t dataset_id;
- hid_t space_id;
- hid_t group_id, group2_id;
- hid_t plist_id;
- hid_t type_id, type2_id;
- herr_t status;
- int val;
+# 6.27: number larger than biggest difference
+ file1.h5 file2.h5 -n 200 g1/dset3 g1/dset4
- /* Test 1. */
- hsize_t dims1 [1] = { 7 };
- hsize_t dims1_1[1] = { 8 };
- hsize_t maxdim [1] = { 8 };
- hsize_t dims0 [1] = { 1 };
- hsize_t dims2 [2] = { 3,2 };
- char data1_3[] = {"A string"};
- unsigned char data1_3_2[7] = {1,2,3,4,5,6,7};
- float data1_4[7] = {1,1,3,4,5,6,7};
-
- /* Compound datatype */
- typedef struct s_t
- {
- int a;
- float b;
- } s_t;
+# 6.28: number smaller than smallest difference
+ file1.h5 file2.h5 -n 1 g1/dset3 g1/dset4
- typedef enum
- {
- E_RED,
- E_GREEN
-} e_t;
+# ##############################################################################
+# # non valid files
+# ##############################################################################
- /* Test 2.1 */
- char data2_1a[3][2] = {{1,1},{1,1},{1,1}};
- char data2_1b[3][2] = {{1,1},{3,4},{5,6}};
- /* Test 2.2 */
- short data2_2a[3][2] = {{1,1},{1,1},{1,1}};
- short data2_2b[3][2] = {{1,1},{3,4},{5,6}};
- /* Test 2.3 */
- int data2_3a[3][2] = {{1,1},{1,1},{1,1}};
- int data2_3b[3][2] = {{1,1},{3,4},{5,6}};
- /* Test 2.4 */
- long data2_4a[3][2] = {{1,1},{1,1},{1,1}};
- long data2_4b[3][2] = {{1,1},{3,4},{5,6}};
- /* Test 2.5 */
- float data2_5a[3][2] = {{1,1},{1,1},{1,1}};
- float data2_5b[3][2] = {{1,1},{3,4},{5,6}};
- /* Test 2.6 */
- double data2_6a[3][2] = {{1,1},{1,1},{1,1}};
- double data2_6b[3][2] = {{1,1},{3,4},{5,6}};
+ file1.h6 file2.h6
+/*
/*-------------------------------------------------------------------------
- * Create two files
+ * Basic review tests
*-------------------------------------------------------------------------
*/
-
- /* Create a file */
- file1_id = H5Fcreate ("h5diff_test1.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* Create a file */
- file2_id = H5Fcreate ("h5diff_test2.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+int do_test_1(const char *file1, const char *file2)
+{
+
+ hid_t file1_id, file2_id;
+ hid_t group1_id, group2_id, group3_id;
+ herr_t status;
+ hsize_t dims[2] = { 3,2 };
+
+ /* Test */
+ double data1[3][2] = {{1,1},{1,1},{1,1}};
+ double data2[3][2] = {{1,1.1},{1.01,1.001},{1.0001,1.000000001}};
+ double data3[3][2] = {{100,110},{100,100},{100,100}};
+ double data4[3][2] = {{110,100},{90,80},{140,200}};
/*-------------------------------------------------------------------------
- * Test 1.1
- * Objects are not the same type (e.g try to compare a group with a dataset)
+ * Create two files
*-------------------------------------------------------------------------
*/
+
+ file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file2_id = H5Fcreate (file2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* Create a data space */
- space_id = H5Screate_simple(1,dims1,NULL);
+ /* Create groups */
+ group1_id = H5Gcreate(file1_id, "g1", 0);
+ group2_id = H5Gcreate(file2_id, "g1", 0);
+ group3_id = H5Gcreate(file2_id, "g2", 0);
- /* Create a dataset "dset1.1" */
- dataset_id = H5Dcreate(file1_id,"dset1.1",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
+ write_dataset(group1_id,2,dims,"dset1",H5T_NATIVE_DOUBLE,data1);
+ write_dataset(group2_id,2,dims,"dset2",H5T_NATIVE_DOUBLE,data2);
+ write_dataset(group1_id,2,dims,"dset3",H5T_NATIVE_DOUBLE,data3);
+ write_dataset(group2_id,2,dims,"dset4",H5T_NATIVE_DOUBLE,data4);
+ write_dataset(group2_id,2,dims,"dset1",H5T_NATIVE_DOUBLE,data2);
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
+/*-------------------------------------------------------------------------
+ * Close
+ *-------------------------------------------------------------------------
+ */
+ status = H5Gclose(group1_id);
+ status = H5Gclose(group2_id);
+ status = H5Gclose(group3_id);
+ status = H5Fclose(file1_id);
+ status = H5Fclose(file2_id);
+ return status;
+}
- /* Create a group "g1.1" on file2 */
- group_id = H5Gcreate(file2_id, "g1.1", 0);
+/*-------------------------------------------------------------------------
+ * Compare different types: H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK
+ *-------------------------------------------------------------------------
+ */
- /* Close */
- status = H5Gclose(group_id);
+int do_test_2(const char *file1, const char *file2)
+{
+
+ hid_t file1_id;
+ hid_t group_id;
+ hid_t type_id;
+ herr_t status;
+ hsize_t dims[1]={1};
+ /* Compound datatype */
+ typedef struct s_t
+ {
+ int a;
+ float b;
+ } s_t;
/*-------------------------------------------------------------------------
- * Test 1.2
- * Objects are of classes H5G_TYPE and H5G_GROUP and their name is supplied
+ * Create one file
*-------------------------------------------------------------------------
*/
+ file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* Create a group "g1.1" on file1 */
- group_id = H5Gcreate(file1_id, "g1.1", 0);
+/*-------------------------------------------------------------------------
+ * H5G_DATASET
+ *-------------------------------------------------------------------------
+ */
+ write_dataset(file1_id,1,dims,"dset",H5T_NATIVE_INT,0);
- /* Close */
+/*-------------------------------------------------------------------------
+ * H5G_GROUP
+ *-------------------------------------------------------------------------
+ */
+ group_id = H5Gcreate(file1_id, "group", 0);
status = H5Gclose(group_id);
- /* Create a memory compound datatype on file1 */
+/*-------------------------------------------------------------------------
+ * H5G_TYPE
+ *-------------------------------------------------------------------------
+ */
+
+ /* Create a memory compound datatype */
type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_INT);
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_FLOAT);
/* Commit compound datatype and close it */
- H5Tcommit(file1_id, "compound", type_id);
- type2_id = H5Tcopy(type_id);
- H5Tcommit(file2_id, "compound", type2_id);
+ H5Tcommit(file1_id, "type", type_id);
H5Tclose(type_id);
- H5Tclose(type2_id);
- /* Create a memory enum datatype on file1 */
- type_id = H5Tcreate(H5T_ENUM, sizeof(e_t));
- H5Tenum_insert(type_id, "RED", (val = 0, &val));
- H5Tenum_insert(type_id, "GREEN", (val = 1, &val));
- type2_id = H5Tcopy(type_id);
-
- /* Commit enumeration datatype and close it */
- H5Tcommit(file1_id, "enum", type_id);
- H5Tcommit(file2_id, "enum", type2_id);
- H5Tclose(type_id);
- H5Tclose(type2_id);
-
/*-------------------------------------------------------------------------
- * Test 1.2.3
- * Links
+ * H5G_LINK
*-------------------------------------------------------------------------
*/
- /* Create a symbolic link */
- status = H5Glink(file1_id, H5G_LINK_SOFT, "dset1.1", "soft");
+ status = H5Glink(file1_id, H5G_LINK_SOFT, "dset", "link");
+
+/*-------------------------------------------------------------------------
+ * Close
+ *-------------------------------------------------------------------------
+ */
+ status = H5Fclose(file1_id);
+ return status;
+}
+
+
+
/*-------------------------------------------------------------------------
- * Tests 1.3.
* Check for non supported classes. Supported classes are H5T_INTEGER and H5T_FLOAT
* Non supported classes are
* H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_COMPOUND, H5T_REFERENCE,
@@ -527,54 +448,68 @@ int do_test_files(void)
*-------------------------------------------------------------------------
*/
+int do_test_3(const char *file1, const char *file2)
+{
+
+ hid_t file1_id;
+ hid_t dataset_id;
+ hid_t space_id;
+ hid_t type_id;
+ hsize_t dims[1]={1};
+ herr_t status;
+ int val;
+
+ /* Compound datatype */
+ typedef struct s_t
+ {
+ int a;
+ float b;
+ } s_t;
+
+ typedef enum
+ {
+ E_RED,
+ E_GREEN
+} e_t;
+
/*-------------------------------------------------------------------------
- * Test 1.3.1
- * H5T_STRING
+ * Create a file
*-------------------------------------------------------------------------
*/
+ file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /* Create a data space */
+/*-------------------------------------------------------------------------
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
space_id = H5Screate(H5S_SCALAR);
-
- /* Make a string type */
type_id = H5Tcopy(H5T_C_S1);
- status = H5Tset_size (type_id, strlen(data1_3));
-
- /* Create a dataset "dset1.3" on file 1 */
- dataset_id = H5Dcreate(file1_id,"dset1.3.1",type_id,space_id,H5P_DEFAULT);
-
- /* Write the data */
- status = H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,data1_3);
-
- /* Close */
+ dataset_id = H5Dcreate(file1_id,"string",type_id,space_id,H5P_DEFAULT);
status = H5Dclose(dataset_id);
status = H5Sclose(space_id);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
- * Test 1.3.2
* H5T_BITFIELD
*-------------------------------------------------------------------------
*/
type_id = H5Tcopy(H5T_STD_B8LE);
- write_dataset(file1_id,1,dims1,"dset1.3.2",type_id,data1_3_2);
+ write_dataset(file1_id,1,dims,"bitfield",type_id,0);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
- * Test 1.3.3
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
type_id = H5Tcreate(H5T_OPAQUE, 1);
status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */
- write_dataset(file1_id,1,dims1,"dset1.3.3",type_id,data1_3_2);
+ write_dataset(file1_id,1,dims,"opaque",type_id,0);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
- * Test 1.3.4
* H5T_COMPOUND
*-------------------------------------------------------------------------
*/
@@ -582,314 +517,209 @@ int do_test_files(void)
type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_INT);
H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_FLOAT);
- write_dataset(file1_id,1,dims1,"dset1.3.4",type_id,0);
+ write_dataset(file1_id,1,dims,"compound",type_id,0);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
- * Test 1.3.5
* H5T_REFERENCE
*-------------------------------------------------------------------------
*/
-
- write_dataset(file1_id,1,dims1,"dset1.3.5",H5T_STD_REF_OBJ,0);
-
+ write_dataset(file1_id,1,dims,"ref",H5T_STD_REF_OBJ,0);
/*-------------------------------------------------------------------------
- * Test 1.3.6
* H5T_ENUM
*-------------------------------------------------------------------------
*/
-
type_id = H5Tcreate(H5T_ENUM, sizeof(e_t));
H5Tenum_insert(type_id, "RED", (val = 0, &val));
H5Tenum_insert(type_id, "GREEN", (val = 1, &val));
- write_dataset(file1_id,1,dims1,"dset1.3.6",type_id,0);
+ write_dataset(file1_id,1,dims,"enum",type_id,0);
status = H5Tclose(type_id);
/*-------------------------------------------------------------------------
- * Test 1.3.7
* H5T_VLEN
*-------------------------------------------------------------------------
*/
-
type_id = H5Tvlen_create(H5T_NATIVE_INT);
- write_dataset(file1_id,1,dims1,"dset1.3.7",type_id,0);
+ write_dataset(file1_id,1,dims,"vlen",type_id,0);
status = H5Tclose(type_id);
-
/*-------------------------------------------------------------------------
- * Test 1.3.8
* H5T_ARRAY
*-------------------------------------------------------------------------
*/
-
- type_id = H5Tarray_create(H5T_NATIVE_INT,1,dims1,NULL);
- write_dataset(file1_id,1,dims1,"dset1.3.8",type_id,0);
+ type_id = H5Tarray_create(H5T_NATIVE_INT,1,dims,NULL);
+ write_dataset(file1_id,1,dims,"array",type_id,0);
status = H5Tclose(type_id);
-
-
/*-------------------------------------------------------------------------
- * Test 1.4
- * Datasets are not the same class type
- * Write a float dataset and compare with integer "dset1.1"
+ * H5T_INTEGER vs H5T_FLOAT
*-------------------------------------------------------------------------
*/
- write_dataset(file2_id,1,dims1,"dset1.4",H5T_NATIVE_FLOAT,data1_4);
+ write_dataset(file1_id,1,dims,"integer",H5T_NATIVE_INT,0);
+ write_dataset(file1_id,1,dims,"float",H5T_NATIVE_FLOAT,0);
/*-------------------------------------------------------------------------
- * Test 1.5
- * Datasets are not the same rank
+ * Close
*-------------------------------------------------------------------------
*/
+ status = H5Fclose(file1_id);
+ return status;
+}
- write_dataset(file2_id,2,dims2,"dset1.5",H5T_NATIVE_INT,NULL);
/*-------------------------------------------------------------------------
- * Test 1.6
- * Check for the same current dimensions. Only compare if they are the same.
+ * Dimension issues
*-------------------------------------------------------------------------
*/
- write_dataset(file2_id,1,dims1_1,"dset1.6",H5T_NATIVE_INT,NULL);
+int do_test_4(const char *file1, const char *file2)
+{
+
+ hid_t file1_id;
+ hid_t dataset_id;
+ hid_t space_id;
+ hid_t plist_id;
+ herr_t status;
+ hsize_t dims1 [1]={7};
+ hsize_t dims2 [4]={2,2,2,2};
+ hsize_t dims21[4]={2,2,2,3};
/*-------------------------------------------------------------------------
- * Test 1.7
- * Check for the same maximum dimensions. Give a warning if they are different
+ * Create a file
*-------------------------------------------------------------------------
*/
-
- space_id = H5Screate_simple(1,dims1,dims1);
- dataset_id = H5Dcreate(file1_id,"dset1.7",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
- space_id = H5Screate_simple(1,dims1,maxdim);
- plist_id = H5Pcreate(H5P_DATASET_CREATE);
- status = H5Pset_chunk(plist_id,1,dims1);
- dataset_id = H5Dcreate(file2_id,"dset1.7",H5T_NATIVE_INT,space_id,plist_id);
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
+ file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * Test 1.8
- * Check for different storage order. Give a warning if they are different
+ * rank
*-------------------------------------------------------------------------
*/
+ write_dataset(file1_id,1,dims1,"dset1",H5T_NATIVE_INT,NULL);
+ write_dataset(file1_id,4,dims2,"dset2",H5T_NATIVE_INT,NULL);
- write_dataset(file1_id,1,dims1,"dset1.8",H5T_STD_I32BE,0);
- write_dataset(file2_id,1,dims1,"dset1.8",H5T_STD_I32LE,0);
+/*-------------------------------------------------------------------------
+ * current dimensions
+ *-------------------------------------------------------------------------
+ */
+ write_dataset(file1_id,4,dims2,"dset3",H5T_NATIVE_INT,NULL);
+ write_dataset(file1_id,4,dims21,"dset4",H5T_NATIVE_INT,NULL);
/*-------------------------------------------------------------------------
- * Test 1.9
- * Check for H5S_SCALAR dataspace vs simple dataspace with 1 element
+ * Check for the same maximum dimensions. Give a warning if they are different
*-------------------------------------------------------------------------
*/
- space_id = H5Screate(H5S_SCALAR);
- dataset_id = H5Dcreate(file1_id,"dset1.9",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
+ space_id = H5Screate_simple(4,dims2,dims2);
+ dataset_id = H5Dcreate(file1_id,"dset5",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
status = H5Dclose(dataset_id);
status = H5Sclose(space_id);
- space_id = H5Screate_simple(0,dims0,NULL);
- dataset_id = H5Dcreate(file2_id,"dset1.9",H5T_NATIVE_INT,space_id,H5P_DEFAULT);
+ space_id = H5Screate_simple(4,dims2,dims21);
+ plist_id = H5Pcreate(H5P_DATASET_CREATE);
+ status = H5Pset_chunk(plist_id,4,dims2);
+ dataset_id = H5Dcreate(file1_id,"dset6",H5T_NATIVE_INT,space_id,plist_id);
status = H5Dclose(dataset_id);
status = H5Sclose(space_id);
/*-------------------------------------------------------------------------
- * Test 2.1
- * Check H5T_NATIVE_CHAR data
+ * Close
*-------------------------------------------------------------------------
*/
+ status = H5Fclose(file1_id);
+ return status;
+}
- write_dataset(file1_id,2,dims2,"dset2.1a",H5T_NATIVE_CHAR,data2_1a);
- write_dataset(file2_id,2,dims2,"dset2.1b",H5T_NATIVE_CHAR,data2_1b);
-/*-------------------------------------------------------------------------
- * Test 2.2
- * Check H5T_NATIVE_SHORT data
- *-------------------------------------------------------------------------
- */
- write_dataset(file1_id,2,dims2,"dset2.2a",H5T_NATIVE_SHORT,data2_2a);
- write_dataset(file2_id,2,dims2,"dset2.2b",H5T_NATIVE_SHORT,data2_2b);
/*-------------------------------------------------------------------------
- * Test 2.3
- * Check H5T_NATIVE_INT data
+ * Datasets datatypes
*-------------------------------------------------------------------------
*/
- write_dataset(file1_id,2,dims2,"dset2.3a",H5T_NATIVE_INT,data2_3a);
- write_dataset(file2_id,2,dims2,"dset2.3b",H5T_NATIVE_INT,data2_3b);
+int do_test_5(const char *file1, const char *file2)
+{
-/*-------------------------------------------------------------------------
- * Test 2.4
- * Check H5T_NATIVE_LONG data
- *-------------------------------------------------------------------------
- */
+ hid_t file1_id;
+ hsize_t dims[2]={3,2};
+ herr_t status;
+ char buf1a[3][2] = {{1,1},{1,1},{1,1}};
+ char buf1b[3][2] = {{1,1},{3,4},{5,6}};
+ short buf2a[3][2] = {{1,1},{1,1},{1,1}};
+ short buf2b[3][2] = {{1,1},{3,4},{5,6}};
+ int buf3a[3][2] = {{1,1},{1,1},{1,1}};
+ int buf3b[3][2] = {{1,1},{3,4},{5,6}};
+ long buf4a[3][2] = {{1,1},{1,1},{1,1}};
+ long buf4b[3][2] = {{1,1},{3,4},{5,6}};
+ float buf5a[3][2] = {{1,1},{1,1},{1,1}};
+ float buf5b[3][2] = {{1,1},{3,4},{5,6}};
+ double buf6a[3][2] = {{1,1},{1,1},{1,1}};
+ double buf6b[3][2] = {{1,1},{3,4},{5,6}};
- write_dataset(file1_id,2,dims2,"dset2.4a",H5T_NATIVE_LONG,data2_4a);
- write_dataset(file2_id,2,dims2,"dset2.4b",H5T_NATIVE_LONG,data2_4b);
/*-------------------------------------------------------------------------
- * Test 2.5
- * Check H5T_NATIVE_FLOAT data
+ * Create a file
*-------------------------------------------------------------------------
*/
-
- write_dataset(file1_id,2,dims2,"dset2.5a",H5T_NATIVE_FLOAT,data2_5a);
- write_dataset(file2_id,2,dims2,"dset2.5b",H5T_NATIVE_FLOAT,data2_5b);
+ file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * Test 2.4
- * Check H5T_NATIVE_DOUBLE data
+ * Check for different storage order. Give a warning if they are different
*-------------------------------------------------------------------------
*/
- write_dataset(file1_id,2,dims2,"dset2.6a",H5T_NATIVE_DOUBLE,data2_6a);
- write_dataset(file2_id,2,dims2,"dset2.6b",H5T_NATIVE_DOUBLE,data2_6b);
-
-
-
-
+ write_dataset(file1_id,2,dims,"dset0a",H5T_STD_I16LE,buf2a);
+ write_dataset(file1_id,2,dims,"dset0b",H5T_STD_I32LE,buf3b);
+
/*-------------------------------------------------------------------------
- * Create two files
+ * Check H5T_NATIVE_CHAR
*-------------------------------------------------------------------------
*/
-
- /* Create a file */
- file3_id = H5Fcreate ("h5diff_test3.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
- /* Create a file */
- file4_id = H5Fcreate ("h5diff_test4.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ write_dataset(file1_id,2,dims,"dset1a",H5T_NATIVE_CHAR,buf1a);
+ write_dataset(file1_id,2,dims,"dset1b",H5T_NATIVE_CHAR,buf1b);
/*-------------------------------------------------------------------------
- * Test 3.0
- * Check for different objects
+ * Check H5T_NATIVE_SHORT
*-------------------------------------------------------------------------
*/
-
- write_dataset(file3_id,1,dims1_1,"dset_A",H5T_NATIVE_INT,0);
- write_dataset(file4_id,1,dims1_1,"dset_A",H5T_NATIVE_INT,0);
- write_dataset(file3_id,1,dims1_1,"dset_B",H5T_NATIVE_INT,0);
- write_dataset(file4_id,1,dims1_1,"dset_C",H5T_NATIVE_INT,0);
-
+ write_dataset(file1_id,2,dims,"dset2a",H5T_NATIVE_SHORT,buf2a);
+ write_dataset(file1_id,2,dims,"dset2b",H5T_NATIVE_SHORT,buf2b);
/*-------------------------------------------------------------------------
- * Create two files for path tests
+ * Check H5T_NATIVE_INT
*-------------------------------------------------------------------------
*/
-
- /* Create a file */
- file5_id = H5Fcreate ("h5diff_test5.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
- /* Create a file */
- file6_id = H5Fcreate ("h5diff_test6.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ write_dataset(file1_id,2,dims,"dset3a",H5T_NATIVE_INT,buf3a);
+ write_dataset(file1_id,2,dims,"dset3b",H5T_NATIVE_INT,buf3b);
/*-------------------------------------------------------------------------
- * Test 4.1.x
- * Check for different paths
+ * Check H5T_NATIVE_LONG
*-------------------------------------------------------------------------
*/
-
- /* Create "g1/dset1" */
- group_id = H5Gcreate(file5_id, "g1", 0);
- write_dataset(group_id,1,dims1_1,"dset1",H5T_NATIVE_INT,0);
- status = H5Gclose(group_id);
-
- /* Create "g2/dset1" */
- group_id = H5Gcreate(file6_id, "g2", 0);
- write_dataset(group_id,1,dims1_1,"dset1",H5T_NATIVE_INT,0);
- status = H5Gclose(group_id);
+ write_dataset(file1_id,2,dims,"dset4a",H5T_NATIVE_LONG,buf4a);
+ write_dataset(file1_id,2,dims,"dset4b",H5T_NATIVE_LONG,buf4b);
/*-------------------------------------------------------------------------
- * Test 4.2.x
- * paths with several components
+ * Check H5T_NATIVE_FLOAT
*-------------------------------------------------------------------------
*/
+ write_dataset(file1_id,2,dims,"dset5a",H5T_NATIVE_FLOAT,buf5a);
+ write_dataset(file1_id,2,dims,"dset5b",H5T_NATIVE_FLOAT,buf5b);
- /* Create "/a/b/c" */
- group_id = H5Gcreate(file5_id, "a", 0);
- group2_id = H5Gcreate(group_id, "b", 0);
- write_dataset(group2_id,1,dims1_1,"c",H5T_NATIVE_INT,0);
- status = H5Gclose(group_id);
- status = H5Gclose(group2_id);
-
- /* Create "/a/b/c" */
- group_id = H5Gcreate(file6_id, "a", 0);
- group2_id = H5Gcreate(group_id, "b", 0);
- write_dataset(group2_id,1,dims1_1,"c",H5T_NATIVE_INT,0);
- status = H5Gclose(group_id);
- status = H5Gclose(group2_id);
-
- /* Create "/x/a/c" */
- group_id = H5Gcreate(file5_id, "x", 0);
- group2_id = H5Gcreate(group_id, "a", 0);
- write_dataset(group2_id,1,dims1_1,"c",H5T_NATIVE_INT,0);
- status = H5Gclose(group_id);
- status = H5Gclose(group2_id);
-
-
-
-
/*-------------------------------------------------------------------------
- * Close files
+ * Check H5T_NATIVE_DOUBLE
*-------------------------------------------------------------------------
*/
- status = H5Fclose(file1_id);
- status = H5Fclose(file2_id);
- status = H5Fclose(file3_id);
- status = H5Fclose(file4_id);
- status = H5Fclose(file5_id);
- status = H5Fclose(file6_id);
-
-
- return 0;
-
-}
+ write_dataset(file1_id,2,dims,"dset6a",H5T_NATIVE_DOUBLE,buf6a);
+ write_dataset(file1_id,2,dims,"dset6b",H5T_NATIVE_DOUBLE,buf6b);
/*-------------------------------------------------------------------------
- * Function: write_dataset
- *
- * Purpose: utility function to write a dataset
- *
- * Return:
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: April 7, 2003
- *
+ * Close
*-------------------------------------------------------------------------
*/
-
-int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
- hid_t type_id, void *data )
-{
- hid_t dataset_id;
- hid_t space_id;
- herr_t status;
-
- /* Create a data space */
- space_id = H5Screate_simple(rank,dims,NULL);
-
- /* Create a dataset */
- dataset_id = H5Dcreate(loc_id,dset_name,type_id,space_id,H5P_DEFAULT);
-
- /* Write the data */
- if ( data )
- status = H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,data);
-
- /* Close */
- status = H5Dclose(dataset_id);
- status = H5Sclose(space_id);
-
- return 0;
-
+ status = H5Fclose(file1_id);
+ return status;
}
-
-
-
-
-
diff --git a/tools/h5diff/h5trav.c b/tools/h5diff/h5trav.c
index 9096f34..29171f9 100644
--- a/tools/h5diff/h5trav.c
+++ b/tools/h5diff/h5trav.c
@@ -37,11 +37,7 @@ int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info
herr_t get_nobjects( hid_t loc_id, const char *group_name );
herr_t get_name_type( hid_t loc_id, const char *group_name, int idx, char **name, int *type );
-/* table methods */
-void table_init( table_t **table );
-void table_free( table_t *table );
-int table_search(unsigned long *objno, table_t *table );
-void table_add(unsigned long *objno, char *objname, table_t *table );
+
/*-------------------------------------------------------------------------
@@ -296,7 +292,7 @@ int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info
if (statbuf.nlink > 0 && table_search(statbuf.objno, table ) == FAIL)
{
/* add object to table */
- table_add(statbuf.objno, path, table );
+ table_add(statbuf.objno, path, H5G_GROUP, table );
/* recurse with the absolute name */
inserted_objs += traverse( loc_id, path, table, info, idx );
@@ -336,8 +332,7 @@ int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info
if (statbuf.nlink > 0 && table_search(statbuf.objno, table ) == FAIL)
{
/* add object to table */
- table_add(statbuf.objno, path, table );
-
+ table_add(statbuf.objno, path, H5G_DATASET, table );
}
/* search table
@@ -375,8 +370,7 @@ int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info
if (statbuf.nlink > 0 && table_search(statbuf.objno, table ) == FAIL)
{
/* add object to table */
- table_add(statbuf.objno, path, table );
-
+ table_add(statbuf.objno, path, H5G_TYPE, table );
}
break;
@@ -468,7 +462,7 @@ int table_search(unsigned long *objno, table_t *table )
*-------------------------------------------------------------------------
*/
-void table_add(unsigned long *objno, char *objname, table_t *table)
+void table_add(unsigned long *objno, char *objname, int type, table_t *table)
{
int i;
@@ -479,7 +473,7 @@ void table_add(unsigned long *objno, char *objname, table_t *table)
for (i = table->nobjs; i < table->size; i++) {
table->objs[i].objno[0] = table->objs[i].objno[1] = 0;
table->objs[i].displayed = 0;
- table->objs[i].recorded = 0;
+ table->objs[i].type = H5G_UNKNOWN;
table->objs[i].objname = NULL;
}
}
@@ -489,8 +483,7 @@ void table_add(unsigned long *objno, char *objname, table_t *table)
table->objs[i].objno[1] = objno[1];
free(table->objs[i].objname);
table->objs[i].objname = (char *)HDstrdup(objname);
-
-
+ table->objs[i].type = type;
}
@@ -524,7 +517,7 @@ void table_init( table_t **tbl )
for (i = 0; i < table->size; i++) {
table->objs[i].objno[0] = table->objs[i].objno[1] = 0;
table->objs[i].displayed = 0;
- table->objs[i].recorded = 0;
+ table->objs[i].type = H5G_UNKNOWN;
table->objs[i].objname = NULL;
}
@@ -536,7 +529,7 @@ void table_init( table_t **tbl )
/*-------------------------------------------------------------------------
* Function: table_free
*
- * Purpose:
+ * Purpose: free table memory
*
* Return:
*
@@ -553,7 +546,6 @@ void table_init( table_t **tbl )
void table_free( table_t *table )
{
-
int i;
for ( i = 0; i < table->nobjs; i++)
@@ -563,3 +555,28 @@ void table_free( table_t *table )
free(table);
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: info_free
+ *
+ * Purpose: free info memory
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void info_free( info_t *info, int nobjs )
+{
+ int i;
+ if ( info )
+ {
+ for ( i = 0; i < nobjs; i++)
+ {
+ if (info[i].name)
+ free( info[i].name );
+ }
+ free(info);
+ }
+
+}
+
diff --git a/tools/h5diff/h5trav.h b/tools/h5diff/h5trav.h
index 9e18129..d2e057b 100644
--- a/tools/h5diff/h5trav.h
+++ b/tools/h5diff/h5trav.h
@@ -32,17 +32,12 @@ typedef struct info_t {
} info_t;
-/* public methods */
-int H5get_object_info( hid_t file_id, info_t *info );
-
-
-
/*struct to store basic info about an object */
typedef struct obj_t {
unsigned long objno[2];
char *objname;
int displayed;
- int recorded;
+ int type;
} obj_t;
/*struct that stores all objects, excluding shared objects */
@@ -53,6 +48,19 @@ typedef struct table_t {
} table_t;
+/* public methods */
+int H5get_object_info( hid_t file_id, info_t *info );
+
+/* table methods */
+void table_init(table_t **table);
+void table_free(table_t *table);
+int table_search(unsigned long *objno, table_t *table );
+void table_add(unsigned long *objno, char *objname, int type, table_t *table);
+void info_free(info_t *info, int nobjs);
+
+
+
+
#ifdef __cplusplus
}
#endif
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 4761595..902dca8 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -90,350 +90,244 @@ TOOLTEST() {
##############################################################################
##############################################################################
-##############################################################################
-# tests 0., Check for individual options
-##############################################################################
-
-# test 0.1: Check if the command line number of arguments is less than 3
-TOOLTEST h5diff_01.txt h5diff_test1.h5
-
-# test 0.2: Check for invalid options
-TOOLTEST h5diff_02.txt -x h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.3.1: Check for -h option
-TOOLTEST h5diff_031.txt -h h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.3.3: Check for -r option
-TOOLTEST h5diff_033.txt -r h5diff_test1.h5 h5diff_test2.h5
-
-##############################################################################
-# Test -d option
-##############################################################################
-
-
-# test 0.4.1: no value
-TOOLTEST h5diff_041.txt -d h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.4.2: negative value
-TOOLTEST h5diff_042.txt -d -4 h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.4.3: zero
-TOOLTEST h5diff_043.txt -d 0 h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.4.4: non number
-TOOLTEST h5diff_044.txt -d u h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.4.5: hexadecimal
-TOOLTEST h5diff_045.txt -d 0x1 h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.4.6: string
-TOOLTEST h5diff_046.txt -d "1" h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.4.7: repeated value
-TOOLTEST h5diff_047.txt -d 1 -d 2 h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.4.8: number larger than biggest difference
-TOOLTEST h5diff_048.txt dset2.1a dset2.1b -d 7 h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.4.9: number smaller than smallest difference
-TOOLTEST h5diff_049.txt dset2.1a dset2.1b -d 1 h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.4.10: non-integer
-TOOLTEST h5diff_0410.txt dset2.1a dset2.1b -d 2.3 h5diff_test1.h5 h5diff_test2.h5
-
-##############################################################################
-# Test -p option
-##############################################################################
-
-
-# test 0.5.1: no value
-TOOLTEST h5diff_051.txt -p h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.5.2: negative value
-TOOLTEST h5diff_052.txt -p -4 h5diff_test1.h5 h5diff_test2.h5
-
-# test 0.5.3: zero
-TOOLTEST h5diff_053.txt -p 0 h5diff_test1.h5 h5diff_test2.h5
+# ##############################################################################
+# # Common usage
+# ##############################################################################
-# test 0.5.4: non number
-TOOLTEST h5diff_054.txt -p u h5diff_test1.h5 h5diff_test2.h5
-# test 0.5.5: hexadecimal
-TOOLTEST h5diff_055.txt -p 0x1 h5diff_test1.h5 h5diff_test2.h5
+# 1.0
+TOOLTEST h5diff_10.txt -h
-# test 0.5.6: string
-TOOLTEST h5diff_056.txt -p "1" h5diff_test1.h5 h5diff_test2.h5
+# 1.1
+TOOLTEST h5diff_11.txt file6.h5 file6.h5 dset3a dset3b
-# test 0.5.7: repeated value
-TOOLTEST h5diff_057.txt -p 1 -p 2 h5diff_test1.h5 h5diff_test2.h5
+# 1.2
+TOOLTEST h5diff_12.txt file1.h5 file2.h5 -n 2 g1/dset1 g1/dset2
-# test 0.5.8: number larger than biggest difference
-TOOLTEST h5diff_058.txt dset2.1a dset2.1b -p 7 h5diff_test1.h5 h5diff_test2.h5
+# 1.3
+TOOLTEST h5diff_13.txt file1.h5 file2.h5 -d 5 g1/dset3 g1/dset4
-# test 0.5.9: number smaller than smallest difference
-TOOLTEST h5diff_059.txt dset2.1a dset2.1b -p 1 h5diff_test1.h5 h5diff_test2.h5
+# 1.4
+TOOLTEST h5diff_14.txt file1.h5 file2.h5 -p 0.05 g1/dset3 g1/dset4
-# test 0.5.10: non-integer
-TOOLTEST h5diff_0510.txt dset2.1a dset2.1b -p 2.3 h5diff_test1.h5 h5diff_test2.h5
+# 1.5
+TOOLTEST h5diff_15.txt file1.h5 file2.h5 -r g1/dset1 g1/dset2
-##############################################################################
-# Test -n option
-##############################################################################
+# 1.6
+TOOLTEST h5diff_16.txt file6.h5 file6.h5
+# ##############################################################################
+# # not comparable types
+# ##############################################################################
-# test 0.6.1: no value
-TOOLTEST h5diff_061.txt -n h5diff_test1.h5 h5diff_test2.h5
+# 2.0
+TOOLTEST h5diff_20.txt file3.h5 file3.h5 dset group
-# test 0.6.2: negative value
-TOOLTEST h5diff_062.txt -n -4 h5diff_test1.h5 h5diff_test2.h5
+# 2.1
+TOOLTEST h5diff_21.txt file3.h5 file3.h5 dset link
-# test 0.6.3: zero
-TOOLTEST h5diff_063.txt -n 0 h5diff_test1.h5 h5diff_test2.h5
+# 2.2
+TOOLTEST h5diff_22.txt file3.h5 file3.h5 dset type
-# test 0.6.4: non number
-TOOLTEST h5diff_064.txt -n u h5diff_test1.h5 h5diff_test2.h5
+# 2.3
+TOOLTEST h5diff_23.txt file3.h5 file3.h5 group group
-# test 0.6.5: hexadecimal
-TOOLTEST h5diff_065.txt -n 0x1 h5diff_test1.h5 h5diff_test2.h5
+# 2.4
+TOOLTEST h5diff_24.txt file3.h5 file3.h5 type type
-# test 0.6.6: string
-TOOLTEST h5diff_066.txt -n "1" h5diff_test1.h5 h5diff_test2.h5
+# 2.5
+TOOLTEST h5diff_25.txt file3.h5 file3.h5 link link
-# test 0.6.7: repeated value
-TOOLTEST h5diff_067.txt -n 1 -n 2 h5diff_test1.h5 h5diff_test2.h5
+# ##############################################################################
+# # Class issues
+# ##############################################################################
-# test 0.6.8: number larger than biggest difference
-TOOLTEST h5diff_068.txt dset2.1a dset2.1b -n 7 h5diff_test1.h5 h5diff_test2.h5
-# test 0.6.9: number smaller than smallest difference
-TOOLTEST h5diff_069.txt dset2.1a dset2.1b -n 1 h5diff_test1.h5 h5diff_test2.h5
+# 3.0
+TOOLTEST h5diff_30.txt file4.h5 file4.h5 string
-# test 0.6.10: non-integer
-TOOLTEST h5diff_0610.txt dset2.1a dset2.1b -n 2.3 h5diff_test1.h5 h5diff_test2.h5
+# 3.1
+TOOLTEST h5diff_31.txt file4.h5 file4.h5 bitfield
-##############################################################################
-# Test valid files
-##############################################################################
+# 3.2
+TOOLTEST h5diff_32.txt file4.h5 file4.h5 opaque
-# test 0.7: Check if the file names supplied are valid files
-TOOLTEST h5diff_07.txt h5diff_test1.h6 h5diff_test2.h6
+# 3.3
+TOOLTEST h5diff_33.txt file4.h5 file4.h5 compound
+# 3.4
+TOOLTEST h5diff_34.txt file4.h5 file4.h5 ref
-##############################################################################
-# Check for not comparable issues
-##############################################################################
+# 3.5
+TOOLTEST h5diff_35.txt file4.h5 file4.h5 enum
-##############################################################################
-# Different types
-##############################################################################
+# 3.6
+TOOLTEST h5diff_36.txt file4.h5 file4.h5 vlen
-# test 1.1.1: Compare a dataset with a group
-TOOLTEST h5diff_111.txt dset1.1 g1.1 h5diff_test1.h5 h5diff_test2.h5
+# 3.7
+TOOLTEST h5diff_37.txt file4.h5 file4.h5 array
-# test 1.1.2 Dataset vs Link
-TOOLTEST h5diff_112.txt dset1.1 soft h5diff_test1.h5 h5diff_test1.h5
+# 3.8
+TOOLTEST h5diff_38.txt file4.h5 file4.h5 integer float
-# test 1.1.3 Dataset vs Named type
-TOOLTEST h5diff_113.txt dset1.1 compound h5diff_test1.h5 h5diff_test1.h5
+# ##############################################################################
+# # Dimensions
+# ##############################################################################
-##############################################################################
-# not comparable types
-##############################################################################
+# 4.0
+TOOLTEST h5diff_40.txt file5.h5 file5.h5 dset1 dset2
-# test 1.2.1: Group vs Group
-TOOLTEST h5diff_121.txt g1.1 g1.1 h5diff_test1.h5 h5diff_test2.h5
+# 4.1
+TOOLTEST h5diff_41.txt file5.h5 file5.h5 dset3 dset4
-# test 1.2.2: Type vs Type
-TOOLTEST h5diff_122.txt compound h5diff_test1.h5 h5diff_test2.h5
+# 4.2
+TOOLTEST h5diff_42.txt file5.h5 file5.h5 dset5 dset6
-# test 1.2.3: Link vs Link
-TOOLTEST h5diff_123.txt soft soft h5diff_test1.h5 h5diff_test1.h5
+# ##############################################################################
+# # Dataset types
+# ##############################################################################
-##############################################################################
-# Class issues
-##############################################################################
+# 5.0
+TOOLTEST h5diff_50.txt file6.h5 file6.h5 dset0a dset0b
-# test 1.3.1: H5T_STRING
-TOOLTEST h5diff_131.txt dset1.3.1 h5diff_test1.h5 h5diff_test1.h5
+# 5.1
+TOOLTEST h5diff_51.txt file6.h5 file6.h5 dset1a dset1b
-# test 1.3.2: H5T_BITFIELD
-TOOLTEST h5diff_132.txt dset1.3.2 h5diff_test1.h5 h5diff_test1.h5
+# 5.2
+TOOLTEST h5diff_52.txt file6.h5 file6.h5 dset2a dset2b
-# test 1.3.3: H5T_OPAQUE
-TOOLTEST h5diff_133.txt dset1.3.3 h5diff_test1.h5 h5diff_test1.h5
+# 5.3
+TOOLTEST h5diff_53.txt file6.h5 file6.h5 dset3a dset4b
-# test 1.3.4: H5T_COMPOUND
-TOOLTEST h5diff_134.txt dset1.3.4 h5diff_test1.h5 h5diff_test1.h5
+# 5.4
+TOOLTEST h5diff_54.txt file6.h5 file6.h5 dset4a dset4b
-# test 1.3.5: H5T_REFERENCE
-TOOLTEST h5diff_135.txt dset1.3.5 h5diff_test1.h5 h5diff_test1.h5
+# 5.5
+TOOLTEST h5diff_55.txt file6.h5 file6.h5 dset5a dset5b
-# test 1.3.6: H5T_ENUM
-TOOLTEST h5diff_136.txt dset1.3.6 h5diff_test1.h5 h5diff_test1.h5
+# 5.6
+TOOLTEST h5diff_56.txt file6.h5 file6.h5 dset6a dset6b
-# test 1.3.7: H5T_VLEN
-TOOLTEST h5diff_137.txt dset1.3.7 h5diff_test1.h5 h5diff_test1.h5
+# ##############################################################################
+# # Error messages
+# ##############################################################################
-# test 1.3.8: H5T_ARRAY
-TOOLTEST h5diff_138.txt dset1.3.8 h5diff_test1.h5 h5diff_test1.h5
+# 6.0: Check if the command line number of arguments is less than 3
+TOOLTEST h5diff_600.txt file1.h5
-# test 1.4: Compare integer with float
-TOOLTEST h5diff_14.txt dset1.1 dset1.4 h5diff_test1.h5 h5diff_test2.h5
+# 6.1: Check for invalid options
+TOOLTEST h5diff_601.txt file1.h5 file2.h5 -x
-# test 1.5 : Check for the same rank, for datasets
-TOOLTEST h5diff_15.txt dset1.1 dset1.5 h5diff_test1.h5 h5diff_test2.h5
+# ##############################################################################
+# # -d
+# ##############################################################################
-# test 1.6: Check for the same current dimensions. Only compare if they are the same.
-TOOLTEST h5diff_16.txt dset1.1 dset1.6 h5diff_test1.h5 h5diff_test2.h5
+# 6.2: no value
+TOOLTEST h5diff_602.txt file1.h5 file2.h5 -d g1/dset3 g1/dset4
-# test 1.7: Check for the same maximum dimensions. Give a warning if they are different.
-TOOLTEST h5diff_17.txt dset1.7 dset1.7 h5diff_test1.h5 h5diff_test2.h5
+# 6.3: negative value
+TOOLTEST h5diff_603.txt file1.h5 file2.h5 -d -4 g1/dset3 g1/dset4
-# test 1.8: Check for the same storage datatype. Give a warning if they are different.
-TOOLTEST h5diff_18.txt dset1.8 dset1.8 h5diff_test1.h5 h5diff_test2.h5
+# 6.4: zero
+TOOLTEST h5diff_604.txt file1.h5 file2.h5 -d 0 g1/dset3 g1/dset4
+# 6.5: non number
+TOOLTEST h5diff_605.txt file1.h5 file2.h5 -d u g1/dset3 g1/dset4
-##############################################################################
-# tests 2., Different datatype sizes and different mix of options
-##############################################################################
+# 6.6: hexadecimal
+TOOLTEST h5diff_606.txt file1.h5 file2.h5 -d 0x1 g1/dset3 g1/dset4
-##############################################################################
-# H5T_INTEGER size 1 
-##############################################################################
+# 6.7: string
+TOOLTEST h5diff_607.txt file1.h5 file2.h5 -d "1" g1/dset3 g1/dset4
-# test 2.1.0
-TOOLTEST h5diff_210.txt dset2.1 dset2.2 h5diff_test1.h5 h5diff_test2.h5
+# 6.8: repeated option
+TOOLTEST h5diff_608.txt file1.h5 file2.h5 -d 1 -d 2 g1/dset3 g1/dset4
-# test 2.1.1
-TOOLTEST h5diff_211.txt dset2.1 dset2.2 -n 2 h5diff_test1.h5 h5diff_test2.h5
+# 6.9: number larger than biggest difference
+TOOLTEST h5diff_609.txt file1.h5 file2.h5 -d 200 g1/dset3 g1/dset4
-# test 2.1.2
-TOOLTEST h5diff_212.txt dset2.1 dset2.2 -d 3 h5diff_test1.h5 h5diff_test2.h5
+# 6.10: number smaller than smallest difference
+TOOLTEST h5diff_610.txt file1.h5 file2.h5 -d 1 g1/dset3 g1/dset4
-# test 2.1.3
-TOOLTEST h5diff_213.txt dset2.1a dset2.1b -p 3 h5diff_test1.h5 h5diff_test2.h5
-##############################################################################
-# H5T_INTEGER size 2
-##############################################################################
+# ##############################################################################
+# # -p
+# ##############################################################################
-# test 2.2.0
-TOOLTEST h5diff_220.txt dset2.2a dset2.2b h5diff_test1.h5 h5diff_test2.h5
-# test 2.2.1
-TOOLTEST h5diff_221.txt dset2.2a dset2.2b -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.2.2
-TOOLTEST h5diff_222.txt dset2.2a dset2.2b -d 3 h5diff_test1.h5 h5diff_test2.h5
-# test 2.2.3
-TOOLTEST h5diff_223.txt dset2.2a dset2.2b -p 3 h5diff_test1.h5 h5diff_test2.h5
-##############################################################################
-# H5T_INTEGER size 4
-##############################################################################
+# 6.11: no value
+TOOLTEST h5diff_611.txt file1.h5 file2.h5 -p g1/dset3 g1/dset4
-# test 2.3.0
-TOOLTEST h5diff_230.txt dset2.3a dset2.3b h5diff_test1.h5 h5diff_test2.h5
-# test 2.3.1
-TOOLTEST h5diff_231.txt dset2.3a dset2.3b -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.3.2
-TOOLTEST h5diff_232.txt dset2.3a dset2.3b -d 3 h5diff_test1.h5 h5diff_test2.h5
-# test 2.3.3
-TOOLTEST h5diff_233.txt dset2.3a dset2.3b -p 3 h5diff_test1.h5 h5diff_test2.h5
+# 6.12: negative value
+TOOLTEST h5diff_612.txt file1.h5 file2.h5 -p -4 g1/dset3 g1/dset4
-##############################################################################
-# H5T_INTEGER size 8
-##############################################################################
-
-# test 2.4.0
-TOOLTEST h5diff_240.txt dset2.4a dset2.4b h5diff_test1.h5 h5diff_test2.h5
-# test 2.4.1
-TOOLTEST h5diff_241.txt dset2.4a dset2.4b -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.4.2
-TOOLTEST h5diff_242.txt dset2.4a dset2.4b -d 3 h5diff_test1.h5 h5diff_test2.h5
-# test 2.4.3
-TOOLTEST h5diff_243.txt dset2.4a dset2.4b -p 3 h5diff_test1.h5 h5diff_test2.h5
+# 6.13: zero
+TOOLTEST h5diff_613.txt file1.h5 file2.h5 -p 0 g1/dset3 g1/dset4
-##############################################################################
-# H5T_FLOAT size 4
-##############################################################################
+# 6.14: non number
+TOOLTEST h5diff_614.txt file1.h5 file2.h5 -p u g1/dset3 g1/dset4
-# test 2.5.0
-TOOLTEST h5diff_250.txt dset2.5a dset2.5b h5diff_test1.h5 h5diff_test2.h5
-# test 2.5.1
-TOOLTEST h5diff_251.txt dset2.5a dset2.5b -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.5.2
-TOOLTEST h5diff_252.txt dset2.5a dset2.5b -d 3 h5diff_test1.h5 h5diff_test2.h5
-# test 2.5.3
-TOOLTEST h5diff_253.txt dset2.5a dset2.5b -p 3 h5diff_test1.h5 h5diff_test2.h5
+# 6.15: hexadecimal
+TOOLTEST h5diff_615.txt file1.h5 file2.h5 -p 0x1 g1/dset3 g1/dset4
-##############################################################################
-# H5T_FLOAT size 8
-##############################################################################
+# 6.16: string
+TOOLTEST h5diff_616.txt file1.h5 file2.h5 -p "0.21" g1/dset3 g1/dset4
-# test 2.6.0
-TOOLTEST h5diff_260.txt dset2.6a dset2.6b h5diff_test1.h5 h5diff_test2.h5
-# test 2.6.1
-TOOLTEST h5diff_261.txt dset2.6a dset2.6b -n 2 h5diff_test1.h5 h5diff_test2.h5
-# test 2.6.2
-TOOLTEST h5diff_262.txt dset2.6a dset2.6b -d 3 h5diff_test1.h5 h5diff_test2.h5
-# test 2.6.3
-TOOLTEST h5diff_263.txt dset2.6a dset2.6b -p 3 h5diff_test1.h5 h5diff_test2.h5
+# 6.17: repeated option
+TOOLTEST h5diff_617.txt file1.h5 file2.h5 -p 0.21 -p 0.22 g1/dset3 g1/dset4
+# 6.18: number larger than biggest difference
+TOOLTEST h5diff_618.txt file1.h5 file2.h5 -p 2 g1/dset3 g1/dset4
-#######################################################
-# Different combination of objects
-#######################################################
+# 6.19: number smaller than smallest difference
+TOOLTEST h5diff_619.txt file1.h5 file2.h5 -p 0.005 g1/dset3 g1/dset4
-# test 3.0
-TOOLTEST h5diff_30.txt h5diff_test3.h5 h5diff_test4.h5
-# test 3.1
-TOOLTEST h5diff_31.txt dset_A dset_A h5diff_test3.h5 h5diff_test4.h5
-# test 3.2
-TOOLTEST h5diff_32.txt dset_A dset_B h5diff_test3.h5 h5diff_test4.h5
+# ##############################################################################
+# # -n
+# ##############################################################################
-# test 3.3
-TOOLTEST h5diff_33.txt dset_C dset_A h5diff_test3.h5 h5diff_test4.h5
-# test 3.4
-TOOLTEST h5diff_34.txt dset_C dset_C h5diff_test3.h5 h5diff_test4.h5
+# 6.20: no value
+TOOLTEST h5diff_620.txt file1.h5 file2.h5 -n g1/dset3 g1/dset4
-#######################################################
-# reverse direction
-#######################################################
+# 6.21: negative value
+TOOLTEST h5diff_621.txt file1.h5 file2.h5 -n -4 g1/dset3 g1/dset4
-# test 3.5
-TOOLTEST h5diff_35.txt h5diff_test4.h5 h5diff_test3.h5
+# 6.22: zero
+TOOLTEST h5diff_622.txt file1.h5 file2.h5 -n 0 g1/dset3 g1/dset4
-#######################################################
-# Different paths
-#######################################################
+# 6.23: non number
+TOOLTEST h5diff_623.txt file1.h5 file2.h5 -n u g1/dset3 g1/dset4
-# test 4.0: should find
-TOOLTEST h5diff_40.txt g1/dset1 g2/dset1 h5diff_test5.h5 h5diff_test6.h5
+# 6.24: hexadecimal
+TOOLTEST h5diff_624.txt file1.h5 file2.h5 -n 0x1 g1/dset3 g1/dset4
-# test 4.1.1: should NOT find
-TOOLTEST h5diff_411.txt dset1 dset1 h5diff_test5.h5 h5diff_test6.h5
+# 6.25: string
+TOOLTEST h5diff_625.txt file1.h5 file2.h5 -n "2" g1/dset3 g1/dset4
-# test 4.1.2: should NOT find
-TOOLTEST h5diff_412.txt /g1/dset1 dset1 h5diff_test5.h5 h5diff_test6.h5
+# 6.26: repeated option
+TOOLTEST h5diff_626.txt file1.h5 file2.h5 -n 2 -n 3 g1/dset3 g1/dset4
-# test 4.1.3: should NOT find
-TOOLTEST h5diff_413.txt /g1/dset1 /g1/dset1 h5diff_test5.h5 h5diff_test6.h5
+# 6.27: number larger than biggest difference
+TOOLTEST h5diff_627.txt file1.h5 file2.h5 -n 200 g1/dset3 g1/dset4
-#######################################################
-# paths with several components
-#######################################################
+# 6.28: number smaller than smallest difference
+TOOLTEST h5diff_628.txt file1.h5 file2.h5 -n 1 g1/dset3 g1/dset4
-# test 4.2.1:
-TOOLTEST h5diff_421.txt /a/b/c /a/b/c h5diff_test5.h5 h5diff_test6.h5
+# ##############################################################################
+# # non valid files
+# ##############################################################################
-# test 4.2.2:
-TOOLTEST h5diff_422.txt /x/a/c /a/b/c h5diff_test5.h5 h5diff_test6.h5
+TOOLTEST h5diff_629.txt file1.h6 file2.h6
+# ##############################################################################
+# # END
+# ##############################################################################