| 12345678910111213141516171819202122232425262728293031323334 |
- #define BOOST_TEST_DYN_LINK
- #include "utility/debug_utility.hpp"
- #include "utility/dynamic_pool.hpp"
- #include <boost/test/unit_test.hpp>
- #include <chrono>
- #include <iostream>
- #include <vector>
- using namespace sophiar;
- using namespace std::chrono_literals;
- void test_dynamic_pool_func1() {
- std::vector<int> v1;
- std::vector<int, global_dynamic_allocator<int>> v2;
- FILE_LINE_TRACE
- for (int i = 0; i <= 1000000; ++i) v1.push_back(i);
- FILE_LINE_TRACE
- for (int i = 0; i <= 1000000; ++i) v2.push_back(i);
- FILE_LINE_TRACE
- auto sum = std::accumulate(v2.begin(), v2.end(), 0LL);
- BOOST_TEST(sum == 500000500000LL);
- }
- BOOST_AUTO_TEST_CASE(test_dynamic_pool) {
- initialize({});
- test_dynamic_pool_func1();
- test_dynamic_pool_func1();
- test_dynamic_pool_func1();
- test_dynamic_pool_func1();
- }
|