chromium/base/containers/intrusive_heap_unittest.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/containers/intrusive_heap.h"

#include <array>

#include "base/check_op.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/rand_util.h"
#include "base/test/bind.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {

namespace  // namespace

////////////////////////////////////////////////////////////////////////////////
// TEST SUITE 1
//
// Explicit tests of a simple heap using WithHeapHandle<>.

TEST(IntrusiveHeapTest, Constructors) {}

TEST(IntrusiveHeapTest, Assignment) {}

TEST(IntrusiveHeapTest, Swap) {}

TEST(IntrusiveHeapTest, ElementAccess) {}

TEST(IntrusiveHeapTest, SizeManagement) {}

TEST(IntrusiveHeapTest, Iterators) {}

////////////////////////////////////////////////////////////////////////////////
// TEST SUITE 2
//
// Exhaustive stress tests with different value types, exploring all
// possibilities of default-constrible, movable and copyable value types.

TEST(IntrusiveHeapTest, MoveOnlyNoDefaultConstructorTest) {}

TEST(IntrusiveHeapTest, CopyOnlyNoDefaultConstructorTest) {}

TEST(IntrusiveHeapTest, CopyAndMoveNoDefaultConstructorTest) {}

TEST(IntrusiveHeapTest, MoveOnlyWithDefaultConstructorTest) {}

TEST(IntrusiveHeapTest, CopyOnlyWithDefaultConstructorTest) {}

TEST(IntrusiveHeapTest, CopyAndMoveWithDefaultConstructorTest) {}

////////////////////////////////////////////////////////////////////////////////
// TEST SUITE 3
//
// Tests individual functions on a custom type that provides heap handle storage
// externally through raw pointers.

TEST(IntrusiveHeapTest, Basic) {}

TEST(IntrusiveHeapTest, Clear) {}

TEST(IntrusiveHeapTest, Destructor) {}

TEST(IntrusiveHeapTest, Min) {}

TEST(IntrusiveHeapTest, MinDuplicates) {}

TEST(IntrusiveHeapTest, InsertAscending) {}

TEST(IntrusiveHeapTest, InsertDescending) {}

TEST(IntrusiveHeapTest, HeapIndex) {}

TEST(IntrusiveHeapTest, HeapIndexDuplicates) {}

TEST(IntrusiveHeapTest, Pop) {}

TEST(IntrusiveHeapTest, PopMany) {}

TEST(IntrusiveHeapTest, Erase) {}

TEST(IntrusiveHeapTest, ReplaceTop) {}

TEST(IntrusiveHeapTest, ReplaceTopWithNonLeafNode) {}

TEST(IntrusiveHeapTest, ReplaceTopCheckAllFinalPositions) {}

TEST(IntrusiveHeapTest, ReplaceUp) {}

TEST(IntrusiveHeapTest, ReplaceUpButDoesntMove) {}

TEST(IntrusiveHeapTest, ReplaceDown) {}

TEST(IntrusiveHeapTest, ReplaceDownButDoesntMove) {}

TEST(IntrusiveHeapTest, ReplaceCheckAllFinalPositions) {}

TEST(IntrusiveHeapTest, At) {}

bool IsEven(int i) {}

TEST(IntrusiveHeapTest, EraseIf) {}

// A comparator class whose sole purpose is to allow the insertion of a
// ScopedClosureRunner inside the heap. The ordering does not matter.
class Comparator {};

// Tests that inserting another element from the destructor of an object removed
// during EraseIf() doesn't crash.
TEST(IntrusiveHeapTest, EraseIf_Reentrancy) {}

}  // namespace base