void lisp_parser_test() { #if 0 test_case(test_lisp_parse_1); test_case(test_lisp_parse_nested); #endif }
int main(void) { test_case("Hello, my name is Sara!"); test_case("Isn't it true that Padraig O'Malley didn't win (he came in 3rd!)? 'Tain't necessarily so!"); test_case("'Tain't an Archimedes' Screw"); return 0; }
int main (void) { float64_t v1 = 3.14159265359; float64_t v2 = -2.71828; float64_t v1_1[] = {v1}; float64_t v1_2[] = {v2}; float64_t e1[] = {v1 * v2}; test_case (v1_1, v1_2, e1); float64_t v2_1[] = {0}; float64_t v2_2[] = {__builtin_huge_val ()}; float64_t e2[] = {2.0}; test_case (v2_1, v2_2, e2); float64_t v3_1[] = {0}; float64_t v3_2[] = {-__builtin_huge_val ()}; float64_t e3[] = {-2.0}; test_case (v3_1, v3_2, e3); float64_t v4_1[] = {-0.0}; float64_t v4_2[] = {__builtin_huge_val ()}; float64_t e4[] = {-2.0}; test_case (v4_1, v4_2, e4); float64_t v5_1[] = {-0.0}; float64_t v5_2[] = {-__builtin_huge_val ()}; float64_t e5[] = {2.0}; test_case (v5_1, v5_2, e5); return 0; }
int main() { srand(time(NULL)); int T = MAXT; printf("%d\n", T); printf( "\n" "2\n" "firstVwXyZ-wXyZ UVWXYZ\n" "lastwxyz\n" "8\n" "F wxyz\n" "L wxyz\n" "F vwxyz\n" "L vwxyz\n" "F uvwxyz\n" "L uvwxyz\n" "N z\n" "F ab\n" ); --T; test_case(true); --T; while (T--) test_case(); return 0; }
int main(int argc, char *argv[]) { uint8_t opt_arr1[] = { 0x1, 0x2, 0x1, 0x0 }; uint8_t opt_arr2[] = { 0x1, 0x4, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0 }; custom_opt_t opt; uint16_t expected_opt_size; uint16_t payload_sz; opt.code = CUSTOM_IP_OPT; opt.len = 3; opt.opt[0] = 'X'; opt.opt[1] = 'Y'; opt.opt[2] = 'Z'; expected_opt_size = 8; payload_sz = 5; test_case(payload_sz, NULL, 0, &opt, expected_opt_size); expected_opt_size = 8; payload_sz = 1000; test_case(payload_sz, opt_arr1, sizeof (opt_arr1), &opt, expected_opt_size); expected_opt_size = 24; payload_sz = 1000; strncpy(opt.opt, "Special Option", sizeof (opt.opt)); opt.len = strlen("Special Option"); test_case(payload_sz, opt_arr2, sizeof (opt_arr2), &opt, expected_opt_size); }
int main() { srand(time(NULL)); T = MAXT; for (int i = 0; i < 5; ++i) test_case(true); while (T) test_case(); return 0; }
int main() { printf("%d", (int)sizeof_int()); test_case(0, 0); test_case(1, 1); test_case(0xffffffff, 0); test_case(0x10000000, 1); test_case(4, 12); return 0; }
int main() { srand(time(NULL)); int T = MAXT; test_case(true); --T; while (T--) test_case(); return 0; }
int main() { srand(time(NULL)); T = MAXT; printf("%d\n", T); for (int i = 0; i < NCRIT; ++i) test_case(true); while (T) test_case(); return 0; }
int main( int argc , char ** argv) { const char * existing_case = argv[1]; const char * missing_header = argv[2]; const char * missing_data = argv[3]; test_assert_false( ecl_sum_case_exists( "/does/not/exist" )); test_case( existing_case , true); test_case_no_path( existing_case , true); test_case( missing_header , false); test_case_no_path( missing_header , false); test_case( missing_data , false); test_case_no_path( missing_data , false); }
int main (void) { float32_t v1 = 3.14159265359; float32_t v2 = 1.383894; float32_t v3 = -2.71828; float32_t v4 = -3.4891931; test_case (v1, v2, v1 * v2); test_case (0.0, __builtin_huge_valf (), 2.0); test_case (0.0, -__builtin_huge_valf (), -2.0); test_case (-0.0, __builtin_huge_valf (), -2.0); test_case (-0.0, -__builtin_huge_valf (), 2.0); return 0; }
int test_isprint(void) { if (test_case(' ')) { SUCCESS_LOG return (1); }
int main() { srand(time(NULL)); int T = MAXT; printf("%d\n", T); puts("1"); puts("0"); --T; puts("100"); puts("0"); --T; puts("2"); puts("0"); --T; puts("2"); puts("1 1"); --T; puts("2"); puts("1 2"); --T; puts("10"); puts("9 1 2 3 4 5 7 8 9 10"); --T; puts("100"); puts("4 1 10 11 50"); --T; while (T--) test_case(); return 0; }
bool checkpoint(void) { bool ok = true; // different types of sparsity option_enum pack_sparsity = CppAD::atomic_base<double>::pack_sparsity_enum; option_enum bool_sparsity = CppAD::atomic_base<double>::bool_sparsity_enum; option_enum set_sparsity = CppAD::atomic_base<double>::set_sparsity_enum; // test some different cases ok &= test_case(pack_sparsity, pack_sparsity); ok &= test_case(pack_sparsity, bool_sparsity); ok &= test_case(bool_sparsity, set_sparsity); ok &= test_case(set_sparsity, set_sparsity); return ok; }
int main(void) { SXE_HTTPD httpd; unsigned id; plan_tests(43); putenv((char *)(intptr_t)"SXE_LOG_LEVEL_LIBSXE_LIB_SXE=6"); putenv((char *)(intptr_t)"SXE_LOG_LEVEL_LIBSXE_LIB_SXE_LIST=5"); putenv((char *)(intptr_t)"SXE_LOG_LEVEL_LIBSXE_LIB_SXE_POOL=5"); putenv((char *)(intptr_t)"SXE_LOG_LEVEL_LIBSXE_LIB_SXE_HTTP=5"); putenv((char *)(intptr_t)"SXE_LOG_LEVEL_LIBSXE_LIB_SXE_HTTPD=6"); /* comment this line to debug this test */ test_sxe_register_and_init(1000); sxe_httpd_construct(&httpd, 2, 10, 512, 0); SXE_HTTPD_SET_HANDLER(&httpd, connect, h_connect); SXE_HTTPD_SET_HANDLER(&httpd, header, h_header); SXE_HTTPD_SET_HANDLER(&httpd, respond, h_respond); SXE_HTTPD_SET_HANDLER(&httpd, close, h_close); ok((listener = test_httpd_listen(&httpd, "0.0.0.0", 0)) != NULL, "HTTPD listening"); for (id = 0; id < TEST_CASES; id++) { test_case(cases[id].tapname, cases[id].request, cases[id].header_count); } sxe_close(listener); return exit_status(); }
int suite_run(SuiteT *suite) { pid_t pid; int test_idx = 0; int failure_count = 0; test_case_fp test_case; signal(SIGABRT, signal_callback_handler); while ( (test_case = suite->tests[test_idx++]) != NULL) { failure = NO; test_case(); if (failure == YES) { failure_count++; printf("F"); } else { printf("."); } } printf("\n"); return failure_count; }
int test_bzero(void) { if (test_case("11111", 0)) { SUCCESS_LOG return (1); }
int main() { srand(time(NULL)); int T = MAXT; printf("%d\n", T); for (int r = 1; r <= 10; ++r) for (int h = 1; h <= 10; ++h) { printf("%d %d\n", r, h); --T; } printf("%d %d\n", MAXR, MAXH); --T; puts("1 500"); --T; puts("500 1"); --T; puts("10 10"); --T; puts("10 10"); --T; puts("13 27"); --T; puts("10 10"); --T; puts("13 27"); --T; while (T--) test_case(); return 0; }
int test_isalnum(void) { if (test_case(' ')) { SUCCESS_LOG return (1); }
TEST(F16CIVBTest, test_half_to_float) { const char *expected_sha1[3] = { "68442b2c5704fd2792d92b15fa2e259a51c601dc" }; test_case(zimg::PixelType::HALF, zimg::PixelType::FLOAT, expected_sha1, INFINITY); }
TEST(F16CIVBTest, test_float_to_half) { const char *expected_sha1[3] = { "8907defd10af0b7c71abfb9c20147adc1b0a1f70" }; test_case(zimg::PixelType::FLOAT, zimg::PixelType::HALF, expected_sha1, INFINITY); }
TEST(F16CSSE2Test, test_float_to_half) { const char *expected_sha1[3] = { "4184caae2bd2a3f54722cba1d561cc8720b117ce" }; // The SSE2 approximation does not implement correct rounding. test_case(zimg::PixelType::FLOAT, zimg::PixelType::HALF, expected_sha1, 90.0); }
int main() { fs::directory_iterator end_iter; for (fs::directory_iterator dir_itr("tests/cases"); dir_itr != end_iter; ++dir_itr) { std::string path = dir_itr->path().string(); std::cout << "Case: " << path << std::endl; test_case(path); } }
TEST(DepthConvertTest, test_full_luma) { const char *expected_sha1[][3] = { { "f0e4a68158eab0ab350c7161498a8eed3196c233" }, { "20c77820ff7d4443a0de7991218e2f8eee551e8d" }, { "07b6aebbfe48004c8acb12a3c76137db57ba9a0b" }, { "7ad2bc4ba1be92699ec22f489ae93a8b0dc89821" }, { "8907defd10af0b7c71abfb9c20147adc1b0a1f70" }, { "68442b2c5704fd2792d92b15fa2e259a51c601dc" }, { "8907defd10af0b7c71abfb9c20147adc1b0a1f70" }, { "483b6bdf608afbf1fba6bbca9657a8ca3822eef1" }, }; test_case(true, false, false, expected_sha1); test_case(true, false, true, expected_sha1); }
TEST(DepthConvertTest, test_full_chroma) { const char *expected_sha1[][3] = { { "333be81b7364a126a2a6167522b539cfad599814" }, { "48a95801578c440f7180c799bdc344a873c6d8d6" }, { "a4a5448b98ab83e68afde9582dec61d37eb610bb" }, { "ad93453f70f4d010049bb6c9e29307ddeee4fa5b" }, { "4da423338093bef435e64b494bf13f40ec6c0ae6" }, { "ef824bbfe3dc3f9cc4094d50d48091fa5f5fec7e" }, { "4da423338093bef435e64b494bf13f40ec6c0ae6" }, { "39ba7172306b4c4a16089265e1839d80010ec14f" }, }; test_case(true, true, false, expected_sha1); test_case(true, true, true, expected_sha1); }
TEST(DepthConvertTest, test_limited_luma) { const char *expected_sha1[][3] = { { "a7096d8251091eb2188bb2bec9fee9d0495faf2c" }, { "705050fb0e56681004ede72126bd264d6c4268d9" }, { "f8c1a8d19a442a5fb480d8b77a347a6326f3e640" }, { "5c813b8fda21c1dd3505f165ea0e718eb9e8a427" }, { "8907defd10af0b7c71abfb9c20147adc1b0a1f70" }, { "68442b2c5704fd2792d92b15fa2e259a51c601dc" }, { "8907defd10af0b7c71abfb9c20147adc1b0a1f70" }, { "483b6bdf608afbf1fba6bbca9657a8ca3822eef1" }, }; test_case(false, false, false, expected_sha1); test_case(false, false, true, expected_sha1); }
int main() { int tests = 0; scanf("%d", &tests); for (int test_id = 1; test_id <= tests; test_id++) test_case(test_id); return 0; }
int main() { srand(time(NULL)); T = MAXT; while (T) test_case(); return 0; }
int main() { srand(time(NULL)); int T = MAXT; printf("%d\n", T); while (T--) test_case(); return 0; }
TEST(ResizeImplSSETest, test_resize_v_f32) { const unsigned w = 640; const unsigned src_h = 480; const unsigned dst_h = 720; const zimg::PixelType type = zimg::PixelType::FLOAT; const char *expected_sha1[][3] = { { "6b7507617dc89d5d3077f9cc4c832b261dea2be0" }, { "d07a8c6f3452ada7bd865a3283dc308176541db3" }, { "bda98bc253213d2e28a54c6ccb7496f0ca5a3b7d" }, { "6ba3876cd08a5b11ee646954b52b379a3d8b1228" } }; const double expected_snr = 120.0; test_case(zimg::resize::BilinearFilter{}, false, w, src_h, w, dst_h, type, expected_sha1[0], expected_snr); test_case(zimg::resize::Spline16Filter{}, false, w, src_h, w, dst_h, type, expected_sha1[1], expected_snr); test_case(zimg::resize::LanczosFilter{ 4 }, false, w, src_h, w, dst_h, type, expected_sha1[2], expected_snr); test_case(zimg::resize::LanczosFilter{ 4 }, false, w, dst_h, w, src_h, type, expected_sha1[3], expected_snr); }