MCPcopy Create free account
hub / github.com/PDAL/PDAL / TEST

Function TEST

test/unit/FileUtilsTest.cpp:50–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48using namespace pdal;
49
50TEST(FileUtilsTest, test_file_ops)
51{
52 std::string tmp1(Support::temppath("unittest1.tmp"));
53 std::string tmp2(Support::temppath("unittest2.tmp"));
54
55 // first, clean up from any previous test run
56 FileUtils::deleteFile(tmp1);
57 FileUtils::deleteFile(tmp2);
58 EXPECT_TRUE(FileUtils::fileExists(tmp1)==false);
59 EXPECT_TRUE(FileUtils::fileExists(tmp2)==false);
60
61 // write test
62 std::ostream* ostr = FileUtils::createFile(tmp1);
63 *ostr << "yow";
64 FileUtils::closeFile(ostr);
65
66 EXPECT_EQ(FileUtils::fileExists(tmp1), true);
67 EXPECT_EQ(FileUtils::fileSize(tmp1), 3U);
68
69 // rename test
70 FileUtils::renameFile(tmp2,tmp1);
71 EXPECT_TRUE(FileUtils::fileExists(tmp1)==false);
72 EXPECT_TRUE(FileUtils::fileExists(tmp2)==true);
73
74 // read test
75 std::istream* istr = FileUtils::openFile(tmp2);
76 std::string yow;
77 *istr >> yow;
78 FileUtils::closeFile(istr);
79 EXPECT_TRUE(yow=="yow");
80
81 // delete test
82 FileUtils::deleteFile(tmp2);
83 EXPECT_TRUE(FileUtils::fileExists(tmp2)==false);
84
85 EXPECT_THROW(FileUtils::openFile("~foo1.glob"), pdal::pdal_error);
86 EXPECT_NO_THROW(FileUtils::openFile("foo~1.glob"));
87}
88
89TEST(FileUtilsTest, test_vsi)
90{

Callers

nothing calls this directly

Calls 15

temppathFunction · 0.85
deleteFileFunction · 0.85
renameFileFunction · 0.85
datapathFunction · 0.85
readFileIntoStringFunction · 0.85
getcwdFunction · 0.85
toAbsolutePathFunction · 0.85
compare_pathsFunction · 0.85
getDirectoryFunction · 0.85
isAbsolutePathFunction · 0.85
getFilenameFunction · 0.85
extensionFunction · 0.85

Tested by

no test coverage detected