int main (void) { /* The localeconv replacement breaks printf "%lu" on SunOS 4, so we can't print the seed in tests_rand_start(). Nothing random is used in this program though, so just use the memory tests alone. */ tests_memory_start (); { mpf_t f; char buf[128]; mpf_init (f); decimal_point = ","; mpf_set_d (f, 1.5); gmp_snprintf (buf, sizeof(buf), "%.1Ff", f); mpf_clear (f); if (strcmp (buf, "1,5") != 0) { printf ("Test skipped, replacing localeconv/nl_langinfo doesn't work\n"); goto done; } } check_input (); done: tests_memory_end (); exit (0); }
void tests_end_mpfr (void) { int err = 0; if (mpfr_get_emin () != default_emin) { printf ("Default emin value has not been restored!\n"); err = 1; } if (mpfr_get_emax () != default_emax) { printf ("Default emax value has not been restored!\n"); err = 1; } mpfr_free_cache (); mpfr_free_cache2 (MPFR_FREE_GLOBAL_CACHE); tests_rand_end (); #ifndef MPFR_USE_MINI_GMP tests_memory_end (); #endif #ifdef MPFR_TESTS_DIVBYZERO /* Define to test the use of MPFR_ERRDIVZERO */ if (fetestexcept (FE_DIVBYZERO|FE_INVALID)) { printf ("A floating-point division by 0 or an invalid operation" " occurred!\n"); #ifdef MPFR_ERRDIVZERO /* This should never occur because the purpose of defining MPFR_ERRDIVZERO is to avoid all the FP divisions by 0. */ err = 1; #endif } #endif if (err) exit (err); }
void tests_end (void) { tests_rand_end (); tests_memory_end (); }