From 59ba2bbfb1ac04000ada681f875039a37bdb8cee Mon Sep 17 00:00:00 2001 From: Domagoj Saric Date: Fri, 11 Oct 2024 15:04:30 +0200 Subject: [PATCH] OSX: printf debugging. Decreased test data size (to avoid timeouts on GitHub). --- test/b+tree.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/b+tree.cpp b/test/b+tree.cpp index 0516287..9ddb087 100644 --- a/test/b+tree.cpp +++ b/test/b+tree.cpp @@ -5,7 +5,7 @@ #include -#include +#include #include #include #include @@ -19,20 +19,22 @@ static auto const test_file{ "test.bpt" }; TEST( bp_tree, playground ) { + std::println( "Generating test data." ); #ifdef NDEBUG - auto const test_size{ 9137365 }; + auto const test_size{ 953735 }; #else - auto const test_size{ 937358 }; + auto const test_size{ 98735 }; #endif std::ranges::iota_view constexpr sorted_numbers{ 0, test_size }; std::mt19937 rng{ std::random_device{}() }; auto numbers{ std::ranges::to( sorted_numbers ) }; std::shuffle( numbers.begin(), numbers.end(), rng ); { + std::println( "B+tree in memory..." ); bp_tree bpt; bpt.map_memory(); bpt.reserve( numbers.size() ); - + std::println( " ...insertion" ); { auto const nums { std::span{ numbers } }; auto const third{ nums.size() / 3 }; @@ -44,7 +46,7 @@ TEST( bp_tree, playground ) bpt.insert( third_third ); } - + std::println( " ...checks" ); static_assert( std::forward_iterator::const_iterator> ); EXPECT_TRUE( std::ranges::is_sorted( std::as_const( bpt ) ) ); @@ -63,6 +65,7 @@ TEST( bp_tree, playground ) EXPECT_EQ( ra[ n ], n ); } + std::println( " ...erasure" ); std::shuffle( numbers.begin(), numbers.end(), rng ); for ( auto const & n : numbers ) bpt.erase( n ); @@ -71,6 +74,7 @@ TEST( bp_tree, playground ) } { + std::println( "B+tree on disk - creation..." ); bp_tree bpt; bpt.map_file( test_file, flags::named_object_construction_policy::create_new_or_truncate_existing ); @@ -87,6 +91,7 @@ TEST( bp_tree, playground ) EXPECT_EQ( bpt.find( +42 ), bpt.end() ); } { + std::println( "B+tree on disk - opening..." ); bp_tree bpt; bpt.map_file( test_file, flags::named_object_construction_policy::open_existing );