diff --git a/CMakeLists.txt b/CMakeLists.txt index 57309140..98f55d04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ INCLUDE(messmer/cmake/tools) +SETUP_GOOGLETEST() + # Actually create targets: EXEcutables and libraries. ADD_BIICODE_TARGETS() diff --git a/biicode.conf b/biicode.conf index 28b43a57..92012d4a 100644 --- a/biicode.conf +++ b/biicode.conf @@ -1,11 +1,13 @@ # Biicode configuration file [requirements] + google/gtest: 10 messmer/blobstore: 0 messmer/blockstore: 1 messmer/cmake: 3 messmer/cpp-utils: 2 messmer/fspp: 0 + messmer/tempfile: 4 [parent] messmer/cryfs: 0 @@ -18,6 +20,7 @@ # Manual adjust file implicit dependencies, add (+), remove (-), or overwrite (=) # hello.h + hello_imp.cpp hello_imp2.cpp # *.h + *.cpp + test/main.cpp + test/*.cpp [mains] # Manual adjust of files that define an executable @@ -39,3 +42,5 @@ # when loading from disk such data # image.cpp + image.jpg # code should write open("user/block/image.jpg") +#[tests] +# test/* diff --git a/test/FileSystemTest.cpp b/test/FileSystemTest.cpp new file mode 100644 index 00000000..bfd67580 --- /dev/null +++ b/test/FileSystemTest.cpp @@ -0,0 +1,31 @@ +#include +#include +#include + +#include "../src/CryDevice.h" + +using std::unique_ptr; +using std::make_unique; + +using fspp::Device; + +using blockstore::testfake::FakeBlockStore; + +using namespace cryfs; + +class CryFsTestFixture: public FileSystemTestFixture { +public: + CryFsTestFixture() + // Don't create config tempfile yet + : configFile(false) {} + + unique_ptr createDevice() override { + auto blockStore = make_unique(); + auto config = make_unique(configFile.path()); + return make_unique(std::move(config), std::move(blockStore)); + } + + tempfile::TempFile configFile; +}; + +INSTANTIATE_TYPED_TEST_CASE_P(CryFS, FileSystemTest, CryFsTestFixture); diff --git a/test/main.cpp b/test/main.cpp new file mode 100644 index 00000000..f7a14877 --- /dev/null +++ b/test/main.cpp @@ -0,0 +1,6 @@ +#include "google/gtest/gtest.h" + +int main(int argc, char **argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}