diff --git a/src/test/fspp/fuse/lstat/FuseLstatReturnCtimeTest.cpp b/src/test/fspp/fuse/lstat/FuseLstatReturnCtimeTest.cpp new file mode 100644 index 00000000..3708299b --- /dev/null +++ b/src/test/fspp/fuse/lstat/FuseLstatReturnCtimeTest.cpp @@ -0,0 +1,33 @@ +#include "testutils/FuseLstatReturnTest.h" + +class FuseLstatReturnCtimeTest: public FuseLstatReturnTest { +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); +} diff --git a/src/test/fspp/fuse/lstat/FuseLstatReturnMtimeTest.cpp b/src/test/fspp/fuse/lstat/FuseLstatReturnMtimeTest.cpp new file mode 100644 index 00000000..2821e0c9 --- /dev/null +++ b/src/test/fspp/fuse/lstat/FuseLstatReturnMtimeTest.cpp @@ -0,0 +1,33 @@ +#include "testutils/FuseLstatReturnTest.h" + +class FuseLstatReturnMtimeTest: public FuseLstatReturnTest { +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); +}