unittest/heap_test.cc
TEST_F(HeapTest, PopWorstTest) {
  GenericHeap<IntKDPair> heap;
  KDVector v;
  // Push the test data onto both the heap and the KDVector.
  PushTestData(&heap, &v);
  // Get the worst element off the heap.
  IntKDPair pair;
  heap.PopWorst(&pair);
  EXPECT_EQ(pair.key(), 65536);
  EXPECT_EQ(pair.data(), 6);
  // Sort and remove the worst element from the vector.
  std::sort(v.begin(), v.end());
  v.resize(v.size() - 1);
  // After that they should still match!
  VerifyHeapVectorMatch(&heap, &v);
}
// Tests that PopWorst still leaves the heap in a state such that it still
// matches a sorted KDVector.
Tests that PopWorst still leaves the heap in a state such that it still
matches a sorted KDVector.
Tests that PopWorst still leaves the heap in a state such that it still matches a sorted KDVector .
TEST_F(HeapTest, PopWorstTest) {
  GenericHeap<IntKDPair> heap;
  KDVector v;
  PushTestData(&heap, &v);
  IntKDPair pair;
  heap.PopWorst(&pair);
  EXPECT_EQ(pair.key(), 65536);
  EXPECT_EQ(pair.data(), 6);
  std::sort(v.begin(), v.end());
  v.resize(v.size() - 1);
  VerifyHeapVectorMatch(&heap, &v);
}
TEST_F ( HeapTest , PopWorstTest ) { GenericHeap < IntKDPair > heap ; KDVector v ; PushTestData ( & heap , & v ) ; IntKDPair pair ; heap . PopWorst ( & pair ) ; EXPECT_EQ ( pair . key ( ) , 65536 ) ; EXPECT_EQ ( pair . data ( ) , 6 ) ; std :: sort ( v . begin ( ) , v . end ( ) ) ; v . resize ( v . size ( ) - 1 ) ; VerifyHeapVectorMatch ( & heap , & v ) ; }
Tests that PopWorst still leaves the heap in a state such that it still
matches a sorted KDVector.
Tests that PopWorst still leaves the heap in a state such that it still matches a sorted KDVector .
// Push the test data onto both the heap and the KDVector. // Get the worst element off the heap. // Sort and remove the worst element from the vector. // After that they should still match!