| 28 | }; |
| 29 | |
| 30 | void SC::CppSTLFileSystemTest::fileReadWriteTest() |
| 31 | { |
| 32 | // FileSystem |
| 33 | FileSystem fs; |
| 34 | SC_TEST_EXPECT(fs.init(report.applicationRootDirectory.view())); |
| 35 | std::string sampleText = "STL is not so much Sane"; |
| 36 | SC_TEST_EXPECT(fs.writeString("test.txt", asSane(sampleText))); |
| 37 | std::string readFromFS; |
| 38 | std::string_view targetFile = "test.txt"; |
| 39 | SC_TEST_EXPECT(fs.read(asSane(targetFile), readFromFS)); |
| 40 | SC_TEST_EXPECT(readFromFS == sampleText); |
| 41 | |
| 42 | // Path |
| 43 | std::string finalPath; |
| 44 | SC_TEST_EXPECT(Path::join(finalPath, {report.applicationRootDirectory.view(), asSane(targetFile)})); |
| 45 | |
| 46 | // File |
| 47 | FileDescriptor fd; |
| 48 | SC_TEST_EXPECT(fd.open(asSane(finalPath), FileOpen::Mode::Read)); |
| 49 | std::string readFromFD; |
| 50 | SC_TEST_EXPECT(fd.readUntilEOF(readFromFD)); |
| 51 | SC_TEST_EXPECT(readFromFS == readFromFD); |
| 52 | } |
| 53 | |
| 54 | namespace SC |
| 55 | { |
nothing calls this directly
no test coverage detected