MCPcopy Create free account
hub / github.com/apache/impala / VerifyFindContainingPoint

Function VerifyFindContainingPoint

be/src/kudu/util/interval_tree-test.cc:202–215  ·  view source on GitHub ↗

Verify that IntervalTree::FindContainingPoint yields the same results as the naive brute-force O(n) algorithm.

Source from the content-addressed store, hash-verified

200// Verify that IntervalTree::FindContainingPoint yields the same results as the naive
201// brute-force O(n) algorithm.
202static void VerifyFindContainingPoint(const vector<IntInterval>& all_intervals,
203 const IntervalTree<IntTraits>& tree,
204 int query_point) {
205 vector<IntInterval> results;
206 tree.FindContainingPoint(query_point, &results);
207 std::sort(results.begin(), results.end(), CompareIntervals);
208
209 vector<IntInterval> brute_force;
210 FindContainingBruteForce(all_intervals, query_point, &brute_force);
211 std::sort(brute_force.begin(), brute_force.end(), CompareIntervals);
212
213 SCOPED_TRACE(Stringify(all_intervals) + StringPrintf(" {q=%d}", query_point));
214 EXPECT_EQ(Stringify(brute_force), Stringify(results));
215}
216
217// Verify that IntervalTree::FindIntersectingInterval yields the same results as the naive
218// brute-force O(n) algorithm.

Callers 1

TEST_FFunction · 0.85

Calls 7

sortFunction · 0.85
FindContainingBruteForceFunction · 0.85
StringifyFunction · 0.85
StringPrintfFunction · 0.85
FindContainingPointMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected