summaryrefslogtreecommitdiff
path: root/test/libapt/file-helpers.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-04-16 17:09:37 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-04-16 18:36:14 +0200
commitf00832cc273e52a47fb88e49849891b771de4e17 (patch)
treeeedd6b1e1c873c7e3e8f614a0ac8ca5c3b7e37b9 /test/libapt/file-helpers.h
parentbb93178b8b5c2f8021977dbc34066f0d0fb8b9b9 (diff)
use Google C++ Testing Framework for libapt tests
My commit 45df0ad2 from 26. Nov 2009 had a little remark: "The commit also includes a very very simple testapp." This was never intended to be permanent, but as usually… The commit adds the needed make magic to compile gtest statically as it is required and links it against a small runner. All previous testcase binaries are reimplemented in gtest and combined in this runner. While most code is a 1:1 translation some had to be rewritten like compareversion_test.cc, but the coverage remains the same.
Diffstat (limited to 'test/libapt/file-helpers.h')
-rw-r--r--test/libapt/file-helpers.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/libapt/file-helpers.h b/test/libapt/file-helpers.h
new file mode 100644
index 000000000..e8472d503
--- /dev/null
+++ b/test/libapt/file-helpers.h
@@ -0,0 +1,29 @@
+#ifndef APT_TESTS_FILE_HELPERS
+#define APT_TESTS_FILE_HELPERS
+
+#include <string>
+
+#include <gtest/gtest.h>
+
+class FileFd;
+
+#define createTemporaryDirectory(id, dir) \
+ ASSERT_NO_FATAL_FAILURE(helperCreateTemporaryDirectory(id, dir))
+void helperCreateTemporaryDirectory(std::string const &id, std::string &dir);
+#define removeDirectory(dir) \
+ ASSERT_NO_FATAL_FAILURE(helperRemoveDirectory(dir))
+void helperRemoveDirectory(std::string const &dir);
+#define createFile(dir, name) \
+ ASSERT_NO_FATAL_FAILURE(helperCreateFile(dir, name))
+void helperCreateFile(std::string const &dir, std::string const &name);
+#define createDirectory(dir, name) \
+ ASSERT_NO_FATAL_FAILURE(helperCreateDirectory(dir, name))
+void helperCreateDirectory(std::string const &dir, std::string const &name);
+#define createLink(dir, targetname, linkname) \
+ ASSERT_NO_FATAL_FAILURE(helperCreateLink(dir, targetname, linkname))
+void helperCreateLink(std::string const &dir, std::string const &targetname, std::string const &linkname);
+#define createTemporaryFile(id, fd, filename, content) \
+ ASSERT_NO_FATAL_FAILURE(helperCreateTemporaryFile(id, fd, filename, content))
+void helperCreateTemporaryFile(std::string const &id, FileFd &fd, char * * const filename, char const * const content);
+
+#endif