diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2020-03-24 13:43:56 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2020-03-24 13:43:56 +0300 |
commit | d1961d3029b65ff9d7abfeb01fe288c23ca92470 (patch) | |
tree | 681c2f385cbe56409419977aab323ba3cfbabfb3 /test | |
parent | 38acd5685b0ad798754f2c0357043e0dd199808d (diff) |
Last round of C++ 20 fixes, all is clean now.
Diffstat (limited to 'test')
-rw-r--r-- | test/tests/async_io.cpp | 2 | ||||
-rw-r--r-- | test/tests/coroutines.cpp | 2 | ||||
-rw-r--r-- | test/tests/fast_random_file_handle.cpp | 9 | ||||
-rw-r--r-- | test/tests/map_handle_create_close/runner.cpp | 4 |
4 files changed, 8 insertions, 9 deletions
diff --git a/test/tests/async_io.cpp b/test/tests/async_io.cpp index 9f1ef546..da6e2dbd 100644 --- a/test/tests/async_io.cpp +++ b/test/tests/async_io.cpp @@ -43,7 +43,7 @@ static inline void TestAsyncFileHandle() std::promise<llfio::async_file_handle::const_buffers_type> p; auto f(p.get_future()); auto schedule_io = [&] { - return h.async_write({bt, n * 4096}, [ p = std::move(p), n ](llfio::async_file_handle *, llfio::async_file_handle::io_result<llfio::async_file_handle::const_buffers_type> && result) mutable { + return h.async_write({{&bt, 1}, n * 4096}, [ p = std::move(p), n ](llfio::async_file_handle *, llfio::async_file_handle::io_result<llfio::async_file_handle::const_buffers_type> && result) mutable { (void) n; if(!result && result.error() == llfio::errc::resource_unavailable_try_again) { diff --git a/test/tests/coroutines.cpp b/test/tests/coroutines.cpp index dd962116..d4cccf06 100644 --- a/test/tests/coroutines.cpp +++ b/test/tests/coroutines.cpp @@ -50,7 +50,7 @@ static inline void TestAsyncFileHandleCoroutines() { // This will initiate the i/o, and suspend the coroutine until completion. // The caller will thus resume execution with a valid unsignaled future. - auto written = co_await h.co_write({bt, n * 32768 + no * 4096}).value(); + auto written = co_await h.co_write({{&bt, 1}, n * 32768 + no * 4096}).value(); written.value(); } }; diff --git a/test/tests/fast_random_file_handle.cpp b/test/tests/fast_random_file_handle.cpp index 60cd34b3..bddfe5c9 100644 --- a/test/tests/fast_random_file_handle.cpp +++ b/test/tests/fast_random_file_handle.cpp @@ -26,7 +26,6 @@ Distributed under the Boost Software License, Version 1.0. #include "quickcpplib/algorithm/small_prng.hpp" - static inline void TestFastRandomFileHandleWorks() { static constexpr size_t testbytes = 1024 * 1024UL; @@ -36,7 +35,7 @@ static inline void TestFastRandomFileHandleWorks() mapped<byte> store(testbytes); fast_random_file_handle h = fast_random_file_handle::fast_random_file(testbytes).value(); // Bulk read - BOOST_CHECK(h.read(0, {{store.begin(), store.size()}}).value() == store.size()); + BOOST_CHECK(h.read(0, {{store.data(), store.size()}}).value() == store.size()); // Now make sure that random read offsets and lengths match exactly small_prng rand; @@ -53,7 +52,7 @@ static inline void TestFastRandomFileHandleWorks() { BOOST_CHECK(bytesread == length); } - BOOST_CHECK(!memcmp(buffer, store.begin() + offset, bytesread)); + BOOST_CHECK(!memcmp(buffer, store.data() + offset, bytesread)); } } @@ -63,7 +62,7 @@ static inline void TestFastRandomFileHandlePerformance() using namespace LLFIO_V2_NAMESPACE; using LLFIO_V2_NAMESPACE::byte; mapped<byte> store(testbytes); - memset(store.begin(), 1, store.size()); + memset(store.data(), 1, store.size()); fast_random_file_handle h = fast_random_file_handle::fast_random_file(testbytes).value(); auto begin = std::chrono::high_resolution_clock::now(); while(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::high_resolution_clock::now() - begin).count() < 1) @@ -97,7 +96,7 @@ static inline void TestFastRandomFileHandlePerformance() begin = std::chrono::high_resolution_clock::now(); for(size_t n = 0; n < 10; n++) { - h.read(0, {{store.begin(), store.size()}}).value(); + h.read(0, {{store.data(), store.size()}}).value(); } end = std::chrono::high_resolution_clock::now(); auto diff2 = std::chrono::duration_cast<std::chrono::microseconds>(end - begin); diff --git a/test/tests/map_handle_create_close/runner.cpp b/test/tests/map_handle_create_close/runner.cpp index 681f0819..945f94ed 100644 --- a/test/tests/map_handle_create_close/runner.cpp +++ b/test/tests/map_handle_create_close/runner.cpp @@ -116,14 +116,14 @@ template <class U> inline void map_handle_create_close_(U &&f) if (use_file_backing) { map_handle::buffer_type req{ nullptr, 20 }; - auto b = maph.read({ req, 0 }).value(); + auto b = maph.read({ {&req, 1}, 0 }).value(); KERNELTEST_CHECK(testreturn, b[0].data() == addr); KERNELTEST_CHECK(testreturn, b[0].size() == 19); // reads do not read more than the backing length } else { map_handle::buffer_type req{ nullptr, 5000 }; - auto b = maph.read({ req, 5 }).value(); + auto b = maph.read({ {&req, 1}, 5 }).value(); KERNELTEST_CHECK(testreturn, b[0].data() == addr+5); // NOLINT KERNELTEST_CHECK(testreturn, b[0].size() == 4091); } |