/* check case when c overlaps with a */ static void check_case_2 (void) { mpfr_t a, b, c, d; mpfr_init2 (a, 300); mpfr_init2 (b, 800); mpfr_init2 (c, 500); mpfr_init2 (d, 800); mpfr_set_str_binary(a, "1E110"); /* a = 2^110 */ mpfr_set_str_binary(b, "1E900"); /* b = 2^900 */ mpfr_set_str_binary(c, "1E500"); /* c = 2^500 */ test_add (c, c, a, MPFR_RNDZ); /* c = 2^500 + 2^110 */ mpfr_sub (d, b, c, MPFR_RNDZ); /* d = 2^900 - 2^500 - 2^110 */ test_add (b, b, c, MPFR_RNDZ); /* b = 2^900 + 2^500 + 2^110 */ test_add (a, b, d, MPFR_RNDZ); /* a = 2^901 */ if (mpfr_cmp_ui_2exp (a, 1, 901)) { printf ("b + d fails for b=2^900+2^500+2^110, d=2^900-2^500-2^110\n"); printf ("expected 1.0e901, got "); mpfr_out_str (stdout, 2, 0, a, MPFR_RNDN); printf ("\n"); exit (1); } mpfr_clear (a); mpfr_clear (b); mpfr_clear (c); mpfr_clear (d); }
static void copy_cred(void) { OM_uint32 major_status, minor_status; gss_cred_id_t cred_handle; OM_uint32 time_rec; major_status = gss_acquire_cred(&minor_status, GSS_C_NO_NAME, 0, NULL, GSS_C_INITIATE, &cred_handle, NULL, &time_rec); if (GSS_ERROR(major_status)) errx(1, "acquire_cred failed"); print_time(time_rec); test_add(cred_handle); test_add(cred_handle); test_add(cred_handle); major_status = gss_release_cred(&minor_status, &cred_handle); if (GSS_ERROR(major_status)) errx(1, "release_cred failed"); }
int atom_test(void) { error err; atom_set_t *d; d = atom_create_tuned(1, 12); if (d == NULL) return 1; err = test_add(d); if (err) return 1; err = test_to_string(d); if (err) return 1; err = test_to_string_and_len(d); if (err) return 1; err = test_delete(d); if (err) return 1; err = test_to_string_and_len(d); if (err) return 1; err = test_add(d); if (err) return 1; err = test_to_string(d); if (err) return 1; err = test_rename(d); if (err) return 1; err = test_to_string(d); if (err) return 1; err = test_to_string_and_len(d); if (err) return 1; err = test_random(d); if (err) return 1; atom_destroy(d); return 0; }
int main (int argc, char *argv[]) { g_type_init (); g_test_init (&argc, &argv, NULL); test_add ("/keyfrob/decode", test_keyfrob_decode); test_add ("/keyfrob/encode", test_keyfrob_encode); test_add ("/keyfrob/both", test_keyfrob_both); return g_test_run (); }
int main (int argc, char *argv[]) { #if !GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); #endif g_test_init (&argc, &argv, NULL); test_add ("/flickr/error", test_flickr_error); test_add ("/lastfm/error", test_flickr_error); return g_test_run (); }
int main(int argc, char **argv){ test_init(10); test_add("Write and read a text file", writeReadTextFile); test_add("Parse a simple JSON file", parseSimpleJson); test_add("Parse a package.json file", parsePackageJson); test_add("Cast an application's package.json file to a packageJsonFile_t struct", parseAppPackageJson); test_add("Parse the index.json file", parseIndexJson); test_add("Download a file (working Internet connection is required)", downloadFile); test_add("Extract an archive (.tar.gz on Linux, .zip on Windows) (requires the previous test was passed)", extract); test_add("Simulate a check for update", update); test_add("List locally installed nwjs versions in a simulated environment (note: sudo is required)", listInstalledNwjsVersions); test_add("Edit a application list file", editAppList); return test_run(); }
static void check2b (const char *xs, int px, const char *ys, int py, const char *rs, int pz, mpfr_rnd_t rnd_mode) { mpfr_t xx, yy, zz; mpfr_init2 (xx,px); mpfr_init2 (yy,py); mpfr_init2 (zz,pz); mpfr_set_str_binary (xx, xs); mpfr_set_str_binary (yy, ys); test_add (zz, xx, yy, rnd_mode); if (mpfr_cmp_str (zz, rs, 2, MPFR_RNDN)) { printf ("(2) x=%s,%d y=%s,%d pz=%d,rnd=%s\n", xs, px, ys, py, pz, mpfr_print_rnd_mode (rnd_mode)); printf ("got "); mpfr_print_binary(zz); puts (""); mpfr_set_str(zz, rs, 2, MPFR_RNDN); printf ("instead of "); mpfr_print_binary(zz); puts (""); exit (1); } mpfr_clear(xx); mpfr_clear(yy); mpfr_clear(zz); }
int main(int argc, char *argv[]) { int opt; if((opt = getopt(argc, argv, "ar")) != -1) { switch(opt) { case 'a': test_add(); break; case 'r': test_read(); break; #if 0 case 'd': test_del(); break; case 't': test_alter(); break; #endif case '?': printf("unknown option: %c\n", optopt); break; } } return(0); }
static int test_add_all(cmd_args_t *args) { ListIterator si, ti; subsystem_t *sub; test_t *test; int rc; si = list_iterator_create(subsystems); while ((sub = list_next(si))) { ti = list_iterator_create(sub->sub_tests); while ((test = list_next(ti))) { if ((rc = test_add(args, test))) { list_iterator_destroy(ti); list_iterator_destroy(si); return rc; } } list_iterator_destroy(ti); } list_iterator_destroy(si); return 0; }
/* main: * * Description of test procedure here. */ int main(int argc, char *argv[]) { ibuf s = NULL; int result = 0; /* Create a tree */ debug("Creating string... "); s = ibuf_init(); if (s == NULL) { printf("FAILED\n"); return 1; } debug("Succeeded.\n"); /* Run tests */ result |= test_add(s); result |= test_addchar(s); result |= test_delchar(s); result |= test_dup(s); result |= test_trim(s); debug("Destroying string...\n"); ibuf_free(s); if (result) { printf("FAILED\n"); return 2; } printf("PASSED\n"); return 0; }
int main (int argc, char* argv[]) { if (argc > 1 && !strcmp (argv[1], "--verbose")) verbose = 1; else if (argc > 1 && !strcmp (argv[1], "--debug")) verbose = debug = 1; if (!gcry_check_version (GCRYPT_VERSION)) { fputs ("version mismatch\n", stderr); exit (1); } gcry_control(GCRYCTL_DISABLE_SECMEM); test_const_and_immutable (); test_opaque (); test_cmp (); test_add (); test_sub (); test_mul (); test_powm (); return !!error_count; }
main () { test_fetch_add (); test_fetch_sub (); test_fetch_and (); test_fetch_nand (); test_fetch_xor (); test_fetch_or (); test_add_fetch (); test_sub_fetch (); test_and_fetch (); test_nand_fetch (); test_xor_fetch (); test_or_fetch (); test_add (); test_sub (); test_and (); test_nand (); test_xor (); test_or (); return 0; }
static void check_nans (void) { mpfr_t s, x, y; mpfr_init2 (x, 8L); mpfr_init2 (y, 8L); mpfr_init2 (s, 8L); /* +inf + -inf == nan */ mpfr_set_inf (x, 1); mpfr_set_inf (y, -1); test_add (s, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_nan_p (s)); /* +inf + 1 == +inf */ mpfr_set_inf (x, 1); mpfr_set_ui (y, 1L, MPFR_RNDN); test_add (s, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (s)); MPFR_ASSERTN (mpfr_sgn (s) > 0); /* -inf + 1 == -inf */ mpfr_set_inf (x, -1); mpfr_set_ui (y, 1L, MPFR_RNDN); test_add (s, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (s)); MPFR_ASSERTN (mpfr_sgn (s) < 0); /* 1 + +inf == +inf */ mpfr_set_ui (x, 1L, MPFR_RNDN); mpfr_set_inf (y, 1); test_add (s, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (s)); MPFR_ASSERTN (mpfr_sgn (s) > 0); /* 1 + -inf == -inf */ mpfr_set_ui (x, 1L, MPFR_RNDN); mpfr_set_inf (y, -1); test_add (s, x, y, MPFR_RNDN); MPFR_ASSERTN (mpfr_inf_p (s)); MPFR_ASSERTN (mpfr_sgn (s) < 0); mpfr_clear (x); mpfr_clear (y); mpfr_clear (s); }
int main(int argc, char **argv) { init_apr_lib(); test_add(); test_select(); free_apr_lib(); return 0; }
int main() { test_errors(); test_basics(); test_add(); zisolate(); return 0; }
int main() { for (int i = -100; i <= 100; i++) { for (int j = -100; j <= 100; j++) { test_add(i, j); } } printf("Passed %d tests\n", test_count); return 0; }
int main (int argc, char **argv) { test_zero_fill (); test_crop (); test_add (); test_compare (); return unit_test_failures; }
/* check case when c does not overlap with a, but both b and c count for rounding */ static void check_case_1b (void) { mpfr_t a, b, c; unsigned int prec_a, prec_b, prec_c, dif; mpfr_init (a); mpfr_init (b); mpfr_init (c); { prec_a = MPFR_PREC_MIN + (randlimb () % 63); mpfr_set_prec (a, prec_a); for (prec_b = prec_a + 2; prec_b <= 64; prec_b++) { dif = prec_b - prec_a; mpfr_set_prec (b, prec_b); /* b = 1 - 2^(-prec_a) + 2^(-prec_b) */ mpfr_set_ui (b, 1, MPFR_RNDN); mpfr_div_2exp (b, b, dif, MPFR_RNDN); mpfr_sub_ui (b, b, 1, MPFR_RNDN); mpfr_div_2exp (b, b, prec_a, MPFR_RNDN); mpfr_add_ui (b, b, 1, MPFR_RNDN); for (prec_c = dif; prec_c <= 64; prec_c++) { /* c = 2^(-prec_a) - 2^(-prec_b) */ mpfr_set_prec (c, prec_c); mpfr_set_si (c, -1, MPFR_RNDN); mpfr_div_2exp (c, c, dif, MPFR_RNDN); mpfr_add_ui (c, c, 1, MPFR_RNDN); mpfr_div_2exp (c, c, prec_a, MPFR_RNDN); test_add (a, b, c, MPFR_RNDN); if (mpfr_cmp_ui (a, 1) != 0) { printf ("case (1b) failed for prec_a=%u, prec_b=%u," " prec_c=%u\n", prec_a, prec_b, prec_c); printf ("b="); mpfr_print_binary(b); puts (""); printf ("c="); mpfr_print_binary(c); puts (""); printf ("a="); mpfr_print_binary(a); puts (""); exit (1); } } } } mpfr_clear (a); mpfr_clear (b); mpfr_clear (c); }
static void check_overflow (void) { mpfr_t a, b, c; mpfr_prec_t prec_a; int r; mpfr_init2 (a, 256); mpfr_init2 (b, 256); mpfr_init2 (c, 256); mpfr_set_ui (b, 1, MPFR_RNDN); mpfr_setmax (b, mpfr_get_emax ()); mpfr_set_ui (c, 1, MPFR_RNDN); mpfr_set_exp (c, mpfr_get_emax () - 192); RND_LOOP(r) for (prec_a = 128; prec_a < 512; prec_a += 64) { mpfr_set_prec (a, prec_a); mpfr_clear_overflow (); test_add (a, b, c, (mpfr_rnd_t) r); if (!mpfr_overflow_p ()) { printf ("No overflow in check_overflow\n"); exit (1); } } mpfr_set_exp (c, mpfr_get_emax () - 512); mpfr_set_prec (a, 256); mpfr_clear_overflow (); test_add (a, b, c, MPFR_RNDU); if (!mpfr_overflow_p ()) { printf ("No overflow in check_overflow\n"); exit (1); } mpfr_clear (a); mpfr_clear (b); mpfr_clear (c); }
void test_list(void) { test_init(); add_setup(); test_add(); add_teardown(); del_setup(); test_del(); del_teardown(); }
int main() { test_create(1); test_add(2); test_print(3); test_remove(4); test_remove_last_node(); test_remove_first_node(); test_add_with_index(0); test_add_with_index(1); test_add_with_index(2); return 0; }
int main(void) { int a = 3; int b = 2; printf("a = %d\n", a); printf("b = %d\n", b); printf("a + b = %d\n", test_add(a, b)); printf("a - b = %d\n", test_sub(a, b)); return 0; }
static void check_alloc (void) { mpfr_t a; mpfr_init2 (a, 10000); mpfr_set_prec (a, 53); mpfr_set_ui (a, 15236, MPFR_RNDN); test_add (a, a, a, MPFR_RNDN); mpfr_mul (a, a, a, MPFR_RNDN); mpfr_div (a, a, a, MPFR_RNDN); mpfr_sub (a, a, a, MPFR_RNDN); mpfr_clear (a); }
//uruchamiaj wszystkie testy po kolei void Tester::run(){ cout<< "Test-start" <<endl; test_rest(); test_hex(); test_divide(); test_multpily(); test_bigger(); test_smaller(); test_add(); test_substract(); cout<< "Test-koniec" <<endl; }
/* checks when source and destination are equal */ static void check_same (void) { mpfr_t x; mpfr_init(x); mpfr_set_ui(x, 1, MPFR_RNDZ); test_add (x, x, x, MPFR_RNDZ); if (mpfr_cmp_ui (x, 2)) { printf ("Error when all 3 operands are equal\n"); exit (1); } mpfr_clear(x); }
int main() { d_linked_list *list = build_list(); print_list(list); test_delete(list, 1); test_delete(list, 2); test_delete(list, 7); test_delete(list, 3); test_delete(list, 4); test_delete(list, 5); test_add(list, 13); test_delete(list, 6); test_delete(list, 8); test_delete(list, 9); print_list(list); test_add(list, 1337); print_list(list); test_delete(list, 2); test_add(list, 98); print_list(list); return 0; }
int main(int argc, const char **argv) { test_create(); test_to_long_long(); test_compare(); test_add(); test_subtract(); test_increment(); test_decrement(); test_performance(); printf("\nAll tests passed!\n"); return EXIT_SUCCESS; };
int init_module(void) { START_TESTS("IPv4 Pool DB"); /* * TODO (test) This is missing a multiple-tables test. * (it always does mark = 1.) */ INIT_CALL_END(init(), test_foreach_sample(), destroy(), "Sample for"); INIT_CALL_END(init(), test_add(), destroy(), "Add"); INIT_CALL_END(init(), test_rm(), destroy(), "Rm"); INIT_CALL_END(init(), test_flush(), destroy(), "Flush"); END_TESTS; }
int main() { int choice; char *menu[] = { "1---get by id.\n", "2---del by id.\n", "3---add user.\n", "4---alter user.\n", "0---quit.\n", NULL }; show_menu(menu); printf("please choice: "); scanf("%d", &choice); while(1) { switch(choice) { case 1: test_get(); break; case 2: test_del(); break; case 3: test_add(); break; case 4: test_alter(); break; case 0: exit(0); default: break; } printf("---------------------------------\n"); printf("please choice: "); scanf("%d", &choice); } return 0; }
int main(void) { Suite *s1 = suite_create("Integer Vector 3"); TCase *tc1_1 = tcase_create("Integer Vector 3"); SRunner *sr = srunner_create(s1); int nf; srunner_set_fork_status(sr, CK_NOFORK); test_add(tc1_1); suite_add_tcase(s1, tc1_1); srunner_run_all(sr, CK_ENV); nf = srunner_ntests_failed(sr); srunner_free(sr); return nf == 0 ? 0 : 1; }