#include <unistd.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <list>
#include "file_manip.h"
Go to the source code of this file.
Data Structures | |
struct | input_output< Input, Output > |
Defines | |
#define | MAKE_PAIR(a, b) make_pair(string(a), string(b)) |
Functions | |
template<typename Input , typename Output , typename Result > | |
static void | check_result (char const *fct_name, Input const &input, Output const &output, Result const &result) |
template<typename Input , typename Output , typename Result > | |
static void | check_result (char const *fct_name, Input const &input1, Input input2, Output const &output, Result const &result) |
static void | dirname_tests () |
static void | basename_tests () |
static void | is_directory_tests () |
void | is_files_identical_tests (char const *prog_name) |
static void | op_file_readable_tests () |
static void | realpath_tests () |
void | create_file_list_tests () |
int | main (int, char *argv[]) |
Variables | |
static input_output< char const *, char const * > | expect_dirname [] |
static input_output< char const *, char const * > | expect_basename [] |
static input_output< char const *, bool > | expect_is_directory [] |
static input_output< pair < string, string >, bool > | expect_is_files_identical [] |
static input_output< char const *, bool > | expect_op_file_readable [] |
static input_output< string, string > | expect_realpath [] |
Definition in file file_manip_tests.cpp.
#define MAKE_PAIR | ( | a, | |||
b | ) | make_pair(string(a), string(b)) |
static void basename_tests | ( | ) | [static] |
Definition at line 106 of file file_manip_tests.cpp.
References check_result(), input_output< Input, Output >::input, op_basename(), and input_output< Input, Output >::output.
Referenced by main().
static void check_result | ( | char const * | fct_name, | |
Input const & | input1, | |||
Input | input2, | |||
Output const & | output, | |||
Result const & | result | |||
) | [inline, static] |
Definition at line 43 of file file_manip_tests.cpp.
static void check_result | ( | char const * | fct_name, | |
Input const & | input, | |||
Output const & | output, | |||
Result const & | result | |||
) | [inline, static] |
Definition at line 30 of file file_manip_tests.cpp.
Referenced by basename_tests(), dirname_tests(), is_directory_tests(), is_files_identical_tests(), main(), op_file_readable_tests(), and realpath_tests().
void create_file_list_tests | ( | ) |
Definition at line 217 of file file_manip_tests.cpp.
References create_file_list().
Referenced by main().
static void dirname_tests | ( | ) | [static] |
Definition at line 78 of file file_manip_tests.cpp.
References check_result(), input_output< Input, Output >::input, op_dirname(), and input_output< Input, Output >::output.
Referenced by main().
static void is_directory_tests | ( | ) | [static] |
Definition at line 128 of file file_manip_tests.cpp.
References check_result(), input_output< Input, Output >::input, is_directory(), and input_output< Input, Output >::output.
Referenced by main().
void is_files_identical_tests | ( | char const * | prog_name | ) |
Definition at line 149 of file file_manip_tests.cpp.
References check_result(), expect_is_files_identical, input_output< Input, Output >::input, is_files_identical(), and input_output< Input, Output >::output.
Referenced by main().
int main | ( | int | , | |
char * | argv[] | |||
) |
Definition at line 231 of file file_manip_tests.cpp.
References basename_tests(), create_file_list_tests(), dirname_tests(), is_directory_tests(), is_files_identical_tests(), op_file_readable_tests(), and realpath_tests().
static void op_file_readable_tests | ( | ) | [static] |
Definition at line 178 of file file_manip_tests.cpp.
References check_result(), input_output< Input, Output >::input, op_file_readable(), and input_output< Input, Output >::output.
Referenced by main().
static void realpath_tests | ( | ) | [static] |
Definition at line 203 of file file_manip_tests.cpp.
References check_result(), input_output< Input, Output >::input, op_realpath(), and input_output< Input, Output >::output.
Referenced by main().
input_output<char const *, char const*> expect_basename[] [static] |
{ { "/", "/" }, { "//////", "/" }, { "/usr", "usr" }, { "///usr", "usr" }, { "///usr/dir", "dir" }, { "///usr//dir", "dir" }, { "usr/dir", "dir" }, { "usr", "usr" }, { "../..", ".." }, { "/../..", ".." }, { "./..", ".." }, { "./.", "." }, { ".", "." }, { 0, 0 } }
Definition at line 88 of file file_manip_tests.cpp.
input_output<char const *, char const *> expect_dirname[] [static] |
{ { "/", "/" }, { "//////", "/" }, { "/usr", "/" }, { "///usr", "/" }, { "///usr/dir", "///usr" }, { "usr/dir", "usr" }, { "usr", "." }, { "n", "." }, { "../..", ".." }, { "/../..", "/.." }, { "./..", "." }, { "./.", "." }, { "..", "." }, { ".", "." }, { "", "." }, { 0, 0 } }
Definition at line 57 of file file_manip_tests.cpp.
input_output<char const *, bool> expect_is_directory[] [static] |
{ { ".", true }, { "/.", true }, { "./", true }, { "/", true }, { "../", true }, { "../.", true }, { "non_existing_dir", false }, { 0, 0 } }
Definition at line 116 of file file_manip_tests.cpp.
input_output<pair<string, string>, bool> expect_is_files_identical[] [static] |
{ #define MAKE_PAIR(a, b) { MAKE_PAIR(__FILE__, __FILE__), true }, { MAKE_PAIR(__FILE__, "not_existing"), false }, { MAKE_PAIR("not_exisiting", __FILE__), false }, { MAKE_PAIR("not_exisiting", "not_existing"), false }, { MAKE_PAIR("", ""), false } }
Definition at line 139 of file file_manip_tests.cpp.
Referenced by is_files_identical_tests().
input_output<char const *, bool> expect_op_file_readable[] [static] |
{ { __FILE__, true }, { "./" __FILE__, true }, { ".", false }, { "/.", false }, { "./", false }, { "/", false }, { "../", false }, { "../.", false }, { "non_existing_file", false }, { 0, 0 } }
Definition at line 164 of file file_manip_tests.cpp.
input_output<string, string> expect_realpath[] [static] |
{ { "file_manip_tests.o", "file_manip_tests.o" }, { "../tests/" "file_manip_tests.o", "file_manip_tests.o" }, { ".//.//" "file_manip_tests.o", "file_manip_tests.o" }, { "//", "/" }, { "//usr", "/usr" }, { "///", "/" }, { "", "" } }
Definition at line 188 of file file_manip_tests.cpp.