00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef INCL_SYNCEVOLUTION_UTIL
00020 # define INCL_SYNCEVOLUTION_UTIL
00021
00022 #include <base/test.h>
00023
00024 #include <boost/algorithm/string/case_conv.hpp>
00025 #include <boost/algorithm/string/predicate.hpp>
00026
00027 #include <vector>
00028 #include <sstream>
00029 #include <string>
00030 #include <utility>
00031 using namespace std;
00032
00033
00034 template <class T> class Nocase : public std::binary_function<T, T, bool> {
00035 public:
00036 bool operator()(const T &x, const T &y) const { return boost::ilexicographical_compare(x, y); }
00037 };
00038
00039
00040 template <class T> class Iequals : public std::binary_function<T, T, bool> {
00041 public:
00042 bool operator()(const T &x, const T &y) const { return boost::iequals(x, y); }
00043 };
00044
00045
00046 typedef pair<string, string> StringPair;
00047
00048
00049
00050
00051
00052 string normalizePath(const string &path);
00053
00054
00055 void mkdir_p(const string &path);
00056
00057
00058 void rm_r(const string &path);
00059
00060
00061 bool isDir(const string &path);
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 class UUID : public string {
00075 public:
00076 UUID();
00077 };
00078
00079
00080
00081
00082
00083
00084 class ReadDir {
00085 public:
00086 ReadDir(const string &path);
00087
00088 typedef vector<string>::const_iterator const_iterator;
00089 typedef vector<string>::iterator iterator;
00090 iterator begin() { return m_entries.begin(); }
00091 iterator end() { return m_entries.end(); }
00092 const_iterator begin() const { return m_entries.begin(); }
00093 const_iterator end() const { return m_entries.end(); }
00094
00095 private:
00096 string m_path;
00097 vector<string> m_entries;
00098 };
00099
00100
00101
00102
00103
00104
00105
00106 #define SYNCEVOLUTION_TEST_SUITE_REGISTRATION( ATestFixtureType ) \
00107 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ATestFixtureType, "SyncEvolution" ); \
00108 extern "C" { int funambolAutoRegisterRegistry ## ATestFixtureType = 12345; }
00109
00110
00111 #endif // INCL_SYNCEVOLUTION_UTIL