diff options
| author | Martin Ridgers <[email protected]> | 2021-10-25 14:21:37 +0200 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-10-25 22:50:43 +0200 |
| commit | 432f0ba2724fd275a0e29c9dd2b83823604e6f51 (patch) | |
| tree | 20ccd939407e73ca010ec376168ea9c5b91d0979 /zencore/filesystem.cpp | |
| parent | Included a sketch of how CloneFile() could be on Linux (diff) | |
| download | zen-432f0ba2724fd275a0e29c9dd2b83823604e6f51.tar.xz zen-432f0ba2724fd275a0e29c9dd2b83823604e6f51.zip | |
Added ScanFile() and ReadFile() tests
Diffstat (limited to 'zencore/filesystem.cpp')
| -rw-r--r-- | zencore/filesystem.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp index 25fe371c5..e37153ac3 100644 --- a/zencore/filesystem.cpp +++ b/zencore/filesystem.cpp @@ -987,6 +987,16 @@ TEST_CASE("filesystem") FileSystemTraversal().TraverseFileSystem(BinPath.parent_path().parent_path(), Visitor); CHECK(Visitor.bFoundExpected); + + // Scan/read file + FileContents BinRead = ReadFile(BinPath); + std::vector<uint8_t> BinScan; + ScanFile(BinPath, 16 << 10, [&] (const void* Data, size_t Size) { + const auto* Ptr = (uint8_t*)Data; + BinScan.insert(BinScan.end(), Ptr, Ptr + Size); + }); + CHECK_EQ(BinRead.Data.size(), 1); + CHECK_EQ(BinScan.size(), BinRead.Data[0].GetSize()); } TEST_CASE("PathBuilder") |