Skip to content

Commit

Permalink
Add more tests for existence of VFS files
Browse files Browse the repository at this point in the history
Ensure the presence of the files in the models PK4, using both getFileCount()
and walking the tree with forEachFile().
  • Loading branch information
Matthew Mott committed Feb 26, 2019
1 parent a4f838e commit cb966cf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions radiant/test/vfsTest.cpp
Expand Up @@ -34,5 +34,19 @@ BOOST_AUTO_TEST_CASE(readFilesFromVFS)
// Check presence of some files
BOOST_TEST(fs.getFileCount("nothere") == 0);
BOOST_TEST(fs.getFileCount("materials/example.mtr") == 1);
BOOST_TEST(fs.getFileCount("models/darkmod/test/unit_cube.ase") == 1);
BOOST_TEST(fs.getFileCount("models/darkmod/test/unit_cube_blah.ase") == 0);
BOOST_TEST(fs.getFileCount("models/darkmod/test/unit_cube.lwo") == 1);

// Use a visitor to walk the tree
std::set<std::string> foundFiles;
fs.forEachFile(
"", "*",
[&](const vfs::FileInfo& fi) { foundFiles.insert(fi.name); },
0
);
BOOST_TEST(foundFiles.count("dummy") == 0);
BOOST_TEST(foundFiles.count("materials/example.mtr") == 1);
BOOST_TEST(foundFiles.count("models/darkmod/test/unit_cube.ase") == 1);
}

0 comments on commit cb966cf

Please sign in to comment.