| 43 | using namespace std; |
| 44 | |
| 45 | TEST(SupportTest, test_paths) |
| 46 | { |
| 47 | // does the data path work? |
| 48 | string data_file = Support::datapath("las/simple.las"); |
| 49 | EXPECT_TRUE(FileUtils::fileExists(data_file)); |
| 50 | |
| 51 | // make sure we have read access |
| 52 | istream* istr = FileUtils::openFile(data_file); |
| 53 | string yow; |
| 54 | *istr >> yow; |
| 55 | FileUtils::closeFile(istr); |
| 56 | |
| 57 | // does the temp path work? |
| 58 | string temp_file_ok = Support::temppath("README.txt"); |
| 59 | EXPECT_TRUE(FileUtils::fileExists(temp_file_ok)); |
| 60 | string temp_file = Support::temppath("my_temp_file.dat"); |
| 61 | EXPECT_TRUE(!FileUtils::fileExists(temp_file)); |
| 62 | |
| 63 | // make sure we have write access to the temp dir |
| 64 | ostream* ostr = FileUtils::createFile(temp_file); |
| 65 | *ostr << "yow"; |
| 66 | FileUtils::closeFile(ostr); |
| 67 | EXPECT_TRUE(FileUtils::fileExists(temp_file)); |
| 68 | EXPECT_TRUE(FileUtils::deleteFile(temp_file)); |
| 69 | EXPECT_TRUE(!FileUtils::fileExists(temp_file)); |
| 70 | |
| 71 | // does binpath (and exename) work? |
| 72 | string this_bin = Support::exename("pdal"); |
| 73 | #ifdef _WIN32 |
| 74 | EXPECT_EQ(this_bin, "pdal.exe"); |
| 75 | #else |
| 76 | EXPECT_EQ(this_bin, "pdal"); |
| 77 | #endif |
| 78 | this_bin = Support::binpath(this_bin); |
| 79 | EXPECT_TRUE(FileUtils::fileExists(this_bin)); |
| 80 | } |
| 81 | |
| 82 | |
| 83 | TEST(SupportTest, test_diff_file) |
nothing calls this directly
no test coverage detected