int main(int argc, char *argv[]) { plan_lazy(); // escape safe strings test_escape("", ""); test_escape("abc-xyz_012-789.com", "abc-xyz_012-789.com"); test_escape("EXAMple.com", "example.com"); test_escape("_.-AZaz09", "_.-azaz09"); // escape unsafe strings test_escape("abc\\def", "abc\\x5cdef"); test_escape("xyz/jkl", "xyz\\x2fjkl"); test_escape("aaa?bbb#ccc*ddd", "aaa\\x3fbbb\\x23ccc\\x2addd"); test_escape("!$%&()", "\\x21\\x24\\x25\\x26\\x28\\x29"); // test safe unescape test_unescape("", ""); test_unescape("abc-xyz_012-789.com", "abc-xyz_012-789.com"); test_unescape("examPLE.net", NULL); test_unescape("@", NULL); // test unsafe unescape test_unescape("opq\\x40rst", "opq@rst"); test_unescape("_\\x40-42\\x2eaz", "*****@*****.**"); test_unescape("\\x3f\\x2a\\x28\\x3d\\x22\\x27\\x5c\\x2f", "?*(=\"\'\\/"); test_unescape("new\\x0aline", "new\nline"); // invalid unsafe unescape test_unescape("a\\", NULL); test_unescape("a\\z", NULL); test_unescape("a\\x", NULL); test_unescape("a\\x00b", NULL); test_unescape("a\\xgg", NULL); // unicode escape test_escape("křemílek.cz", "k\\xc5\\x99em\\xc3\\xadlek.cz"); test_escape("www.vochomůrka", "www.vochom\\xc5\\xafrka"); // unicode unescape test_unescape("br\\xc4\\x8d\\xc3\\xa1ln\\xc3\\xadk.eu", "brčálník.eu"); test_unescape("\\xc4\\x8dty\\xc5\\x99i.\\xc5\\xa1neci", "čtyři.šneci"); return 0; }
static void test_dbd_generic(abts_case *tc, apr_dbd_t* handle, const apr_dbd_driver_t* driver) { void* native; apr_pool_t *pool = p; apr_status_t rv; native = apr_dbd_native_handle(driver, handle); ABTS_PTR_NOTNULL(tc, native); rv = apr_dbd_check_conn(driver, pool, handle); create_table(tc, handle, driver); select_rows(tc, handle, driver, 0); insert_data(tc, handle, driver, 5); select_rows(tc, handle, driver, 5); delete_rows(tc, handle, driver); select_rows(tc, handle, driver, 0); drop_table(tc, handle, driver); test_escape(tc, handle, driver); rv = apr_dbd_close(driver, handle); ABTS_ASSERT(tc, "failed to close database", rv == APR_SUCCESS); }
int main(void) { log_set_max_level(LOG_DEBUG); log_parse_environment(); log_open(); test_path_decode_unit(); test_path_get_unit(); test_path_get_user_unit(); test_path_get_session(); test_path_get_owner_uid(); test_path_get_slice(); test_path_get_user_slice(); TEST_REQ_RUNNING_SYSTEMD(test_get_paths()); test_proc(); TEST_REQ_RUNNING_SYSTEMD(test_escape()); test_controller_is_valid(); test_slice_to_path(); test_shift_path(); TEST_REQ_RUNNING_SYSTEMD(test_mask_supported()); TEST_REQ_RUNNING_SYSTEMD(test_is_cgroup_fs()); TEST_REQ_RUNNING_SYSTEMD(test_fd_is_cgroup_fs()); test_is_wanted_print(true); test_is_wanted_print(false); /* run twice to test caching */ test_is_wanted(); return 0; }
/* the main program... */ int main(int argc,char *argv[]) { char *srcdir; char fname[100]; struct sigaction act; /* build the name of the file */ srcdir=getenv("srcdir"); if (srcdir==NULL) srcdir="."; snprintf(fname,sizeof(fname),"%s/nslcd-test.conf",srcdir); fname[sizeof(fname)-1]='\0'; /* initialize configuration */ cfg_init(fname); /* partially initialize logging */ log_setdefaultloglevel(LOG_DEBUG); /* ignore SIGPIPE */ memset(&act,0,sizeof(struct sigaction)); act.sa_handler=SIG_IGN; sigemptyset(&act.sa_mask); act.sa_flags=SA_RESTART|SA_NOCLDSTOP; assert(sigaction(SIGPIPE,&act,NULL)==0); /* do tests */ test_search(); test_get(); test_get_values(); test_get_rdnvalues(); test_two_searches(); test_threads(); test_connections(); test_escape(); return 0; }
int main(void) { test_path_decode_unit(); test_path_get_unit(); test_path_get_user_unit(); test_path_get_session(); test_path_get_owner_uid(); TEST_REQ_RUNNING_SYSTEMD(test_get_paths()); test_proc(); TEST_REQ_RUNNING_SYSTEMD(test_escape()); test_controller_is_valid(); test_slice_to_path(); test_shift_path(); return 0; }
/** Main test */ int main( int argc, char **argv ) { setlocale( LC_ALL, "" ); srand( time( 0 ) ); program_name=L"(ignore)"; say( L"Testing low-level functionality"); say( L"Lines beginning with '(ignore):' are not errors, they are warning messages\ngenerated by the fish parser library when given broken input, and can be\nignored. All actual errors begin with 'Error:'." ); proc_init(); halloc_util_init(); event_init(); parser_init(); function_init(); builtin_init(); reader_init(); env_init(); test_util(); test_escape(); test_convert(); test_tok(); test_parser(); test_expand(); test_path(); say( L"Encountered %d errors in low-level tests", err_count ); /* Skip performance tests for now, since they seem to hang when running from inside make (?) */ // say( L"Testing performance" ); // perf_complete(); env_destroy(); reader_destroy(); parser_destroy(); function_destroy(); builtin_destroy(); wutil_destroy(); event_destroy(); proc_destroy(); halloc_util_destroy(); }
int main() { test_parser(); test_html(); test_escape(); }