void test_remove(void) { int ntests = 0, lost_points = 0; int result; test_remove_path(&ntests, &lost_points); ntests++; result = remove_dir(); handle_result(result, &lost_points); ntests++; result = remove_dot(); handle_result(result, &lost_points); ntests++; result = remove_dotdot(); handle_result(result, &lost_points); ntests++; result = remove_empty(); handle_result(result, &lost_points); if(!lost_points) success(TEST161_SUCCESS, SECRET, "/testbin/badcall"); }
char *path_simplifier(char *path) { int i; int len; t_path *path_list; i = 0; path_list = NULL; while (path[i]) { len = 0; while (path[i] && path[i] == '/') i++; while (path[i + len] && path[i + len] != '/') len++; add_path(&path_list, ft_strsub(path, i, len)); i += len; } remove_dot(&path_list); remove_dotdot(&path_list, path_list); free(path); path = rebuild_path(path_list); free_pathlist(path_list); return (path); }
void test_remove(void) { test_remove_path(); remove_dir(); remove_dot(); remove_dotdot(); remove_empty(); }