HDF: hdf/test/tutils.h File Reference

Please, help us to better serve our user community by answering the following short survey: https://www.hdfgroup.org/website-survey/

| HDF 4.4.0 API Reference |

Loading...
Searching...
No Matches
tutils.h File Reference
`#include <float.h>`
`#include <math.h>`
`#include "hdf_priv.h"`

## Macros
#define | CHECK(ret, val, where)
#define | CHECK_CONT(ret, val, where)
#define | CHECK_STATUS(status, val, msg)
#define | CHECK_ALLOC(buffer, buf_name, func_name)
#define | VERIFY(val, x, where)
#define | VERIFY_CONT(val, x, where)
#define | VERIFY_CHAR(val, x, where)
#define | RESULT(a)
#define | ENDACCESS(aid, msg)
#define | ENDANNO(ann_handle, msg)
#define | ENDAN(an_handle, msg)
#define | ENDRI(riid, msg)
#define | ENDGR(grid, msg)
#define | MESSAGE(v, a)
#define | VERBOSITY_STR "Verbosity"
#define | SKIP_STR "Skip"
#define | TEST_STR "Test"
#define | CLEAN_STR "Cleanup"
#define | H4_PASSED()
#define | H4_FAILED()
#define | H4_WARNING()
#define | H4_SKIPPED()
#define | H4_FLT_ABS_EQUAL(X, Y)
#define | H4_DBL_ABS_EQUAL(X, Y)
#define | H4_LDBL_ABS_EQUAL(X, Y)
#define | JPEG_FUZZ 1
#define | ABS(x)
#define | CLEAN_CMD "rm -f *.hdf"

## Functions
const char * | get_srcdir (void)
const char * | get_srcdir_filename (const char *filename)
int | fuzzy_memcmp (const void *s1, const void *s2, int32 len, int fuzz_factor)
void | print_mismatched (const void *s1, const void *s2, int32 size2cmp)
int | comp_using_jpeglib (const char *filename, long *file_offset, int im_height, int im_width, int im_ncomps, int quality, uint8 *written_buffer)
int | decomp_using_jpeglib (const char *filename, long file_offset, int im_height, int im_width, int im_ncomps, uint8 *read_buffer)

## Variables
int | num_errs
int | Verbosity

## Macro Definition Documentation

## ◆ ABS

#define ABS | ( |  | x | ) |

Value:
((int)(x) < 0 ? (-x) : x)

## ◆ CHECK

#define CHECK | ( |  | ret,
|  |  | val,
|  |  | where )

Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s returned %ld \n", where, (int)__LINE__, \
__FILE__, (long)ret); \
if (ret == val) { \
printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, \
(int)__LINE__, __FILE__); \
num_errs++; \
goto done; \
} \
} while (0)
val
HDFFCLIBAPI intf _fcd val
Definition mfsdf.h:142
Verbosity
int Verbosity
Definition tutils.h:35
num_errs
int num_errs

## ◆ CHECK_ALLOC

#define CHECK_ALLOC | ( |  | buffer,
|  |  | buf_name,
|  |  | func_name )

Value:
{ \
if (buffer == NULL) { \
fprintf(stderr, "in %s: space allocation for %s failed. Terminated!\n", func_name, buf_name); \
exit(1); \
} \
}
buffer
intf intf intf intf intf void * buffer
Definition hproto_fortran.h:314

## ◆ CHECK_CONT

#define CHECK_CONT | ( |  | ret,
|  |  | val,
|  |  | where )

Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s returned %ld \n", where, (int)__LINE__, \
__FILE__, (long)ret); \
if (ret == val) { \
printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, \
(int)__LINE__, __FILE__); \
num_errs++; \
} \
} while (0)

## ◆ CHECK_STATUS

#define CHECK_STATUS | ( |  | status,
|  |  | val,
|  |  | msg )

Value:
do { \
if (status == val) \
printf(" %s failed at line %4d in %s\n", msg, (int)__LINE__, __FILE__); \
} while (0)

## ◆ CLEAN_CMD

#define CLEAN_CMD "rm -f *.hdf"

## ◆ CLEAN_STR

#define CLEAN_STR "Cleanup"

## ◆ ENDACCESS

#define ENDACCESS | ( |  | aid,
|  |  | msg )

Value:
do { \
ret = Hendaccess(aid); \
aid = FAIL; \
CHECK(ret, FAIL, msg); \
} while (0)
FAIL
#define FAIL
Definition hdf.h:141
Hendaccess
int Hendaccess(int32 access_id)

## ◆ ENDAN

#define ENDAN | ( |  | an_handle,
|  |  | msg )

Value:
do { \
ret = ANend(an_handle); \
an_handle = FAIL; \
CHECK(ret, FAIL, msg); \
} while (0)
ANend
int32 ANend(int32 an_id)

## ◆ ENDANNO

#define ENDANNO | ( |  | ann_handle,
|  |  | msg )

Value:
do { \
ret = ANendaccess(ann_handle); \
ann_handle = FAIL; \
CHECK(ret, FAIL, msg); \
} while (0)
ANendaccess
int ANendaccess(int32 ann_id)

## ◆ ENDGR

#define ENDGR | ( |  | grid,
|  |  | msg )

Value:
do { \
ret = GRend(grid); \
grid = FAIL; \
CHECK(ret, FAIL, msg); \
} while (0)
GRend
int GRend(int32 grid)

## ◆ ENDRI

#define ENDRI | ( |  | riid,
|  |  | msg )

Value:
do { \
ret = GRendaccess(riid); \
riid = FAIL; \
CHECK(ret, FAIL, msg); \
} while (0)
GRendaccess
int GRendaccess(int32 riid)

## ◆ H4_DBL_ABS_EQUAL

#define H4_DBL_ABS_EQUAL | ( |  | X,
|  |  | Y )

Value:
(fabs((X) - (Y)) < DBL_EPSILON)

## ◆ H4_FAILED

#define H4_FAILED | ( |  | ) |

Value:
{ \
puts("*FAILED*"); \
fflush(stdout); \
}

## ◆ H4_FLT_ABS_EQUAL

#define H4_FLT_ABS_EQUAL | ( |  | X,
|  |  | Y )

Value:
(fabsf((X) - (Y)) < FLT_EPSILON)

## ◆ H4_LDBL_ABS_EQUAL

#define H4_LDBL_ABS_EQUAL | ( |  | X,
|  |  | Y )

Value:
(fabsl((X) - (Y)) < LDBL_EPSILON)

## ◆ H4_PASSED

#define H4_PASSED | ( |  | ) |

Value:
{ \
puts(" PASSED"); \
fflush(stdout); \
}

## ◆ H4_SKIPPED

#define H4_SKIPPED | ( |  | ) |

Value:
{ \
puts(" -SKIP-"); \
fflush(stdout); \
}

## ◆ H4_WARNING

#define H4_WARNING | ( |  | ) |

Value:
{ \
puts("*WARNING*"); \
fflush(stdout); \
}

## ◆ JPEG_FUZZ

#define JPEG_FUZZ 1

## ◆ MESSAGE

#define MESSAGE | ( |  | v,
|  |  | a )

Value:
{ \
if (Verbosity >= v) { \
a \
} \
}

## ◆ RESULT

#define RESULT | ( |  | a | ) |

Value:
do { \
if (Verbosity > 8) \
printf(" Call to HDF routine: %15s at line %4d in %s returned %ld \n", a, (int)__LINE__, \
__FILE__, (long)ret); \
if (Verbosity > 9) \
HEprint(stdout, 0); \
if (ret == FAIL) { \
printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", a, (long)ret, (int)__LINE__, \
__FILE__); \
num_errs++; \
goto done; \
} \
} while (0)

## ◆ SKIP_STR

#define SKIP_STR "Skip"

## ◆ TEST_STR

#define TEST_STR "Test"

## ◆ VERBOSITY_STR

#define VERBOSITY_STR "Verbosity"

## ◆ VERIFY

#define VERIFY | ( |  | val,
|  |  | x,
|  |  | where )

Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s had value %ld \n", where, (int)__LINE__, \
__FILE__, (long)x); \
if (x != val) { \
printf("*** UNEXPECTED VALUE from %s is %ld (expected %ld) at line %4d in %s\n", where, \
(long)val, (long)x, (int)__LINE__, __FILE__); \
num_errs++; \
goto done; \
} \
} while (0)

## ◆ VERIFY_CHAR

#define VERIFY_CHAR | ( |  | val,
|  |  | x,
|  |  | where )

Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s had value %s \n", where, (int)__LINE__, \
__FILE__, x); \
if (strncmp(x, val, strlen(x)) != 0) { \
printf("*** UNEXPECTED VALUE from %s is <%s> (expected <%s>) at line %4d in %s\n", where, val, \
x, (int)__LINE__, __FILE__); \
num_errs++; \
goto done; \
} \
} while (0)

## ◆ VERIFY_CONT

#define VERIFY_CONT | ( |  | val,
|  |  | x,
|  |  | where )

Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s had value %ld \n", where, (int)__LINE__, \
__FILE__, (long)x); \
if (x != val) { \
printf("*** UNEXPECTED VALUE from %s is %ld (expected %ld) at line %4d in %s\n", where, \
(long)val, (long)x, (int)__LINE__, __FILE__); \
num_errs++; \
} \
} while (0)

## Function Documentation

## ◆ comp_using_jpeglib()

int comp_using_jpeglib | ( | const char * | filename,
|  | long * | file_offset,
|  | int | im_height,
|  | int | im_width,
|  | int | im_ncomps,
|  | int | quality,
|  | uint8 * | written_buffer )

## ◆ decomp_using_jpeglib()

int decomp_using_jpeglib | ( | const char * | filename,
|  | long | file_offset,
|  | int | im_height,
|  | int | im_width,
|  | int | im_ncomps,
|  | uint8 * | read_buffer )

## ◆ fuzzy_memcmp()

int fuzzy_memcmp | ( | const void * | s1,
|  | const void * | s2,
|  | int32 | len,
|  | int | fuzz_factor )

## ◆ get_srcdir()

const char * get_srcdir | ( | void |  | ) |

## ◆ get_srcdir_filename()

const char * get_srcdir_filename | ( | const char * | filename | ) |

## ◆ print_mismatched()

void print_mismatched | ( | const void * | s1,
|  | const void * | s2,
|  | int32 | size2cmp )

## Variable Documentation

## ◆ num_errs

int num_errs
| extern

## ◆ Verbosity

int Verbosity