diff options
Diffstat (limited to 'test/dt_arith.c')
-rw-r--r-- | test/dt_arith.c | 178 |
1 files changed, 87 insertions, 91 deletions
diff --git a/test/dt_arith.c b/test/dt_arith.c index 0980150..ab89b68 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -403,10 +403,10 @@ static void fpe_handler(int H5_ATTR_UNUSED signo) { SKIPPED(); - HDputs(" Test skipped due to SIGFPE."); + puts(" Test skipped due to SIGFPE."); #ifndef HANDLE_SIGFPE - HDputs(" Remaining tests could not be run."); - HDputs(" Please turn off SIGFPE on overflows and try again."); + puts(" Remaining tests could not be run."); + puts(" Please turn off SIGFPE on overflows and try again."); #endif exit(255); } @@ -953,8 +953,8 @@ test_derived_flt(void) /* Print errors */ if (0 == fails_this_test++) { - HDsnprintf(str, sizeof(str), - "\nTesting random sw derived floating-point -> derived floating-point conversions"); + snprintf(str, sizeof(str), + "\nTesting random sw derived floating-point -> derived floating-point conversions"); printf("%-70s", str); fflush(stdout); H5_FAILED(); @@ -976,7 +976,7 @@ test_derived_flt(void) printf(" %29d\n", *aligned); if (fails_this_test >= max_fails) { - HDputs(" maximum failures reached, aborting test..."); + puts(" maximum failures reached, aborting test..."); goto error; } } @@ -1122,8 +1122,8 @@ test_derived_flt(void) /* Print errors */ if (0 == fails_this_test++) { - HDsnprintf(str, sizeof(str), - "\nTesting random sw derived floating-point -> derived floating-point conversions"); + snprintf(str, sizeof(str), + "\nTesting random sw derived floating-point -> derived floating-point conversions"); printf("%-70s", str); fflush(stdout); H5_FAILED(); @@ -1141,7 +1141,7 @@ test_derived_flt(void) printf("\n"); if (fails_this_test >= max_fails) { - HDputs(" maximum failures reached, aborting test..."); + puts(" maximum failures reached, aborting test..."); goto error; } } @@ -1435,8 +1435,7 @@ test_derived_integer(void) /* Print errors */ if (0 == fails_this_test++) { - HDsnprintf(str, sizeof(str), - "\nTesting random sw derived integer -> derived integer conversions"); + snprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions"); printf("%-70s", str); fflush(stdout); H5_FAILED(); @@ -1454,7 +1453,7 @@ test_derived_integer(void) printf("\n"); if (fails_this_test >= max_fails) { - HDputs(" maximum failures reached, aborting test..."); + puts(" maximum failures reached, aborting test..."); goto error; } } @@ -1664,14 +1663,14 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) /* Sanity checks */ if (OTHER == src_type || OTHER == dst_type) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); printf("%-70s", str); H5_FAILED(); - HDputs(" Unknown data type."); + puts(" Unknown data type."); goto error; } else { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); printf("%-70s", str); fflush(stdout); fails_this_test = 0; @@ -2532,8 +2531,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) } if (++fails_all_tests >= max_fails) { - HDputs(" maximum failures reached, aborting test..."); - HDputs(" (dst is library's conversion output. ans is compiler's conversion output.)"); + puts(" maximum failures reached, aborting test..."); + puts(" (dst is library's conversion output. ans is compiler's conversion output.)"); goto done; } } @@ -2667,26 +2666,26 @@ my_isnan(dtype_t type, void *val) float x = 0.0; memcpy(&x, val, sizeof(float)); - HDsnprintf(s, sizeof(s), "%g", (double)x); + snprintf(s, sizeof(s), "%g", (double)x); } else if (FLT_DOUBLE == type) { double x = 0.0; memcpy(&x, val, sizeof(double)); - HDsnprintf(s, sizeof(s), "%g", x); + snprintf(s, sizeof(s), "%g", x); #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE } else if (FLT_LDOUBLE == type) { long double x = 0.0L; memcpy(&x, val, sizeof(long double)); - HDsnprintf(s, sizeof(s), "%Lg", x); + snprintf(s, sizeof(s), "%Lg", x); #endif } else { return 0; } - if (HDstrstr(s, "NaN") || HDstrstr(s, "NAN") || HDstrstr(s, "nan")) + if (strstr(s, "NaN") || strstr(s, "NAN") || strstr(s, "nan")) retval = 1; } @@ -2786,7 +2785,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) fflush(stdout); fflush(stderr); if ((child_pid = fork()) < 0) { - HDperror("fork"); + perror("fork"); return 1; } else if (child_pid > 0) { @@ -2799,12 +2798,12 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) return WEXITSTATUS(status); } else if (WIFSIGNALED(status)) { - HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status)); - HDputs(str); + snprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status)); + puts(str); return 1; /*child exit after catching non-SIGFPE signal */ } else { - HDputs(" Child didn't exit normally."); + puts(" Child didn't exit normally."); return 1; } } @@ -2857,39 +2856,37 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) /* Sanity checks */ if (sizeof(float) == sizeof(double)) - HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible."); + puts("Sizeof(float)==sizeof(double) - some tests may not be sensible."); if (OTHER == src_type || OTHER == dst_type) { - if (!HDstrcmp(name, "noop")) - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, - dst_type_name); + if (!strcmp(name, "noop")) + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); else if (run_test == TEST_SPECIAL) - HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name, - dst_type_name); + snprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name, + dst_type_name); else if (run_test == TEST_NORMAL) - HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", name, src_type_name, - dst_type_name); + snprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", name, src_type_name, + dst_type_name); else if (run_test == TEST_DENORM) - HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name, - dst_type_name); + snprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name, + dst_type_name); printf("%-70s", str); H5_FAILED(); - HDputs(" Unknown data type."); + puts(" Unknown data type."); goto error; } else { - if (!HDstrcmp(name, "noop")) - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, - dst_type_name); + if (!strcmp(name, "noop")) + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); else if (run_test == TEST_SPECIAL) - HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name, - dst_type_name); + snprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name, + dst_type_name); else if (run_test == TEST_NORMAL) - HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", name, src_type_name, - dst_type_name); + snprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", name, src_type_name, + dst_type_name); else if (run_test == TEST_DENORM) - HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name, - dst_type_name); + snprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name, + dst_type_name); printf("%-70s", str); fflush(stdout); @@ -3244,10 +3241,10 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) * denormalized or special values, print out warning message.*/ if (++fails_all_tests >= max_fails) { if (run_test == TEST_NORMAL) - HDputs(" maximum failures reached, aborting test..."); + puts(" maximum failures reached, aborting test..."); else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL) - HDputs(" maximum warnings reached, aborting test..."); - HDputs(" (dst is library's conversion output. ans is compiler's conversion output.)"); + puts(" maximum warnings reached, aborting test..."); + puts(" (dst is library's conversion output. ans is compiler's conversion output.)"); goto done; } @@ -3496,10 +3493,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) /* Sanity checks */ if (OTHER == src_type || OTHER == dst_type) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); printf("%-70s", str); H5_FAILED(); - HDputs(" Unknown data type."); + puts(" Unknown data type."); goto error; } @@ -3507,10 +3504,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) INT_INT == src_type || INT_UINT == src_type || INT_LONG == src_type || INT_ULONG == src_type || INT_LLONG == src_type || INT_ULLONG == src_type) && (FLT_FLOAT != dst_type && FLT_DOUBLE != dst_type && FLT_LDOUBLE != dst_type)) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); printf("%-70s", str); H5_FAILED(); - HDputs(" 1. Not an integer-float conversion."); + puts(" 1. Not an integer-float conversion."); goto error; } @@ -3518,31 +3515,31 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) (INT_SCHAR != dst_type && INT_UCHAR != dst_type && INT_SHORT != dst_type && INT_USHORT != dst_type && INT_INT != dst_type && INT_UINT != dst_type && INT_LONG != dst_type && INT_ULONG != dst_type && INT_LLONG != dst_type && INT_ULLONG != dst_type)) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); printf("%-70s", str); H5_FAILED(); - HDputs(" 2. Not a float-integer conversion."); + puts(" 2. Not a float-integer conversion."); goto error; } if (INT_SCHAR == src_type || INT_UCHAR == src_type || INT_SHORT == src_type || INT_USHORT == src_type || INT_INT == src_type || INT_UINT == src_type || INT_LONG == src_type || INT_ULONG == src_type || INT_LLONG == src_type || INT_ULLONG == src_type) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); printf("%-70s", str); fflush(stdout); fails_this_test = 0; } else { if (run_test == TEST_NORMAL) - HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", name, src_type_name, - dst_type_name); + snprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", name, src_type_name, + dst_type_name); else if (run_test == TEST_DENORM) - HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name, - dst_type_name); + snprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name, + dst_type_name); else - HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name, - dst_type_name); + snprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name, + dst_type_name); printf("%-70s", str); fflush(stdout); fails_this_test = 0; @@ -4461,10 +4458,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) * denormalized or special values, print out warning message.*/ if (++fails_all_tests >= max_fails) { if (run_test == TEST_NORMAL) - HDputs(" maximum failures reached, aborting test..."); + puts(" maximum failures reached, aborting test..."); else if (run_test == TEST_DENORM || run_test == TEST_SPECIAL) - HDputs(" maximum warnings reached, aborting test..."); - HDputs(" (dst is library's conversion output. ans is compiler's conversion output.)"); + puts(" maximum warnings reached, aborting test..."); + puts(" (dst is library's conversion output. ans is compiler's conversion output.)"); goto done; } @@ -4771,7 +4768,7 @@ run_fp_tests(const char *name) { int nerrors = 0; - if (!HDstrcmp(name, "noop")) { + if (!strcmp(name, "noop")) { nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT); nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE); nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LDOUBLE); @@ -4800,11 +4797,11 @@ run_fp_tests(const char *name) { char str[256]; /*string */ - HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, "long double", - "float"); + snprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, "long double", + "float"); printf("%-70s", str); SKIPPED(); - HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); + puts(" Test skipped due to the conversion problem on IBM ppc64le cpu."); } #endif @@ -4824,11 +4821,11 @@ run_fp_tests(const char *name) { char str[256]; /*string */ - HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", - "float or double"); + snprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", + "float or double"); printf("%-70s", str); SKIPPED(); - HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); + puts(" Test skipped due to the conversion problem on IBM ppc64le cpu."); } #endif #endif @@ -4900,11 +4897,10 @@ run_int_fp_conv(const char *name) { char str[256]; /*string */ - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "(unsigned) long", - "long double"); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "(unsigned) long", "long double"); printf("%-70s", str); SKIPPED(); - HDputs(" Test skipped due to the special algorithm of hardware conversion."); + puts(" Test skipped due to the special algorithm of hardware conversion."); } #endif #endif /* H5_SIZEOF_LONG!=H5_SIZEOF_INT */ @@ -4915,10 +4911,10 @@ run_int_fp_conv(const char *name) { char str[256]; /*hello string */ - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long long", "long double"); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long long", "long double"); printf("%-70s", str); SKIPPED(); - HDputs(" Test skipped due to compiler error in handling conversion."); + puts(" Test skipped due to compiler error in handling conversion."); } #endif /* H5_LLONG_TO_LDOUBLE_CORRECT */ #if H5_LLONG_TO_LDOUBLE_CORRECT @@ -4927,11 +4923,11 @@ run_int_fp_conv(const char *name) { char str[256]; /*hello string */ - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "unsigned long long", - "long double"); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "unsigned long long", + "long double"); printf("%-70s", str); SKIPPED(); - HDputs(" Test skipped due to compiler not handling conversion."); + puts(" Test skipped due to compiler not handling conversion."); } #endif /* H5_LLONG_TO_LDOUBLE_CORRECT */ #endif @@ -4984,7 +4980,7 @@ run_fp_int_conv(const char *name) #endif #if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG - if (!HDstrcmp(name, "hw")) { /* Hardware conversion */ + if (!strcmp(name, "hw")) { /* Hardware conversion */ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG); } @@ -5016,11 +5012,11 @@ run_fp_int_conv(const char *name) #else char str[256]; /*string */ - HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", - "signed and unsigned char, short, int, long"); + snprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", + "signed and unsigned char, short, int, long"); printf("%-70s", str); SKIPPED(); - HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); + puts(" Test skipped due to the conversion problem on IBM ppc64le cpu."); #endif } #if H5_SIZEOF_LONG != H5_SIZEOF_INT @@ -5039,11 +5035,11 @@ run_fp_int_conv(const char *name) { char str[256]; /*string */ - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", - "(unsigned) long"); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", + "(unsigned) long"); printf("%-70s", str); SKIPPED(); - HDputs(" Test skipped due to the special algorithm of hardware conversion."); + puts(" Test skipped due to the special algorithm of hardware conversion."); } #endif #endif /*H5_SIZEOF_LONG!=H5_SIZEOF_INT */ @@ -5055,10 +5051,10 @@ run_fp_int_conv(const char *name) { char str[256]; /*string */ - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "long long"); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "long long"); printf("%-70s", str); SKIPPED(); - HDputs(" Test skipped due to hardware conversion error."); + puts(" Test skipped due to hardware conversion error."); } #endif /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ #if defined(H5_LDOUBLE_TO_LLONG_ACCURATE) @@ -5067,11 +5063,11 @@ run_fp_int_conv(const char *name) { char str[256]; /*string */ - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", - "unsigned long long"); + snprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", + "unsigned long long"); printf("%-70s", str); SKIPPED(); - HDputs(" Test skipped due to hardware conversion error."); + puts(" Test skipped due to hardware conversion error."); } #endif /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ #endif |