Documentation for OpenFLUID 2.2.0
FilesystemCommon.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 
33 /**
34  @file FilesystemCommon.hpp
35 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37 */
38 
39 
40 #ifndef __OPENFLUID_TOOLSTESTS_FILESYSTEMCOMMON_HPP__
41 #define __OPENFLUID_TOOLSTESTS_FILESYSTEMCOMMON_HPP__
42 
43 
44 #include "tests-config.hpp"
45 
46 
47 // =====================================================================
48 // =====================================================================
49 
50 
51 template<class A,class E>
52 struct TestInfo
53 {
56 };
57 
58 template<class A,class E>
59 using TestInfoList = std::vector<TestInfo<A,E>>;
60 
61 template<class A>
62 using BoolTestInfoList = std::vector<A>;
63 
64 
65 // =====================================================================
66 // =====================================================================
67 
68 
70  {{"/my/joined","path/myfile.txt"},"/my/joined/path/myfile.txt"},
71  {{"/my/joined",""},"/my/joined/"},
72  {{"","path/myfile.txt"},"/path/myfile.txt"},
73  {{"",""},"/"}
74 };
75 
76 // -----------------
77 
79  {"/my/path/myfile.txt",{"my","path","myfile.txt"}},
80  {"/my/path/mydir/mysubdir/",{"my","path","mydir","mysubdir"}},
81  {"//my///path////mydir////",{"my","path","mydir"}}
82 };
83 
84 // -----------------
85 
87  {"/my/path1","/my/path1/subdir"},
88  {"/my/path2//","/my/path2/subdir"},
89  {"/my/path3","/my/path3/subdir//"},
90  {"/my/path4","/my/path4"},
91  {"/my/path5/","/my/path5"},
92  {"/my/path6","/my/path6/"},
93  {"/my/path7","/my/path7/subdir/subsubdir/subsubsubdir/////"}
94 };
95 
96 // -----------------
97 
99  {"/","/"},
100  {"///","/"},
101  {"/my/path1/","/my/path1"},
102  {"/my/path2","/my/path2"},
103  {"/my/path3//","/my/path3"},
104  {"/my/path4///////////////////","/my/path4"},
105  {"my/path5/","my/path5"},
106  {"my/path6","my/path6"},
107  {"my/path7//","my/path7"},
108  {"my/path8///////////////////","my/path8"}
109 };
110 
112  {{"c:\\my\\path1",'\\'},"c:\\my\\path1"},
113  {{"c:\\my\\path2\\",'\\'},"c:\\my\\path2"},
114  {{"c:\\my\\path3\\\\\\\\\\",'\\'},"c:\\my\\path3"},
115  {{"c:/my/path4/////",'/'},"c:/my/path4"},
116  {{"my\\path5\\\\\\\\\\",'\\'},"my\\path5"},
117  {{"e:\\\\\\",'\\'},"e:\\"},
118  {{"S:\\\\\\",'\\'},"S:\\"}
119 };
120 
121 
122 // -----------------
123 
125  {"/my/path1","/my/path1"},
126  {"/my/path2/","/my/path2/"},
127  {"/my\\\\path3/","/my\\\\path3/"},
128  {"my\\\\path4/\\\\","my\\\\path4/\\\\"}
129 };
130 
132  {"/my/path1","/my/path1"},
133  {"/my/path2/","/my/path2"},
134  {"/my\\\\path3//","/my\\\\path3"},
135  {"my\\\\path4//\\\\","my\\\\path4/\\\\"}
136 };
137 
139  {"/my/path1","/my/path1"},
140  {"/my\\\\path2//","/my\\\\path2//"},
141  {"my\\\\path3//\\\\","my\\\\path3//\\\\"}
142 };
143 
145  {"/my/path1","/my/path1"},
146  {"/my\\\\path2//","/my/path2/"},
147  {"my\\\\path3//\\\\","my/path3/"},
148  {"a:/my/path4/","a:/my/path4/"},
149  {"A:/my\\\\path5//","A:/my/path5/"}
150 };
151 
153  {"/my/path1","/my/path1"},
154  {"/my\\\\path2//","/my/path2"},
155  {"my\\\\path3//\\\\","my/path3"},
156  {"a:/my/path4/","a:/my/path4"},
157  {"A:/my\\\\path5//","A:/my/path5"}
158 };
159 
161  {"c:/my/path1","c:\\my\\path1"},
162  {"c:/my\\path2","c:\\my\\path2"}
163 };
164 
165 // -----------------
166 
168  // filename, dirname, basename, extension, minimalBasename, completeExtension
169  {"/my/path/myfile.txt",{"myfile.txt","/my/path","myfile","txt","myfile","txt"}},
170  {"/my/other/path",{"path","/my/other","path","","path",""}},
171  {"/my/path/",{"","/my/path","","","",""}},
172  {"/my/path/myarchive.tar.gz",{"myarchive.tar.gz","/my/path","myarchive.tar","gz","myarchive","tar.gz"}}/*,
173  {"file:///url/like/path/file.txt",{"file.txt","file:/url/like/path","file","txt","file","txt"}},
174  {"http://url/like/path/file.txt",{"file.txt","http:/url/like/path","file","txt","file","txt"}}*/
175 };
176 
177 // -----------------
178 
180  {{"/path/to/directory","/path/to"},"directory"},
181  {{"/path/to/directory/subdirectory","/path/to"},"directory/subdirectory"}
182 };
183 
184 // -----------------
185 
187  {CONFIGTESTS_BINARY_DIR,true},
188  {CONFIGTESTS_SRC_DIR+"/CMakeLists.txt",false}
189 };
190 
192  {CONFIGTESTS_BINARY_DIR,false},
193  {CONFIGTESTS_SRC_DIR+"/CMakeLists.txt",true}
194 };
195 
197  {CONFIGTESTS_BINARY_DIR,true},
198  {CONFIGTESTS_SRC_DIR+"/CMakeLists.txt",true},
199  {CONFIGTESTS_SRC_DIR+"/doesnotexists.txt",false},
200 };
201 
202 
203 #endif /* __OPENFLUID_TOOLSTESTS_FILESYSTEMCOMMON_HPP__ */
const TestInfoList< std::string, std::string > WinPathsToGenericClean
Definition: FilesystemCommon.hpp:152
const TestInfoList< std::string, std::vector< std::string > > PathsComponents
Definition: FilesystemCommon.hpp:167
const TestInfoList< std::vector< std::string >, std::string > JoinedPaths
Definition: FilesystemCommon.hpp:69
std::vector< A > BoolTestInfoList
Definition: FilesystemCommon.hpp:62
const TestInfoList< std::pair< std::string, char >, std::string > WinPathsWithTrailing
Definition: FilesystemCommon.hpp:111
const TestInfoList< std::string, std::vector< std::string > > SplittedPaths
Definition: FilesystemCommon.hpp:78
const TestInfoList< std::string, bool > ExistsPaths
Definition: FilesystemCommon.hpp:196
const BoolTestInfoList< std::pair< std::string, std::string > > ContainedPaths
Definition: FilesystemCommon.hpp:86
const TestInfoList< std::string, std::string > WinPathsToNative
Definition: FilesystemCommon.hpp:160
const TestInfoList< std::pair< std::string, std::string >, std::string > RelativePaths
Definition: FilesystemCommon.hpp:179
const TestInfoList< std::string, bool > IsFilePaths
Definition: FilesystemCommon.hpp:191
const TestInfoList< std::string, std::string > UnixPathsWithTrailing
Definition: FilesystemCommon.hpp:98
const TestInfoList< std::string, std::string > UnixPathsToGenericClean
Definition: FilesystemCommon.hpp:131
const TestInfoList< std::string, std::string > UnixPathsToGeneric
Definition: FilesystemCommon.hpp:124
const TestInfoList< std::string, bool > IsDirPaths
Definition: FilesystemCommon.hpp:186
const TestInfoList< std::string, std::string > UnixPathsToNative
Definition: FilesystemCommon.hpp:138
const TestInfoList< std::string, std::string > WinPathsToGeneric
Definition: FilesystemCommon.hpp:144
std::vector< TestInfo< A, E > > TestInfoList
Definition: FilesystemCommon.hpp:59
Definition: FilesystemCommon.hpp:53
E Expected
Definition: FilesystemCommon.hpp:55
A Arguments
Definition: FilesystemCommon.hpp:54