Added mtime/ctime tests

This commit is contained in:
Sebastian Messmer 2014-11-20 16:33:52 +01:00
parent 32b552dd6b
commit 7055cd295d
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,33 @@
#include "testutils/FuseLstatReturnTest.h"
class FuseLstatReturnCtimeTest: public FuseLstatReturnTest<time_t> {
public:
const time_t CTIME1 = 0;
const time_t CTIME2 = 100;
const time_t CTIME3 = 1416496809; // current timestamp as of writing the test
const time_t CTIME4 = 32503680000; // needs a 64bit timestamp
private:
void set(struct stat *stat, time_t value) override {
stat->st_ctime = value;
}
};
TEST_F(FuseLstatReturnCtimeTest, ReturnedFileCtimeIsCorrect1) {
struct ::stat result = CallFileLstatWithValue(CTIME1);
EXPECT_EQ(CTIME1, result.st_ctime);
}
TEST_F(FuseLstatReturnCtimeTest, ReturnedFileCtimeIsCorrect2) {
struct ::stat result = CallFileLstatWithValue(CTIME2);
EXPECT_EQ(CTIME2, result.st_ctime);
}
TEST_F(FuseLstatReturnCtimeTest, ReturnedFileCtimeIsCorrect3) {
struct ::stat result = CallFileLstatWithValue(CTIME3);
EXPECT_EQ(CTIME3, result.st_ctime);
}
TEST_F(FuseLstatReturnCtimeTest, ReturnedFileCtimeIsCorrect4) {
struct ::stat result = CallFileLstatWithValue(CTIME4);
EXPECT_EQ(CTIME4, result.st_ctime);
}

View File

@ -0,0 +1,33 @@
#include "testutils/FuseLstatReturnTest.h"
class FuseLstatReturnMtimeTest: public FuseLstatReturnTest<time_t> {
public:
const time_t MTIME1 = 0;
const time_t MTIME2 = 100;
const time_t MTIME3 = 1416496809; // current timestamp as of writing the test
const time_t MTIME4 = 32503680000; // needs a 64bit timestamp
private:
void set(struct stat *stat, time_t value) override {
stat->st_mtime = value;
}
};
TEST_F(FuseLstatReturnMtimeTest, ReturnedFileMtimeIsCorrect1) {
struct ::stat result = CallFileLstatWithValue(MTIME1);
EXPECT_EQ(MTIME1, result.st_mtime);
}
TEST_F(FuseLstatReturnMtimeTest, ReturnedFileMtimeIsCorrect2) {
struct ::stat result = CallFileLstatWithValue(MTIME2);
EXPECT_EQ(MTIME2, result.st_mtime);
}
TEST_F(FuseLstatReturnMtimeTest, ReturnedFileMtimeIsCorrect3) {
struct ::stat result = CallFileLstatWithValue(MTIME3);
EXPECT_EQ(MTIME3, result.st_mtime);
}
TEST_F(FuseLstatReturnMtimeTest, ReturnedFileMtimeIsCorrect4) {
struct ::stat result = CallFileLstatWithValue(MTIME4);
EXPECT_EQ(MTIME4, result.st_mtime);
}