"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Heap_1 = require("../Heap");
const assert_1 = require("../util/assert");
const heap = {
    value: 6,
    children: [
        {
            value: 5,
            children: [
                { value: 4, children: [] },
                { value: 3, children: [] },
            ],
        },
        {
            value: 2,
            children: [
                { value: 1, children: [] },
                { value: 0, children: [] },
            ],
        },
    ],
};
const predicate = (a, b) => a >= b;
let _heap = (0, Heap_1.parentHeap)(heap, null);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 6,
    children: [
        {
            value: 5,
            children: [
                { value: 4, children: [] },
                { value: 3, children: [] },
            ],
        },
        {
            value: 2,
            children: [
                { value: 1, children: [] },
                { value: 0, children: [] },
            ],
        },
    ],
});
_heap = (0, Heap_1.removeHeapNode)(_heap, predicate);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 5,
    children: [
        {
            value: 4,
            children: [
                {
                    value: 2,
                    children: [
                        {
                            value: 1,
                            children: [],
                        },
                        {
                            value: 0,
                            children: [],
                        },
                    ],
                },
            ],
        },
        {
            value: 3,
            children: [],
        },
    ],
});
_heap = (0, Heap_1.removeHeapNode)(_heap, predicate);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 4,
    children: [
        {
            value: 2,
            children: [
                {
                    value: 1,
                    children: [],
                },
                {
                    value: 0,
                    children: [],
                },
            ],
        },
        {
            value: 3,
            children: [],
        },
    ],
});
_heap = (0, Heap_1.addHeapNode)(_heap, { value: 7, parent: null, children: [] }, predicate);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 7,
    children: [
        {
            value: 4,
            children: [
                {
                    value: 2,
                    children: [
                        {
                            value: 1,
                            children: [],
                        },
                        {
                            value: 0,
                            children: [],
                        },
                    ],
                },
                {
                    value: 3,
                    children: [],
                },
            ],
        },
    ],
});
_heap = (0, Heap_1.addHeapNode)(_heap, { value: 6, parent: null, children: [] }, predicate);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 7,
    children: [
        {
            value: 4,
            children: [
                {
                    value: 2,
                    children: [
                        {
                            value: 1,
                            children: [],
                        },
                        {
                            value: 0,
                            children: [],
                        },
                    ],
                },
                {
                    value: 3,
                    children: [],
                },
            ],
        },
        { value: 6, children: [] },
    ],
});
const _heap_2 = _heap.children[0].children[0];
_heap = (0, Heap_1.removeHeapNode)(_heap_2, predicate);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 7,
    children: [
        {
            value: 4,
            children: [
                {
                    value: 1,
                    children: [
                        {
                            value: 0,
                            children: [],
                        },
                    ],
                },
                {
                    value: 3,
                    children: [],
                },
            ],
        },
        { value: 6, children: [] },
    ],
});
_heap = (0, Heap_1.setHeapNode)(_heap, 5, predicate);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 6,
    children: [
        {
            value: 4,
            children: [
                {
                    value: 1,
                    children: [
                        {
                            value: 0,
                            children: [],
                        },
                    ],
                },
                {
                    value: 3,
                    children: [],
                },
            ],
        },
        { value: 5, children: [] },
    ],
});
let _heap_000 = _heap.children[0].children[0].children[0];
_heap = (0, Heap_1.setHeapNode)(_heap_000, 7, predicate);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 7,
    children: [
        {
            value: 1,
            children: [],
        },
        {
            value: 6,
            children: [
                {
                    value: 4,
                    children: [
                        {
                            value: 3,
                            children: [],
                        },
                    ],
                },
                { value: 5, children: [] },
            ],
        },
    ],
});
_heap = (0, Heap_1.addHeapNode)(_heap, { value: 7, parent: null, children: [] }, predicate);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 7,
    children: [
        {
            value: 1,
            children: [],
        },
        {
            value: 7,
            children: [
                {
                    value: 6,
                    children: [
                        {
                            value: 4,
                            children: [
                                {
                                    value: 3,
                                    children: [],
                                },
                            ],
                        },
                        { value: 5, children: [] },
                    ],
                },
            ],
        },
    ],
});
let _heap_100 = _heap.children[1].children[0].children[0];
_heap = (0, Heap_1.setHeapNode)(_heap_100, 7, predicate);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 7,
    children: [
        {
            value: 1,
            children: [],
        },
        {
            value: 7,
            children: [
                {
                    value: 7,
                    children: [
                        {
                            value: 6,
                            children: [{ value: 5, children: [] }],
                        },
                        {
                            value: 3,
                            children: [],
                        },
                    ],
                },
            ],
        },
    ],
});
_heap = (0, Heap_1.removeHeapNode)(_heap, predicate);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 7,
    children: [
        {
            value: 7,
            children: [
                {
                    value: 6,
                    children: [{ value: 5, children: [] }],
                },
                {
                    value: 3,
                    children: [],
                },
            ],
        },
        {
            value: 1,
            children: [],
        },
    ],
});
_heap_000 = _heap.children[0].children[0];
_heap = (0, Heap_1.removeHeapNode)(_heap_000, predicate);
assert_1.default.deepEqual((0, Heap_1.readHeap)(_heap), {
    value: 7,
    children: [
        {
            value: 7,
            children: [
                {
                    value: 5,
                    children: [],
                },
                {
                    value: 3,
                    children: [],
                },
            ],
        },
        {
            value: 1,
            children: [],
        },
    ],
});
//# sourceMappingURL=Heap.js.map