file_manip_tests.cpp File Reference

#include <unistd.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <list>
#include "file_manip.h"
Include dependency graph for file_manip_tests.cpp:

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 []

Detailed Description

Remarks:
Copyright 2003 OProfile authors
Read the file COPYING
Author:
John Levon
Philippe Elie

Definition in file file_manip_tests.cpp.


Define Documentation

#define MAKE_PAIR ( a,
 )     make_pair(string(a), string(b))

Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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 
) [inline, static]

Definition at line 43 of file file_manip_tests.cpp.

template<typename Input , typename Output , typename Result >
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().

Here is the caller graph for this function:

void create_file_list_tests (  ) 

Definition at line 217 of file file_manip_tests.cpp.

References create_file_list().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  ,
char *  argv[] 
)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

input_output<char const *, char const*> expect_basename[] [static]
Initial value:
{
    { "/", "/" },
    { "//////", "/" },
    { "/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]
Initial value:
{
    { "/", "/" },
    { "//////", "/" },
    { "/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]
Initial value:
{
    { ".", 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]
Initial value:
 {
#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]
Initial value:
{
    { __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]
Initial value:
{
    
    { "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.


Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1