Datasets:

Modalities:
Image
Text
Formats:
text
Size:
< 1K
Libraries:
Datasets
License:
File size: 1,891 Bytes
5b89cb9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <test_common.h>
#include <igl/dirname.h>

#include <string>
#include <vector>
#include <tuple>

TEST_CASE("dirname: examples", "[igl]")
{
  const std::vector<
    std::tuple<std::string,std::string> >
    examples = 
  {
    std::make_tuple("/foo"                 ,"/"           ),
    std::make_tuple("/foo/"                ,"/"           ),
    std::make_tuple("/foo//"               ,"/"           ),
    std::make_tuple("/foo/./"              ,"/foo"        ),
    std::make_tuple("/foo/bar"             ,"/foo"        ),
    std::make_tuple("/foo/bar."            ,"/foo"        ),
    std::make_tuple("/foo/bar.txt"         ,"/foo"        ),
    std::make_tuple("/foo/bar.txt.zip"     ,"/foo"        ),
    std::make_tuple("/foo/bar.dir/"        ,"/foo"        ),
    std::make_tuple("/foo/bar.dir/file"    ,"/foo/bar.dir"),
    std::make_tuple("/foo/bar.dir/file.txt","/foo/bar.dir"),
    std::make_tuple("."                   ,"."           ),
    std::make_tuple("../foo"              ,".."           ),
    std::make_tuple("./foo"              ,"."           ),
    std::make_tuple("../foo/"             ,".."           ),
    std::make_tuple("foo/"               ,"."           ),
    std::make_tuple("foo//"               ,"."           ),
    std::make_tuple("foo/./"              ,"foo"        ),
    std::make_tuple("foo/bar"             ,"foo"        ),
    std::make_tuple("foo/bar."            ,"foo"        ),
    std::make_tuple("foo/bar.txt"         ,"foo"        ),
    std::make_tuple("foo/bar.txt.zip"     ,"foo"        ),
    std::make_tuple("foo/bar.dir/"        ,"foo"        ),
    std::make_tuple("foo/bar.dir/file"    ,"foo/bar.dir"),
    std::make_tuple("foo/bar.dir/file.txt","foo/bar.dir")
  };
  for(const auto & example : examples)
  {
    std::string d;
    d = igl::dirname(std::get<0>(example));
    REQUIRE (d == std::get<1>(example));
  }
}