Add more tests to FsTest
This commit is contained in:
parent
cf8dfbd884
commit
2c32927587
@ -25,6 +25,28 @@ TYPED_TEST_P(FsppDeviceTest, LoadDirFromRootDir) {
|
||||
this->LoadDir("/mydir");
|
||||
}
|
||||
|
||||
TYPED_TEST_P(FsppDeviceTest, LoadNonexistingFromRootDir) {
|
||||
//TODO Change, as soon as it's clear how we want to handle fs errors
|
||||
EXPECT_ANY_THROW(
|
||||
this->device->Load("/nonexisting")
|
||||
);
|
||||
}
|
||||
|
||||
TYPED_TEST_P(FsppDeviceTest, LoadNonexistingFromNonexistingDir) {
|
||||
//TODO Change, as soon as it's clear how we want to handle fs errors
|
||||
EXPECT_ANY_THROW(
|
||||
this->device->Load("/nonexisting/nonexisting2")
|
||||
);
|
||||
}
|
||||
|
||||
TYPED_TEST_P(FsppDeviceTest, LoadNonexistingFromExistingDir) {
|
||||
this->LoadDir("/")->createDir("mydir", 0);
|
||||
//TODO Change, as soon as it's clear how we want to handle fs errors
|
||||
EXPECT_ANY_THROW(
|
||||
this->device->Load("/mydir/nonexisting")
|
||||
);
|
||||
}
|
||||
|
||||
//TODO Load file/dir which is more nested
|
||||
//TODO Load from dir structure with more than one entry per dir
|
||||
//TODO statfs
|
||||
@ -33,7 +55,10 @@ REGISTER_TYPED_TEST_CASE_P(FsppDeviceTest,
|
||||
InitFilesystem,
|
||||
LoadRootDir,
|
||||
LoadFileFromRootDir,
|
||||
LoadDirFromRootDir
|
||||
LoadDirFromRootDir,
|
||||
LoadNonexistingFromRootDir,
|
||||
LoadNonexistingFromNonexistingDir,
|
||||
LoadNonexistingFromExistingDir
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -30,6 +30,46 @@ TYPED_TEST_P(FsppDirTest, Children_OneDirInRootDir) {
|
||||
EXPECT_EQ("mydir", (*children)[0].name);
|
||||
}
|
||||
|
||||
TYPED_TEST_P(FsppDirTest, Children_OneFileInNestedDir_Directly) {
|
||||
this->LoadDir("/")->createDir("mydir", 0);
|
||||
auto dir = this->LoadDir("/mydir");
|
||||
dir->createAndOpenFile("myfile", 0);
|
||||
auto children = dir->children();
|
||||
EXPECT_EQ(1, children->size());
|
||||
EXPECT_EQ(fspp::Dir::EntryType::FILE, (*children)[0].type);
|
||||
EXPECT_EQ("myfile", (*children)[0].name);
|
||||
}
|
||||
|
||||
TYPED_TEST_P(FsppDirTest, Children_OneFileInNestedDir_AfterReloadingDir) {
|
||||
this->LoadDir("/")->createDir("mydir", 0);
|
||||
this->LoadDir("/mydir")->createAndOpenFile("myfile", 0);
|
||||
auto dir = this->LoadDir("/mydir");
|
||||
auto children = dir->children();
|
||||
EXPECT_EQ(1, children->size());
|
||||
EXPECT_EQ(fspp::Dir::EntryType::FILE, (*children)[0].type);
|
||||
EXPECT_EQ("myfile", (*children)[0].name);
|
||||
}
|
||||
|
||||
TYPED_TEST_P(FsppDirTest, Children_OneDirInNestedDir_Directly) {
|
||||
this->LoadDir("/")->createDir("mydir", 0);
|
||||
auto dir = this->LoadDir("/mydir");
|
||||
dir->createDir("mysubdir", 0);
|
||||
auto children = dir->children();
|
||||
EXPECT_EQ(1, children->size());
|
||||
EXPECT_EQ(fspp::Dir::EntryType::DIR, (*children)[0].type);
|
||||
EXPECT_EQ("mysubdir", (*children)[0].name);
|
||||
}
|
||||
|
||||
TYPED_TEST_P(FsppDirTest, Children_OneDirInNestedDir_AfterReloadingDir) {
|
||||
this->LoadDir("/")->createDir("mydir", 0);
|
||||
this->LoadDir("/mydir")->createDir("mysubdir", 0);
|
||||
auto dir = this->LoadDir("/mydir");
|
||||
auto children = dir->children();
|
||||
EXPECT_EQ(1, children->size());
|
||||
EXPECT_EQ(fspp::Dir::EntryType::DIR, (*children)[0].type);
|
||||
EXPECT_EQ("mysubdir", (*children)[0].name);
|
||||
}
|
||||
|
||||
TYPED_TEST_P(FsppDirTest, CreateAndOpenFile_LoadAfterwards) {
|
||||
this->LoadDir("/")->createAndOpenFile("myfile", 0);
|
||||
this->LoadFile("/myfile");
|
||||
@ -44,11 +84,14 @@ REGISTER_TYPED_TEST_CASE_P(FsppDirTest,
|
||||
Children_EmptyRootDir,
|
||||
Children_OneFileInRootDir,
|
||||
Children_OneDirInRootDir,
|
||||
Children_OneFileInNestedDir_Directly,
|
||||
Children_OneFileInNestedDir_AfterReloadingDir,
|
||||
Children_OneDirInNestedDir_Directly,
|
||||
Children_OneDirInNestedDir_AfterReloadingDir,
|
||||
CreateAndOpenFile_LoadAfterwards,
|
||||
CreateDir_LoadAfterwards
|
||||
);
|
||||
|
||||
//TODO Add File/Dir to subdir/subsubdir and check entries
|
||||
//TODO Build dir structure with more than one entry
|
||||
|
||||
//TODO rmdir
|
||||
|
Loading…
Reference in New Issue
Block a user