proxygen
DwarfTests.cpp File Reference

Go to the source code of this file.

Functions

void checkPath (std::string expectedPath, std::string expectedBaseDir, std::string expectedSubDir, std::string expectedFile, std::string rawBaseDir, std::string rawSubDir, std::string rawFile)
 
 TEST (Dwarf, Path)
 

Function Documentation

void checkPath ( std::string  expectedPath,
std::string  expectedBaseDir,
std::string  expectedSubDir,
std::string  expectedFile,
std::string  rawBaseDir,
std::string  rawSubDir,
std::string  rawFile 
)

Definition at line 23 of file DwarfTests.cpp.

References string.

Referenced by TEST().

30  {
31  Dwarf::Path path(rawBaseDir, rawSubDir, rawFile);
32 
33  CHECK_EQ(expectedBaseDir, path.baseDir())
34  << "Path(" << rawBaseDir << ", " << rawSubDir << ", " << rawFile << ")";
35  CHECK_EQ(expectedSubDir, path.subDir())
36  << "Path(" << rawBaseDir << ", " << rawSubDir << ", " << rawFile << ")";
37  CHECK_EQ(expectedFile, path.file())
38  << "Path(" << rawBaseDir << ", " << rawSubDir << ", " << rawFile << ")";
39 
40  CHECK_EQ(expectedPath, path.toString());
41 
42  // Check the the `toBuffer` function.
43  char buf[1024];
44  size_t len;
45  len = path.toBuffer(buf, 1024);
46  CHECK_EQ(expectedPath, std::string(buf, len));
47 }
const char * string
Definition: Conv.cpp:212
TEST ( Dwarf  ,
Path   
)

Definition at line 49 of file DwarfTests.cpp.

References checkPath().

49  {
50  checkPath("hello.cpp", "", "", "hello.cpp", "", "", "hello.cpp");
51  checkPath("foo/hello.cpp", "foo", "", "hello.cpp", "foo", "", "hello.cpp");
52  checkPath("foo/hello.cpp", "foo", "", "hello.cpp", "", "foo", "hello.cpp");
53  checkPath("hello.cpp", "", "", "hello.cpp", "./////", "./////", "hello.cpp");
54  checkPath("/hello.cpp", "/", "", "hello.cpp", "/////", "./////", "hello.cpp");
55  checkPath(
56  "/hello.cpp", "/", "", "hello.cpp", "/./././././././", "", "hello.cpp");
57 }
void checkPath(std::string expectedPath, std::string expectedBaseDir, std::string expectedSubDir, std::string expectedFile, std::string rawBaseDir, std::string rawSubDir, std::string rawFile)
Definition: DwarfTests.cpp:23