int TestTimeouts(int argc, char* argv[]) { struct stat statbuf; BOOL result; HANDLE hComm; if (stat("/dev/ttyS0", &statbuf) < 0) { fprintf(stderr, "/dev/ttyS0 not available, making the test to succeed though\n"); return EXIT_SUCCESS; } result = DefineCommDevice("COM1", "/dev/ttyS0"); if (!result) { fprintf(stderr, "DefineCommDevice failure: 0x%x\n", GetLastError()); return EXIT_FAILURE; } hComm = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (hComm == INVALID_HANDLE_VALUE) { fprintf(stderr, "CreateFileA failure: 0x%x\n", GetLastError()); return EXIT_FAILURE; } _comm_setServerSerialDriver(hComm, SerialDriverSerialSys); if (!test_generic(hComm)) { fprintf(stderr, "test_SerialSys failure\n"); return EXIT_FAILURE; } _comm_setServerSerialDriver(hComm, SerialDriverSerCxSys); if (!test_generic(hComm)) { fprintf(stderr, "test_SerCxSys failure\n"); return EXIT_FAILURE; } _comm_setServerSerialDriver(hComm, SerialDriverSerCx2Sys); if (!test_generic(hComm)) { fprintf(stderr, "test_SerCx2Sys failure\n"); return EXIT_FAILURE; } if (!CloseHandle(hComm)) { fprintf(stderr, "CloseHandle failure, GetLastError()=%0.8x\n", GetLastError()); return EXIT_FAILURE; } return EXIT_SUCCESS; }
int test_k<Antioch::StatMechThermodynamics<libMesh::Real>, Antioch::EuckenThermalConductivity<Antioch::StatMechThermodynamics<libMesh::Real> > >( const libMesh::Real k ) { double k_reg = 8.0102737519532258e-02; return test_generic(k,k_reg,"k"); }
int main (int argc, char *argv[]) { test_generic (2, 100, 30); return 0; }
int main (int argc, char **argv) { mpfr_t x; tests_start_mpfr (); special (); check_inexact (); check("1.0", 3, MPFR_RNDN, "3.3333333333333331483e-1"); check("1.0", 3, MPFR_RNDZ, "3.3333333333333331483e-1"); check("1.0", 3, MPFR_RNDU, "3.3333333333333337034e-1"); check("1.0", 3, MPFR_RNDD, "3.3333333333333331483e-1"); check("1.0", 2116118, MPFR_RNDN, "4.7256343927890600483e-7"); check("1.098612288668109782", 5, MPFR_RNDN, "0.21972245773362195087"); mpfr_init2 (x, 53); mpfr_set_ui (x, 3, MPFR_RNDD); mpfr_log (x, x, MPFR_RNDD); mpfr_div_ui (x, x, 5, MPFR_RNDD); if (mpfr_cmp_str1 (x, "0.21972245773362189536")) { printf ("Error in mpfr_div_ui for x=ln(3), u=5\n"); exit (1); } mpfr_clear (x); test_generic (2, 200, 100); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); if (argc != 1) /* teint x [prec] */ { mpfr_t x; mp_prec_t p; p = (argc < 3) ? 53 : atoi (argv[2]); mpfr_init2 (x, p); mpfr_set_str (x, argv[1], 10, GMP_RNDN); printf ("eint("); mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); printf (")="); mpfr_eint (x, x, GMP_RNDN); mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); printf ("\n"); mpfr_clear (x); } else { check_specials (); test_generic (2, 100, 100); } tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); check_inexact (); check_hard (); check_special (); check_lowr (); check_float (); /* checks single precision */ check_double (); check_convergence (); check_64 (); check4("4.0","4.503599627370496e15", MPFR_RNDZ, 62, "0.10000000000000000000000000000000000000000000000000000000000000E-49"); check4("1.0","2.10263340267725788209e+187", MPFR_RNDU, 65, "0.11010011111001101011111001100111110100000001101001111100111000000E-622"); check4("2.44394909079968374564e-150", "2.10263340267725788209e+187",MPFR_RNDU, 65, "0.11010011111001101011111001100111110100000001101001111100111000000E-1119"); consistency (); test_20070603 (); test_20070628 (); test_generic (2, 800, 50); tests_end_mpfr (); return 0; }
int main (void) { mp_prec_t p; MPFR_TEST_USE_RANDS (); tests_start_mpfr (); special (); particular_cases (); check_pow_ui (); check_pow_si (); check_special_pow_si (); pow_si_long_min (); for (p = 2; p < 100; p++) check_inexact (p); underflows (); overflows (); x_near_one (); test_generic (2, 100, 100); test_generic_ui (2, 100, 100); test_generic_si (2, 100, 100); data_check ("data/pow275", mpfr_pow275, "mpfr_pow275"); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { mpfr_t x; mpfr_prec_t p; mpfr_rnd_t rnd; tests_start_mpfr (); p = 53; if (argc > 1) { long a = atol (argv[1]); if (MPFR_PREC_COND (a)) p = a; } rnd = (argc > 2) ? (mpfr_rnd_t) atoi(argv[2]) : MPFR_RNDZ; mpfr_init2 (x, p); mpfr_const_pi (x, rnd); if (argc >= 2) { if (argc < 4 || atoi (argv[3]) != 0) { printf ("Pi="); mpfr_out_str (stdout, 10, 0, x, rnd); puts (""); } } else if (mpfr_cmp_str1 (x, "3.141592653589793116") ) { printf ("mpfr_const_pi failed for prec=53\n"); mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN); putchar('\n'); exit (1); } mpfr_set_prec (x, 32); mpfr_const_pi (x, MPFR_RNDN); if (mpfr_cmp_str1 (x, "3.141592653468251") ) { printf ("mpfr_const_pi failed for prec=32\n"); exit (1); } mpfr_clear (x); bug20091030 (); check_large (); test_generic (MPFR_PREC_MIN, 200, 1); RUN_PTHREAD_TEST(); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); check_inexact (); check_special (); test_generic (2, 100, 100); compare_exp2_exp3(500); check_worst_cases(); check3("0.0", GMP_RNDU, "1.0"); check3("-1e-170", GMP_RNDU, "1.0"); check3("-1e-170", GMP_RNDN, "1.0"); check3("-8.88024741073346941839e-17", GMP_RNDU, "1.0"); check3("8.70772839244701057915e-01", GMP_RNDN, "2.38875626491680437269"); check3("1.0", GMP_RNDN, "2.71828182845904509080"); check3("-3.42135637628104173534e-07", GMP_RNDZ, "0.999999657864420798958"); /* worst case for argument reduction, very near from 5*log(2), thanks to Jean-Michel Muller */ check3("3.4657359027997265421", GMP_RNDN, "32.0"); check3("3.4657359027997265421", GMP_RNDU, "32.0"); check3("3.4657359027997265421", GMP_RNDD, "31.999999999999996447"); check3("2.26523754332090625496e+01", GMP_RNDD, "6.8833785261699581146e9"); check3("1.31478962104089092122e+01", GMP_RNDZ, "5.12930793917860137299e+05"); check3("4.25637507920002378103e-01", GMP_RNDU, "1.53056585656161181497e+00"); check3("6.26551618962329307459e-16", GMP_RNDU, "1.00000000000000066613e+00"); check3("-3.35589513871216568383e-03",GMP_RNDD, "9.96649729583626853291e-01"); check3("1.95151388850007272424e+01", GMP_RNDU, "2.98756340674767792225e+08"); check3("2.45045953503350730784e+01", GMP_RNDN, "4.38743344916128387451e+10"); check3("2.58165606081678085104e+01", GMP_RNDD, "1.62925781879432281494e+11"); check3("-2.36539020084338638128e+01",GMP_RNDZ, "5.33630792749924762447e-11"); check3("2.39211946135858077866e+01", GMP_RNDU, "2.44817704330214385986e+10"); check3("-2.78190533055889162029e+01",GMP_RNDZ, "8.2858803483596879512e-13"); check3("2.64028186174889789584e+01", GMP_RNDD, "2.9281844652878973388e11"); check3("2.92086338843268329413e+01", GMP_RNDZ, "4.8433797301907177734e12"); check3("-2.46355324071459982349e+01",GMP_RNDZ, "1.9995129297760994791e-11"); check3("-2.23509444608605427618e+01",GMP_RNDZ, "1.9638492867489702307e-10"); check3("-2.41175390197331687148e+01",GMP_RNDD, "3.3564940885530624592e-11"); check3("2.46363885231578088053e+01", GMP_RNDU, "5.0055014282693267822e10"); check3("111.1263531080090984914932050742208957672119140625", GMP_RNDN, "1.8262572323517295459e48"); check3("-3.56196340354684821250e+02",GMP_RNDN, "2.0225297096141478156e-155"); check3("6.59678273772710895173e+02", GMP_RNDU, "3.1234469273830195529e286"); check3("5.13772529701934331570e+02", GMP_RNDD, "1.3445427121297197752e223"); check3("3.57430211008718345056e+02", GMP_RNDD, "1.6981197246857298443e155"); check3("3.82001814471465536371e+02", GMP_RNDU, "7.9667300591087367805e165"); check3("5.92396038219384422518e+02", GMP_RNDD, "1.880747529554661989e257"); check3("-5.02678550462488090034e+02",GMP_RNDU, "4.8919201895446217839e-219"); check3("5.30015757134837031117e+02", GMP_RNDD, "1.5237672861171573939e230"); check3("5.16239362447650933063e+02", GMP_RNDZ, "1.5845518406744492105e224"); check3("6.00812634798592370977e-01", GMP_RNDN, "1.823600119339019443"); check_exp10 (); tests_end_mpfr (); return 0; }
int unittest_graphic_surface() { if (test_initfree()) goto ONERR; if (test_generic()) goto ONERR; return 0; ONERR: return EINVAL; }
int main (void) { mpfr_t x, y, z, u; int inexact; mpfr_exp_t emax; tests_start_mpfr (); /* check prototypes of mpfr_init_set_* */ inexact = mpfr_init_set_si (x, -1, MPFR_RNDN); inexact = mpfr_init_set (y, x, MPFR_RNDN); inexact = mpfr_init_set_ui (z, 1, MPFR_RNDN); inexact = mpfr_init_set_d (u, 1.0, MPFR_RNDN); emax = mpfr_get_emax (); set_emax (0); mpfr_set_prec (x, 3); mpfr_set_str_binary (x, "0.111"); mpfr_set_prec (y, 2); mpfr_set (y, x, MPFR_RNDU); if (!(MPFR_IS_INF (y) && MPFR_SIGN (y) > 0)) { printf ("Error for y=x=0.111 with px=3, py=2 and emax=0\nx="); mpfr_dump (x); printf ("y="); mpfr_dump (y); exit (1); } set_emax (emax); mpfr_set_prec (y, 11); mpfr_set_str_binary (y, "0.11111111100E-8"); mpfr_set_prec (x, 2); mpfr_set (x, y, MPFR_RNDN); mpfr_set_str_binary (y, "1.0E-8"); if (mpfr_cmp (x, y)) { printf ("Error for y=0.11111111100E-8, prec=2, rnd=MPFR_RNDN\n"); exit (1); } mpfr_clear (x); mpfr_clear (y); mpfr_clear (z); mpfr_clear (u); check_ternary_value (); check_special (); check_neg_special (); test_generic (2, 1000, 10); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { mpfr_t x, y; tests_start_mpfr (); mpfr_init (x); mpfr_init (y); /* special values */ mpfr_set_nan (x); mpfr_j1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_set_inf (x, 1); /* +Inf */ mpfr_j1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); mpfr_set_inf (x, -1); /* -Inf */ mpfr_j1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); mpfr_set_ui (x, 0, MPFR_RNDN); /* +0 */ mpfr_j1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_POS (y)); /* j1(+0)=+0 */ mpfr_set_ui (x, 0, MPFR_RNDN); mpfr_neg (x, x, MPFR_RNDN); /* -0 */ mpfr_j1 (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG (y)); /* j1(-0)=-0 */ mpfr_set_prec (x, 53); mpfr_set_prec (y, 53); mpfr_set_ui (x, 1, MPFR_RNDN); mpfr_j1 (y, x, MPFR_RNDN); mpfr_set_str_binary (x, "0.0111000010100111001001111011101001011100001100011011"); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_j1 for x=1, rnd=MPFR_RNDN\n"); printf ("Expected "); mpfr_dump (x); printf ("Got "); mpfr_dump (y); exit (1); } mpfr_clear (x); mpfr_clear (y); test_generic (2, 100, 10); data_check ("data/j1", mpfr_j1, "mpfr_j1"); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { mpfr_t x, y; unsigned int n; tests_start_mpfr (); test_generic (2, 100, 20); mpfr_init2 (x, 53); mpfr_init2 (y, 53); /* check NaN */ mpfr_set_nan (x); mpfr_log10 (y, x, GMP_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); /* check Inf */ mpfr_set_inf (x, -1); mpfr_log10 (y, x, GMP_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); mpfr_set_inf (x, 1); mpfr_log10 (y, x, GMP_RNDN); MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0); /* check negative argument */ mpfr_set_si (x, -1, GMP_RNDN); mpfr_log10 (y, x, GMP_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); /* check log10(1) = 0 */ mpfr_set_ui (x, 1, GMP_RNDN); mpfr_log10 (y, x, GMP_RNDN); MPFR_ASSERTN((mpfr_cmp_ui (y, 0) == 0) && (MPFR_IS_POS (y))); /* check log10(10^n)=n */ mpfr_set_ui (x, 1, GMP_RNDN); for (n = 1; n <= 15; n++) { mpfr_mul_ui (x, x, 10, GMP_RNDN); /* x = 10^n */ mpfr_log10 (y, x, GMP_RNDN); if (mpfr_cmp_ui (y, n) ) { printf ("log10(10^n) <> n for n=%u\n", n); exit (1); } } mpfr_clear (x); mpfr_clear (y); tests_end_mpfr (); return 0; }
int main (void) { tests_start_mpfr (); special (); test_generic (2, 100, 2); tests_end_mpfr (); return 0; }
int unittest_task_module() { if (test_initfree()) goto ONERR; if (test_query()) goto ONERR; if (test_generic()) goto ONERR; if (test_exec()) goto ONERR; return 0; ONERR: return EINVAL; }
int main (int argc, char *argv[]) { tests_start_mpfr (); check_specials (); test_generic (2, 200, 10); tests_end_mpfr (); return 0; }
int main() { if (test_generic() == EXIT_SUCCESS && test_1() == EXIT_SUCCESS && test_2() == EXIT_SUCCESS && test_5() == EXIT_SUCCESS && test_unhandled() == EXIT_SUCCESS) { return EXIT_SUCCESS; } else { return EXIT_FAILURE; } }
int main (void) { tests_start_mpfr (); special (); test_generic (2, 100, 2); data_check ("data/lgamma", mpfr_lgamma1, "mpfr_lgamma"); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); check_specials (); check_bugs (); test_generic (2, 200, 10); underflowed_cothinf (); tests_end_mpfr (); return 0; }
int main (void) { tests_start_mpfr (); check_nans (); check_regulars (); test_generic (2, 1000, 100); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); check_large (); check_zero (); test_generic (2, 100, 5); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); check_nans (); check_exact (); check_float (); check53("6.9314718055994530941514e-1", "0.0", MPFR_RNDZ, "0.0"); check53("0.0", "6.9314718055994530941514e-1", MPFR_RNDZ, "0.0"); check_sign(); check53("-4.165000000e4", "-0.00004801920768307322868063274915", MPFR_RNDN, "2.0"); check53("2.71331408349172961467e-08", "-6.72658901114033715233e-165", MPFR_RNDZ, "-1.8251348697787782844e-172"); check53("2.71331408349172961467e-08", "-6.72658901114033715233e-165", MPFR_RNDA, "-1.8251348697787786e-172"); check53("0.31869277231188065", "0.88642843322303122", MPFR_RNDZ, "2.8249833483992453642e-1"); check("8.47622108205396074254e-01", "3.24039313247872939883e-01", MPFR_RNDU, 28, 45, 2, "0.375"); check("8.47622108205396074254e-01", "3.24039313247872939883e-01", MPFR_RNDA, 28, 45, 2, "0.375"); check("2.63978122803639081440e-01", "6.8378615379333496093e-1", MPFR_RNDN, 34, 23, 31, "0.180504585267044603"); check("1.0", "0.11835170935876249132", MPFR_RNDU, 6, 41, 36, "0.1183517093595583"); check53("67108865.0", "134217729.0", MPFR_RNDN, "9.007199456067584e15"); check("1.37399642157394197284e-01", "2.28877275604219221350e-01", MPFR_RNDN, 49, 15, 32, "0.0314472340833162888"); check("4.03160720978664954828e-01", "5.854828e-1" /*"5.85483042917246621073e-01"*/, MPFR_RNDZ, 51, 22, 32, "0.2360436821472831"); check("3.90798504668055102229e-14", "9.85394674650308388664e-04", MPFR_RNDN, 46, 22, 12, "0.385027296503914762e-16"); check("4.58687081072827851358e-01", "2.20543551472118792844e-01", MPFR_RNDN, 49, 3, 2, "0.09375"); check_max(); check_min(); check_regression (); test_generic (2, 500, 100); data_check ("data/mulpi", mpfr_mulpi, "mpfr_mulpi"); valgrind20110503 (); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); special (); test_generic (2, 100, 30); data_check ("data/log2", mpfr_log2, "mpfr_log2"); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); special (); test_generic (2, 100, 2); data_check ("data/digamma", mpfr_digamma, "mpfr_digamma"); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); special (); test_generic (2, 100, 100); data_check ("data/sinh", mpfr_sinh, "mpfr_sinh"); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { mpfr_test_init (); tests_start_mpfr (); check_inexact (); check_cmp (argc, argv); test_generic (MPFR_PREC_MIN, 1000, 10); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { mpfr_t x; #ifdef HAVE_INFS check53 (DBL_NAN, DBL_NAN, GMP_RNDN); check53 (DBL_POS_INF, DBL_NAN, GMP_RNDN); check53 (DBL_NEG_INF, DBL_NAN, GMP_RNDN); #endif /* worst case from PhD thesis of Vincent Lefe`vre: x=8980155785351021/2^54 */ check53 (4.984987858808754279e-1, 4.781075595393330379e-1, GMP_RNDN); check53 (4.984987858808754279e-1, 4.781075595393329824e-1, GMP_RNDD); check53 (4.984987858808754279e-1, 4.781075595393329824e-1, GMP_RNDZ); check53 (4.984987858808754279e-1, 4.781075595393330379e-1, GMP_RNDU); check53 (1.00031274099908640274, 8.416399183372403892e-1, GMP_RNDN); check53 (1.00229256850978698523, 8.427074524447979442e-1, GMP_RNDZ); check53 (1.00288304857059840103, 8.430252033025980029e-1, GMP_RNDZ); check53 (1.00591265847407274059, 8.446508805292128885e-1, GMP_RNDN); check53 (1.00591265847407274059, 8.446508805292128885e-1, GMP_RNDN); mpfr_init2 (x, 2); mpfr_set_d (x, 0.5, GMP_RNDN); mpfr_sin (x, x, GMP_RNDD); if (mpfr_get_d1 (x) != 0.375) { fprintf (stderr, "mpfr_sin(0.5, GMP_RNDD) failed with precision=2\n"); exit (1); } /* bug found by Kevin Ryde */ mpfr_const_pi (x, GMP_RNDN); mpfr_mul_ui (x, x, 3L, GMP_RNDN); mpfr_div_ui (x, x, 2L, GMP_RNDN); mpfr_sin (x, x, GMP_RNDN); if (mpfr_cmp_ui (x, 0) >= 0) { fprintf (stderr, "Error: wrong sign for sin(3*Pi/2)\n"); exit (1); } mpfr_clear (x); test_generic (2, 100, 80); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); special (); test_large (); alltst (); test_generic (2, 100, 10); tests_end_mpfr (); return 0; }
int main (int argc, char *argv[]) { tests_start_mpfr (); bug20090519 (); test_generic (2, 100, 100); special (); regular (); tests_end_mpfr (); return 0; }
int main (void) { tests_start_mpfr (); tcc_bug20160606 (); special (); test_generic (MPFR_PREC_MIN, 100, 2); data_check ("data/lgamma", mpfr_lgamma1, "mpfr_lgamma"); tests_end_mpfr (); return 0; }