diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2018-08-31 12:00:03 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2018-08-31 12:00:03 +0300 |
commit | e3e0c946b7bcfd9a331fb76cd5e7317d1b38be99 (patch) | |
tree | 4526f9b75b0d068a3ed16a12d48869cae22ea801 /test/tests/trivial_vector.cpp | |
parent | 011874565dbbd95680ffbc7db8b250593760376b (diff) |
Add large, huge and massive page support, for Windows. POSIX support is coming.
Diffstat (limited to 'test/tests/trivial_vector.cpp')
-rw-r--r-- | test/tests/trivial_vector.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/test/tests/trivial_vector.cpp b/test/tests/trivial_vector.cpp index 6cc5c60f..2ca92e6e 100644 --- a/test/tests/trivial_vector.cpp +++ b/test/tests/trivial_vector.cpp @@ -32,8 +32,9 @@ static inline void TestTrivialVector() { uint64_t v, _space[7]; // 64 bytes total udt() = delete; - explicit udt(int /*unused*/) : v(trivial_vector_udts_constructed++) - , _space{ 1, 2, 3, 4, 5, 6, 7 } + explicit udt(int /*unused*/) + : v(trivial_vector_udts_constructed++) + , _space{1, 2, 3, 4, 5, 6, 7} { } }; @@ -44,27 +45,27 @@ static inline void TestTrivialVector() BOOST_CHECK(v.empty()); BOOST_CHECK(v.size() == 0); // NOLINT std::cout << "Resizing to 4Kb ..." << std::endl; - v.push_back(udt(5)); // first allocation of 4Kb + v.push_back(udt(5)); // first allocation of 4Kb BOOST_CHECK(v.size() == 1); BOOST_CHECK(v.capacity() == LLFIO_V2_NAMESPACE::utils::page_size() / sizeof(udt)); BOOST_REQUIRE(v[0].v == 78); std::cout << "Resizing to capacity ..." << std::endl; - v.resize(_4kb, udt(6)); // ought to be precisely 4Kb + v.resize(_4kb, udt(6)); // ought to be precisely 4Kb BOOST_CHECK(v.size() == _4kb); - BOOST_CHECK(v.capacity() == LLFIO_V2_NAMESPACE::utils::round_up_to_page_size(4096) / sizeof(udt)); + BOOST_CHECK(v.capacity() == LLFIO_V2_NAMESPACE::utils::round_up_to_page_size(4096, LLFIO_V2_NAMESPACE::utils::page_size()) / sizeof(udt)); BOOST_REQUIRE(v[0].v == 78); BOOST_REQUIRE(v[1].v == 79); std::cout << "Resizing to 16Kb ..." << std::endl; - v.resize(_16kb, udt(7)); // 16Kb + v.resize(_16kb, udt(7)); // 16Kb BOOST_CHECK(v.size() == _16kb); - BOOST_CHECK(v.capacity() == LLFIO_V2_NAMESPACE::utils::round_up_to_page_size(16384) / sizeof(udt)); + BOOST_CHECK(v.capacity() == LLFIO_V2_NAMESPACE::utils::round_up_to_page_size(16384, LLFIO_V2_NAMESPACE::utils::page_size()) / sizeof(udt)); BOOST_REQUIRE(v[0].v == 78); BOOST_REQUIRE(v[1].v == 79); BOOST_REQUIRE(v[_4kb].v == 80); std::cout << "Resizing to 64Kb ..." << std::endl; - v.resize(_64kb, udt(8)); // 64Kb + v.resize(_64kb, udt(8)); // 64Kb BOOST_CHECK(v.size() == _64kb); - BOOST_CHECK(v.capacity() == LLFIO_V2_NAMESPACE::utils::round_up_to_page_size(65536) / sizeof(udt)); + BOOST_CHECK(v.capacity() == LLFIO_V2_NAMESPACE::utils::round_up_to_page_size(65536, LLFIO_V2_NAMESPACE::utils::page_size()) / sizeof(udt)); BOOST_REQUIRE(v[0].v == 78); BOOST_REQUIRE(v[1].v == 79); BOOST_REQUIRE(v[_4kb].v == 80); @@ -138,9 +139,9 @@ static inline void BenchmarkTrivialVector1() { struct udt { - uint64_t v[8]; // 64 bytes total + uint64_t v[8]; // 64 bytes total constexpr udt() // NOLINT - : v{ 1, 2, 3, 4, 5, 6, 7, 8 } + : v{1, 2, 3, 4, 5, 6, 7, 8} { } }; @@ -187,9 +188,9 @@ static inline void BenchmarkTrivialVector2() { struct udt { - uint64_t v[8]; // 64 bytes total + uint64_t v[8]; // 64 bytes total constexpr udt(int /*unused*/) // NOLINT - : v{ 1, 2, 3, 4, 5, 6, 7, 8 } + : v{1, 2, 3, 4, 5, 6, 7, 8} { } }; |