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 1
1
#pragma once
2
2
3
+ #include < ctime>
4
+ #include < random>
5
+ #include < cmath>
6
+
3
7
class FindTests
4
8
: public ::testing::Test
5
9
{
6
10
public:
7
11
using types = IntervalTypes <int >;
8
12
protected:
9
13
IntervalTypes <int >::tree_type tree;
14
+ std::default_random_engine gen;
15
+ std::uniform_int_distribution <int > distLarge{-50000 , 50000 };
10
16
};
11
17
12
18
TEST_F (FindTests, WillReturnEndIfTreeIsEmpty)
@@ -78,4 +84,22 @@ TEST_F(FindTests, WillFindAllCanExitPreemptively)
78
84
EXPECT_EQ (findCount, 3 );
79
85
}
80
86
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
+
81
105
You can’t perform that action at this time.
0 commit comments