int main () { test_function (); return 0; }
int main () { test_function (u16_mbtouc_unsafe); return 0; }
int main () { DECL_LONG_DOUBLE_ROUNDING BEGIN_LONG_DOUBLE_ROUNDING (); /* A particular value. */ x = 0.6L; y = sqrtl (x); ASSERT (y >= 0.7745966692L && y <= 0.7745966693L); /* Another particular value. */ { long double z; long double err; x = 8.1974099812331540680810141969554806865L; y = sqrtl (x); z = y * y - x; err = my_ldexpl (z, LDBL_MANT_DIG); if (err < 0) err = - err; ASSERT (err <= 100.0L); } test_function (); return 0; }
CSL_CDECL struct csl_common_timer_result csl_common_test_timer_i1( void (*test_function)(int), int param ) { struct csl_common_timer_result rs; struct timeval start; int loop = 2; int i = 0; size_t nl = 0; double ela = 0.0; gettimeofday( &start,NULL ); while( (ela = calc_elapsed(&start)) < MAX_SAMPLING_INTERVAL_MS ) { for( i=0;i<loop;++i ) { test_function(param); nl++; } loop *= 2; } rs.n_loops = nl; rs.total_ms = ela; rs.ms_per_call = ela/(double)nl; rs.call_per_sec = nl*1000.0/ela; return rs; }
int main () { test_function (u32_mbtouc); return 0; }
/* TODO test_wrap: change sig to (setup_func, test, va_list test_arg) */ int test_wrap (char *test_name, int (*test_function) (FILE * test_fd, char *cipher_suite, int proto_version), FILE * test_fd, int daemon_flags, char *cipher_suite, int proto_version, ...) { int ret; va_list arg_list; struct MHD_Daemon *d; va_start (arg_list, proto_version); if (setup_testcase (&d, daemon_flags, arg_list) != 0) { va_end (arg_list); return -1; } fprintf (stdout, "running test: %s ", test_name); ret = test_function (test_fd, cipher_suite, proto_version); if (ret == 0) { fprintf (stdout, "[pass]\n"); } else { fprintf (stdout, "[fail]\n"); } teardown_testcase (d); va_end (arg_list); return ret; }
pid_t eat_cpu(int (test_function)(void)) { union pipe read_pipe, write_pipe; int cpu, rc; pid_t pid; cpu = pick_online_cpu(); FAIL_IF(cpu < 0); FAIL_IF(bind_to_cpu(cpu)); if (pipe(read_pipe.fds) == -1) return -1; if (pipe(write_pipe.fds) == -1) return -1; pid = fork(); if (pid == 0) exit(eat_cpu_child(write_pipe, read_pipe)); if (sync_with_child(read_pipe, write_pipe)) { rc = -1; goto out; } printf("main test running as pid %d\n", getpid()); rc = test_function(); out: kill(pid, SIGKILL); return rc; }
/* * run_tests - Run series of tests. Return number of errors */ static int run_tests() { int i; int errors = 0; double points = 0.0; double max_points = 0.0; printf("Score\tRating\tErrors\tFunction\n"); for (i = 0; test_set[i].solution_funct; i++) { int terrors; double tscore; double tpoints; if (!test_fname || strcmp(test_set[i].name,test_fname) == 0) { int rating = global_rating ? global_rating : test_set[i].rating; terrors = test_function(&test_set[i]); errors += terrors; tscore = terrors == 0 ? 1.0 : 0.0; tpoints = rating * tscore; points += tpoints; max_points += rating; if (grade || terrors < 1) printf(" %.0f\t%d\t%d\t%s\n", tpoints, rating, terrors, test_set[i].name); } } printf("Total points: %.0f/%.0f\n", points, max_points); return errors; }
/* TODO test_wrap: change sig to (setup_func, test, va_list test_arg) */ int test_wrap (const char *test_name, int (*test_function) (void * cls, const char *cipher_suite, int proto_version), void * cls, int daemon_flags, const char *cipher_suite, int proto_version, ...) { int ret; va_list arg_list; struct MHD_Daemon *d; va_start (arg_list, proto_version); if (setup_testcase (&d, daemon_flags, arg_list) != 0) { va_end (arg_list); fprintf (stderr, "Failed to setup testcase %s\n", test_name); return -1; } #if 0 fprintf (stdout, "running test: %s ", test_name); #endif ret = test_function (NULL, cipher_suite, proto_version); #if 0 if (ret == 0) { fprintf (stdout, "[pass]\n"); } else { fprintf (stdout, "[fail]\n"); } #endif teardown_testcase (d); va_end (arg_list); return ret; }
int ACE_TMAIN (int, ACE_TCHAR *[]) { int failure_count = 0; test_class my_test_class; // Tet out the export of a class. I don't see // How this can fail at runtime (rather it would // probably give link errors), but just in case... cout << "Method Test: "; if (my_test_class.method () != RETVAL) { cout << "Failed" << endl; ++failure_count; } else cout << "Succeeded" << endl; // Test out the export of a function. Like above, // I don't know how this can fail at runtime. cout << "Function Test: "; if (test_function () != RETVAL) { cout << "Failed" << endl; ++failure_count; } else cout << "Succeeded" << endl; // Also test out the export of data. cout << "Variable Test: "; if (test_variable != RETVAL) { cout << "Failed" << endl; ++failure_count; } else cout << "Succeeded" << endl; // Test out the ACE_Singleton export by checking to see // that we have the same instance pointer as the DLL does. // This can fail at runtime. cout << "Singleton Test: "; if (TEST_SINGLETON::instance () != get_dll_singleton ()) { cout << "Failed" << endl; ++failure_count; } else cout << "Succeeded" << endl; // Return the number of failures return failure_count; }
int main( void ) { double dbl; dbl = -1.0; if( test_function( &dbl ) ) fail( __LINE__ ); _PASS; }
void reset() { simVars.timecontrol.current_timestep_nr = 0; prog_h.physical_set_all(test_function(time_test_function_order, 0)); prog_u.physical_set_all(0); prog_v.physical_set_all(0); }
int main(int argc, char *argv[]) { zf_log_set_output_v(ZF_LOG_PUT_STD, 0, mock_output_callback); TEST_RUNNER_CREATE(argc, argv); TEST_EXECUTE(test_function()); return TEST_RUNNER_EXIT_CODE(); }
int main (int argc, char *argv[]) { set_program_name (argv[0]); test_function (xprintf); return 0; }
int main() { int x = 10, y = 20, z = 30; z = test_function(x); printf("%d %d %d\n", x, y , z); return 0; }
int main (int argc _GL_UNUSED, char *argv[]) { set_program_name (argv[0]); test_function (xfprintf); return 0; }
int main () { DECL_LONG_DOUBLE_ROUNDING BEGIN_LONG_DOUBLE_ROUNDING (); /* Consider the current rounding mode, cf. <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/float.h.html> */ if (FLT_ROUNDS == 1) { /* The current rounding mode is round-to-nearest (the default in IEEE 754). */ /* Zero. */ ASSERT (rintl (0.0L) == 0.0L); ASSERT (rintl (minus_zerol) == 0.0L); /* Positive numbers. */ ASSERT (rintl (0.3L) == 0.0L); ASSERT (rintl (0.5L) == 0.0L); /* unlike roundl() */ ASSERT (rintl (0.7L) == 1.0L); ASSERT (rintl (1.0L) == 1.0L); ASSERT (rintl (1.5L) == 2.0L); ASSERT (rintl (1.999L) == 2.0L); ASSERT (rintl (2.0L) == 2.0L); ASSERT (rintl (2.1L) == 2.0L); ASSERT (rintl (2.5L) == 2.0L); /* unlike roundl() */ ASSERT (rintl (2.7L) == 3.0L); ASSERT (rintl (65535.999L) == 65536.0L); ASSERT (rintl (65536.0L) == 65536.0L); ASSERT (rintl (65536.001L) == 65536.0L); ASSERT (rintl (2.341e31L) == 2.341e31L); /* Negative numbers. */ ASSERT (rintl (-0.3L) == 0.0L); ASSERT (rintl (-0.5L) == 0.0L); /* unlike roundl() */ ASSERT (rintl (-0.7L) == -1.0L); ASSERT (rintl (-1.0L) == -1.0L); ASSERT (rintl (-1.5L) == -2.0L); ASSERT (rintl (-1.999L) == -2.0L); ASSERT (rintl (-2.0L) == -2.0L); ASSERT (rintl (-2.1L) == -2.0L); ASSERT (rintl (-2.5L) == -2.0L); /* unlike roundl() */ ASSERT (rintl (-2.7L) == -3.0L); ASSERT (rintl (-65535.999L) == -65536.0L); ASSERT (rintl (-65536.0L) == -65536.0L); ASSERT (rintl (-65536.001L) == -65536.0L); ASSERT (rintl (-2.341e31L) == -2.341e31L); test_function (); return 0; } else { fputs ("Skipping test: non-standard rounding mode\n", stderr); return 77; } }
int gfx_engine() { test_function();// used for debug commands and stuff. draw_ui(); // draws the ui and compress all buffers down to the screen_buffer, so only one draw to the screen is made. draw_map();// draws the individual tiles that correspond to the tile numbers in the map array. blit (screen_buffer, screen, 0,0,0,0,1024,768); rectfill (screen_buffer, 0,0,1024,768,makecol(0,0,0)); return 0; }
int main() { std::cout << "Running test that needs a library" << std::endl; if (test_function() != "Hello, world.") { std::cerr << "test_function didn't return as expected" << std::endl; return 1; } return 0; }
int main () { /* Consider the current rounding mode, cf. <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/float.h.html> */ if (FLT_ROUNDS == 1) { /* The current rounding mode is round-to-nearest (the default in IEEE 754). */ /* Zero. */ ASSERT (rintf (0.0f) == 0.0f); ASSERT (rintf (minus_zerof) == 0.0f); /* Positive numbers. */ ASSERT (rintf (0.3f) == 0.0f); ASSERT (rintf (0.5f) == 0.0f); /* unlike roundf() */ ASSERT (rintf (0.7f) == 1.0f); ASSERT (rintf (1.0f) == 1.0f); ASSERT (rintf (1.5f) == 2.0f); ASSERT (rintf (1.999f) == 2.0f); ASSERT (rintf (2.0f) == 2.0f); ASSERT (rintf (2.1f) == 2.0f); ASSERT (rintf (2.5f) == 2.0f); /* unlike roundf() */ ASSERT (rintf (2.7f) == 3.0f); ASSERT (rintf (65535.99f) == 65536.0f); ASSERT (rintf (65536.0f) == 65536.0f); ASSERT (rintf (65536.01f) == 65536.0f); ASSERT (rintf (2.341e31f) == 2.341e31f); /* Negative numbers. */ ASSERT (rintf (-0.3f) == 0.0f); ASSERT (rintf (-0.5f) == 0.0f); /* unlike roundf() */ ASSERT (rintf (-0.7f) == -1.0f); ASSERT (rintf (-1.0f) == -1.0f); ASSERT (rintf (-1.5f) == -2.0f); ASSERT (rintf (-1.999f) == -2.0f); ASSERT (rintf (-2.0f) == -2.0f); ASSERT (rintf (-2.1f) == -2.0f); ASSERT (rintf (-2.5f) == -2.0f); /* unlike roundf() */ ASSERT (rintf (-2.7f) == -3.0f); ASSERT (rintf (-65535.99f) == -65536.0f); ASSERT (rintf (-65536.0f) == -65536.0f); ASSERT (rintf (-65536.01f) == -65536.0f); ASSERT (rintf (-2.341e31f) == -2.341e31f); test_function (); return 0; } else { fputs ("Skipping test: non-standard rounding mode\n", stderr); return 77; } }
int main () { DECL_LONG_DOUBLE_ROUNDING BEGIN_LONG_DOUBLE_ROUNDING (); test_function (fmal); return 0; }
int main () { /* A particular value. */ x = 0.6f; y = logf (x); ASSERT (y >= -0.5108257f && y <= -0.5108256f); test_function (); return 0; }
int main () { /* A particular value. */ x = 0.6f; y = sqrtf (x); ASSERT (y >= 0.7745966f && y <= 0.7745967f); test_function (); return 0; }
int main () { /* A particular value. */ x = 0.6f; y = log1pf (x); ASSERT (y >= 0.4700036f && y <= 0.4700037f); test_function (); return 0; }
static void memory_leak_check() { unsigned int memory_used; mcheck_pedantic(NULL); memory_used= mallinfo().uordblks; test_function(); memory_used= mallinfo().uordblks - memory_used; if (memory_used != 0) printf("Memory leak detected (%d bytes)\n", memory_used); else printf("No memory leak detected.\n"); }
int main () { /* A particular value. */ x = 0.6; y = expm1 (x); ASSERT (y >= 0.822118800 && y <= 0.822118801); test_function (); return 0; }
int main () { /* A particular value. */ x = 0.6; y = log2 (x); ASSERT (y >= -0.7369655942 && y <= -0.7369655941); test_function (); return 0; }
uint8_t picUnit_run_test(uint8_t (*test_function)(), uint8_t * noOfTestsRun_p, uint8_t testResults[]) { if(PICUNIT_TEST_FAILED == test_function()) { picUnit_report_test_failed(noOfTestsRun_p, testResults); } else { picUnit_report_test_passed(noOfTestsRun_p, testResults); } return 0; }
int main () { /* A particular value. */ x = 0.6; y = sqrt (x); ASSERT (y >= 0.7745966692 && y <= 0.7745966693); test_function (); return 0; }
int main () { /* A particular value. */ x = 0.6; y = log (x); ASSERT (y >= -0.5108256238 && y <= -0.5108256237); test_function (); return 0; }