/* Fibonacci heap for GNU compiler.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
Contributed by Martin Liska <mliska@suse.cz>
This file is part of GCC.
#include "config.h"
#include "system.h"
#include "coretypes.h"
+#include "alloc-pool.h"
#include "fibonacci_heap.h"
#include "selftest.h"
static void
test_empty_heap ()
{
- int_heap_t *h1 = new int_heap_t (INT_MIN);
+ pool_allocator allocator ("fibheap test", sizeof (int_heap_node_t));
+ int_heap_t *h1 = new int_heap_t (INT_MIN, &allocator);
ASSERT_TRUE (h1->empty ());
ASSERT_EQ (0, h1->nodes ());
ASSERT_EQ (NULL, h1->min ());
- int_heap_t *h2 = new int_heap_t (INT_MIN);
+ int_heap_t *h2 = new int_heap_t (INT_MIN, &allocator);
int_heap_t *r = h1->union_with (h2);
ASSERT_TRUE (r->empty ());
test_union ()
{
int value = 777;
+ pool_allocator allocator ("fibheap test", sizeof (int_heap_node_t));
- int_heap_t *heap1 = new int_heap_t (INT_MIN);
+ int_heap_t *heap1 = new int_heap_t (INT_MIN, &allocator);
for (unsigned i = 0; i < 2 * TEST_HEAP_N; i++)
heap1->insert (i, &value);
- int_heap_t *heap2 = new int_heap_t (INT_MIN);
+ int_heap_t *heap2 = new int_heap_t (INT_MIN, &allocator);
for (unsigned i = 2 * TEST_HEAP_N; i < 3 * TEST_HEAP_N; i++)
heap2->insert (i, &value);
test_union_of_equal_heaps ()
{
int value = 777;
+ pool_allocator allocator ("fibheap test", sizeof (int_heap_node_t));
- int_heap_t *heap1 = new int_heap_t (INT_MIN);
+ int_heap_t *heap1 = new int_heap_t (INT_MIN, &allocator);
for (unsigned i = 0; i < TEST_HEAP_N; i++)
heap1->insert (i, &value);
- int_heap_t *heap2 = new int_heap_t (INT_MIN);
+ int_heap_t *heap2 = new int_heap_t (INT_MIN, &allocator);
for (unsigned i = 0; i < TEST_HEAP_N; i++)
heap2->insert (i, &value);
/* Dummy struct for testing. */
-struct heap_key
+class heap_key
{
+public:
heap_key (int k): key (k)
{
}