"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert_1 = __importDefault(require("assert"));
const debug_1 = require("../../../debug");
const fromBundle_1 = require("../../../spec/fromBundle");
const _specs_1 = __importDefault(require("../../../system/_specs"));
const system_1 = require("../../util/system");
const bundle = require('./PriorityMerge.json');
const PriorityMerge = (0, fromBundle_1.fromBundle)(bundle, _specs_1.default, {});
const priorityMerge = new PriorityMerge(system_1.system);
false && (0, debug_1.watchUnitAndLog)(priorityMerge);
false && (0, debug_1.watchGraphAndLog)(priorityMerge);
false && (0, debug_1.watchGraphAndLog)(priorityMerge.getUnit('prioritymergefrom'));
priorityMerge.play();
priorityMerge.push('a', []);
priorityMerge.push('b', []);
assert_1.default.deepEqual(priorityMerge.take('ab'), []);
assert_1.default.deepEqual(priorityMerge.take('ab'), undefined);
assert_1.default.deepEqual(priorityMerge.peakInput('a'), undefined);
assert_1.default.deepEqual(priorityMerge.peakInput('b'), undefined);
priorityMerge.push('a', [1, 2, 4]);
priorityMerge.push('b', [3, 5]);
assert_1.default.deepEqual(priorityMerge.take('ab'), [1, 2, 3, 4, 5]);
assert_1.default.deepEqual(priorityMerge.take('ab'), undefined);
assert_1.default.deepEqual(priorityMerge.peakInput('a'), undefined);
assert_1.default.deepEqual(priorityMerge.peakInput('b'), undefined);
priorityMerge.push('a', [0]);
priorityMerge.push('b', [1]);
assert_1.default.deepEqual(priorityMerge.take('ab'), [0, 1]);
assert_1.default.deepEqual(priorityMerge.take('ab'), undefined);
assert_1.default.deepEqual(priorityMerge.peakInput('a'), undefined);
assert_1.default.deepEqual(priorityMerge.peakInput('b'), undefined);
priorityMerge.push('a', []);
priorityMerge.push('b', []);
assert_1.default.deepEqual(priorityMerge.peak('ab'), []);
priorityMerge.push('a', [0]);
assert_1.default.deepEqual(priorityMerge.take('ab'), [0]);
assert_1.default.deepEqual(priorityMerge.peakInput('a'), undefined);
assert_1.default.deepEqual(priorityMerge.peakInput('b'), undefined);
priorityMerge.push('a', [1, 2]);
priorityMerge.push('b', [3]);
assert_1.default.deepEqual(priorityMerge.peak('ab'), [1, 2, 3]);
assert_1.default.deepEqual(priorityMerge.peakInput('a'), [1, 2]);
assert_1.default.deepEqual(priorityMerge.peakInput('b'), [3]);
priorityMerge.push('a', [1]);
assert_1.default.deepEqual(priorityMerge.peak('ab'), [1, 3]);
assert_1.default.deepEqual(priorityMerge.peakInput('a'), [1]);
assert_1.default.deepEqual(priorityMerge.peakInput('b'), [3]);
assert_1.default.deepEqual(priorityMerge.take('ab'), [1, 3]);
assert_1.default.deepEqual(priorityMerge.peakInput('a'), undefined);
assert_1.default.deepEqual(priorityMerge.peakInput('b'), undefined);
priorityMerge.push('a', [1, 2, 4]);
priorityMerge.push('b', [3, 5]);
assert_1.default.deepEqual(priorityMerge.peak('ab'), [1, 2, 3, 4, 5]);
priorityMerge.push('b', [0, 3]);
assert_1.default.deepEqual(priorityMerge.peak('ab'), [0, 1, 2, 3, 4]);
priorityMerge.push('a', [1, 2]);
assert_1.default.deepEqual(priorityMerge.take('ab'), [0, 1, 2, 3]);
assert_1.default.deepEqual(priorityMerge.take('ab'), undefined);
priorityMerge.push('a', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
priorityMerge.push('b', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
assert_1.default.deepEqual(priorityMerge.take('ab'), [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10]);
//# sourceMappingURL=PriorityMerge.js.map