File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 11#pragma once
22
3+ #include < ctime>
4+ #include < random>
5+ #include < cmath>
6+
37class FindTests
48 : public ::testing::Test
59{
610public:
711 using types = IntervalTypes <int >;
812protected:
913 IntervalTypes <int >::tree_type tree;
14+ std::default_random_engine gen;
15+ std::uniform_int_distribution <int > distLarge{-50000 , 50000 };
1016};
1117
1218TEST_F (FindTests, WillReturnEndIfTreeIsEmpty)
@@ -78,4 +84,22 @@ TEST_F(FindTests, WillFindAllCanExitPreemptively)
7884 EXPECT_EQ (findCount, 3 );
7985}
8086
87+ TEST_F (FindTests, CanFindAllElementsBack)
88+ {
89+ constexpr int amount = 10'000 ;
90+
91+ std::vector <decltype (tree)::interval_type> intervals;
92+ intervals.reserve (amount);
93+ for (int i = 0 ; i != amount; ++i)
94+ {
95+ const auto interval = lib_interval_tree::make_safe_interval (distLarge (gen), distLarge (gen));
96+ intervals.emplace_back (interval);
97+ tree.insert (interval);
98+ }
99+ for (auto const & ival : intervals)
100+ {
101+ ASSERT_NE (tree.find (ival), std::end (tree));
102+ }
103+ }
104+
81105
You can’t perform that action at this time.
0 commit comments