Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2016-04-22 21:51:49 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2016-04-22 21:51:49 +0300
commitfb94d289a2c22b27e236d77ecb07c093c9da6081 (patch)
tree3554850dc9c6ec755bd8bab6535e0a860454f77d /test/tests/file_handle_create_close
parenteea757af646ad9061b154550affb8e0e72c834c1 (diff)
Wrote out some notes on the automatic unit test generator from clang AST I have planned.
Diffstat (limited to 'test/tests/file_handle_create_close')
-rw-r--r--test/tests/file_handle_create_close/existing0/testfile.txt0
-rw-r--r--test/tests/file_handle_create_close/existing1/testfile.txt1
-rw-r--r--test/tests/file_handle_create_close/kernel.cpp35
3 files changed, 36 insertions, 0 deletions
diff --git a/test/tests/file_handle_create_close/existing0/testfile.txt b/test/tests/file_handle_create_close/existing0/testfile.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/tests/file_handle_create_close/existing0/testfile.txt
diff --git a/test/tests/file_handle_create_close/existing1/testfile.txt b/test/tests/file_handle_create_close/existing1/testfile.txt
new file mode 100644
index 00000000..e55f0f57
--- /dev/null
+++ b/test/tests/file_handle_create_close/existing1/testfile.txt
@@ -0,0 +1 @@
+niall \ No newline at end of file
diff --git a/test/tests/file_handle_create_close/kernel.cpp b/test/tests/file_handle_create_close/kernel.cpp
new file mode 100644
index 00000000..3cbb2497
--- /dev/null
+++ b/test/tests/file_handle_create_close/kernel.cpp
@@ -0,0 +1,35 @@
+/* Integration test kernel for file_handle create and close
+(C) 2016 Niall Douglas http://www.nedprod.com/
+File Created: Apr 2016
+*/
+
+#include "../../integration_test_kernel.hpp"
+
+BOOST_OUTCOME_INTEGRATION_TEST_KERNEL(file_handle_create_close_creation)
+{
+ file_handle::creation c;
+ // clang-format off
+ /* For every one of these parameter values listed, test with the value using
+ the input workspace which should produce outcome workspace.
+ */
+ BOOST_OUTCOME_INTEGRATION_TEST_KERNEL_PARAMETER_TO_WORKSPACE(c, {
+ {file_handle::creation::open_existing, "non-existing", make_errored_result<const char *>(ENOENT) },
+ {file_handle::creation::open_existing, "existing0", make_result<const char *>("existing0") },
+ {file_handle::creation::open_existing, "existing1", make_result<const char *>("existing1") },
+ {file_handle::creation::only_if_not_exist, "non-existing", make_result<const char *>("existing0") },
+ {file_handle::creation::only_if_not_exist, "existing0", make_errored_result<const char *>(EEXIST) },
+ {file_handle::creation::if_needed, "non-existing", make_result<const char *>("existing0") },
+ {file_handle::creation::if_needed, "existing1", make_result<const char *>("existing1") },
+ {file_handle::creation::truncate, "non-existing", make_errored_result<const char *>(ENOENT) },
+ {file_handle::creation::truncate, "existing0", make_result<const char *>("existing0") },
+ {file_handle::creation::truncate, "existing1", make_result<const char *>("existing0") }
+ })
+ {
+ file_handle::mode m=file_handle::mode::write;
+ {
+ // clang-format on
+ auto h = file_handle::file("testfile.txt", m, c);
+ BOOST_OUTCOME_INTEGRATION_TEST_KERNEL_RESULT(h);
+ }
+ }
+}