diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2016-06-02 10:54:32 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2016-06-02 10:54:32 +0300 |
commit | 67d370786bc6d6b1f2497865931f81bcd204f7a8 (patch) | |
tree | 516859cc795892f94a4ea74a047d7b8892811117 /test/tests/file_handle_create_close | |
parent | 2fb75b853b6ccfe4ffb32ec33aab2522e4720fe4 (diff) |
Finally nailed the syntax for unit test parameter permute list initialisers. Only took me four mornings!
Diffstat (limited to 'test/tests/file_handle_create_close')
-rw-r--r-- | test/tests/file_handle_create_close/runner.cpp | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/test/tests/file_handle_create_close/runner.cpp b/test/tests/file_handle_create_close/runner.cpp index 0befe717..5511e1e7 100644 --- a/test/tests/file_handle_create_close/runner.cpp +++ b/test/tests/file_handle_create_close/runner.cpp @@ -3,14 +3,16 @@ File Created: Apr 2016 */ +#include "../../kerneltest/include/boost/kerneltest/v1/hooks/filesystem_workspace.hpp" +#include "../../kerneltest/include/boost/kerneltest/v1/permute_parameters.hpp" #include "../../kerneltest/include/boost/kerneltest/v1/test_kernel.hpp" #include "kernel_async_file_handle.cpp.hpp" #include "kernel_file_handle.cpp.hpp" template <class U> inline void file_handle_create_close_creation(U &&f) { - using namespace BOOST_AFIO_V2_NAMESPACE; - using BOOST_AFIO_V2_NAMESPACE::result; + using namespace BOOST_KERNELTEST_V1_NAMESPACE; + using file_handle = BOOST_AFIO_V2_NAMESPACE::file_handle; /* For every one of these parameter values listed, test with the value using the input workspace which should produce outcome workspace. Workspaces are: * non-existing: no files @@ -18,25 +20,31 @@ template <class U> inline void file_handle_create_close_creation(U &&f) * existing1: single one byte length file */ // clang-format off - integration_test::mt_permute_parameters< // This is a multithreaded parameter permutation test - result<void>, // The output outcome/result/option type. Type void means we don't care about the return type. - typename FileHandleType::creation // The types of one or more input parameters to fuzz. + mt_permute_parameters< // This is a multithreaded parameter permutation test + result<void>, // The output outcome/result/option type. Type void means we don't care about the return type. + parameters< // The types of one or more input parameters to permute/fuzz. + typename file_handle::creation + >, + hooks::filesystem_setup_parameters, + hooks::filesystem_comparison_inexact_parameters >( - { // Initialiser list of output value expected for the input parameters - { make_errored_result<void>(ENOENT), file_handle::creation::open_existing, "non-existing", "non-existing" }, - { make_ready_result<void>(), file_handle::creation::open_existing, "existing0", "existing0" }, - { make_ready_result<void>(), file_handle::creation::open_existing, "existing1", "existing1" }, - { make_ready_result<void>(), file_handle::creation::only_if_not_exist, "non-existing", "existing0" }, - { make_errored_result<void>(EEXIST), file_handle::creation::only_if_not_exist, "existing0", "existing0" }, - { make_ready_result<void>(), file_handle::creation::if_needed, "non-existing", "existing0" }, - { make_ready_result<void>(), file_handle::creation::if_needed, "existing1", "existing1" }, - { make_errored_result<void>(ENOENT), file_handle::creation::truncate, "non-existing", "non-existing" }, - { make_ready_result<void>(), file_handle::creation::truncate, "existing0", "existing0" }, - { make_ready_result<void>(), file_handle::creation::truncate, "existing1", "existing0" } + { // Initialiser list of output value expected for the input parameters, plus any hook parameters + { make_errored_result<void>(ENOENT), { file_handle::creation::open_existing }, { "non-existing" }, { "non-existing" }}, + { make_ready_result<void>(), { file_handle::creation::open_existing }, { "existing0" }, { "existing0" }}, + { make_ready_result<void>(), { file_handle::creation::open_existing }, { "existing1" }, { "existing1" }}, + { make_ready_result<void>(), { file_handle::creation::only_if_not_exist }, { "non-existing" }, { "existing0" }}, + { make_errored_result<void>(EEXIST), { file_handle::creation::only_if_not_exist }, { "existing0" }, { "existing0" }}, + { make_ready_result<void>(), { file_handle::creation::if_needed }, { "non-existing" }, { "existing0" }}, + { make_ready_result<void>(), { file_handle::creation::if_needed }, { "existing1" }, { "existing1" }}, + { make_errored_result<void>(ENOENT), { file_handle::creation::truncate }, { "non-existing" }, { "non-existing" }}, + { make_ready_result<void>(), { file_handle::creation::truncate }, { "existing0" }, { "existing0" }}, + { make_ready_result<void>(), { file_handle::creation::truncate }, { "existing1" }, { "existing0" }} }, - integration_test::pre_filesystem_setup("file_handle_create_close"), // Configure this filesystem workspace before the test - integration_test::post_filesystem_comparison_inexact("file_handle_create_close") // Do an inexact comparison of the filesystem workspace after the test - ) + // Any parameters from now on are called before each permutation and the object returned is + // destroyed after each permutation. The callspec is (parameter_permuter<...> *parent, outcome<T> &testret, pars) + hooks::filesystem_setup("file_handle_create_close"), // Configure this filesystem workspace before the test + hooks::filesystem_comparison_inexact("file_handle_create_close") // Do an inexact comparison of the filesystem workspace after the test + ) // clang-format on (std::forward<U>(f)); } |