diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2016-05-12 20:45:23 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2016-05-12 20:45:23 +0300 |
commit | 8b0de676a6dd5125299c82390847d82fc326aaac (patch) | |
tree | 17ffda3968846bb705254b5dd9019af2e0122a0e /test/tests/file_handle_create_close | |
parent | a73c561965003263aefe046c6e3364da674b9fd7 (diff) |
First compiling edition of the new integration test kernel infrastructure.
Diffstat (limited to 'test/tests/file_handle_create_close')
-rw-r--r-- | test/tests/file_handle_create_close/kernel.cpp | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/test/tests/file_handle_create_close/kernel.cpp b/test/tests/file_handle_create_close/kernel.cpp index 3cbb2497..88bfb623 100644 --- a/test/tests/file_handle_create_close/kernel.cpp +++ b/test/tests/file_handle_create_close/kernel.cpp @@ -5,31 +5,39 @@ File Created: Apr 2016 #include "../../integration_test_kernel.hpp" -BOOST_OUTCOME_INTEGRATION_TEST_KERNEL(file_handle_create_close_creation) +template <class FileHandleType> void file_handle_create_close_creation() { - file_handle::creation c; - // clang-format off + using namespace BOOST_AFIO_V2_NAMESPACE; + using BOOST_AFIO_V2_NAMESPACE::result; + typename FileHandleType::creation c; /* For every one of these parameter values listed, test with the value using - the input workspace which should produce outcome workspace. + the input workspace which should produce outcome workspace. Workspaces are: + * non-existing: no files + * existing0: single zero length file + * existing1: single one byte length file */ - 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); - } - } + // clang-format off + BOOST_OUTCOME_INTEGRATION_TEST_ST_KERNEL_PARAMETER_TO_FILESYSTEM(result<void>, c, ({ + { file_handle::creation::open_existing, "non-existing", make_errored_result<void>(ENOENT), "non-existing" }, + { file_handle::creation::open_existing, "existing0", make_result<void>(), "existing0" }, + { file_handle::creation::open_existing, "existing1", make_result<void>(), "existing1" }, + { file_handle::creation::only_if_not_exist, "non-existing", make_result<void>(), "existing0" }, + { file_handle::creation::only_if_not_exist, "existing0", make_errored_result<void>(EEXIST), "existing0" }, + { file_handle::creation::if_needed, "non-existing", make_result<void>(), "existing0" }, + { file_handle::creation::if_needed, "existing1", make_result<void>(), "existing1" }, + { file_handle::creation::truncate, "non-existing", make_errored_result<void>(ENOENT), "non-existing" }, + { file_handle::creation::truncate, "existing0", make_result<void>(), "existing0" }, + { file_handle::creation::truncate, "existing1", make_result<void>(), "existing0" } + }), + // clang-format on + { + typename FileHandleType::mode m(FileHandleType::mode::write); + { + auto h = FileHandleType::file("testfile.txt", m, c); + BOOST_OUTCOME_INTEGRATION_TEST_KERNEL_RESULT(h); + } + }) } + +BOOST_OUTCOME_INTEGRATION_TEST_KERNEL(afio, integration / file_handle_create_close_creation, "Tests that afio::file_handle's creation parameter works as expected", file_handle_create_close_creation<BOOST_AFIO_V2_NAMESPACE::file_handle>()) +BOOST_OUTCOME_INTEGRATION_TEST_KERNEL(afio, integration / async_file_handle_create_close_creation, "Tests that afio::async_file_handle's creation parameter works as expected", file_handle_create_close_creation<BOOST_AFIO_V2_NAMESPACE::async_file_handle>()) |