"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const debug_1 = require("../../../debug");
const fromSpec_1 = require("../../../spec/fromSpec");
const _specs_1 = require("../../../system/_specs");
const system_1 = require("../../util/system");
const spec = require('../../../system/core/common/PriorityMerge/spec.json');
const PriorityMerge = (0, fromSpec_1.fromSpec)(spec, _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.refUnit('prioritymergefrom'));
priorityMerge.play();
// priorityMerge.push('a', [])
// priorityMerge.push('b', [])
// assert.deepEqual(priorityMerge.take('ab'), [])
// assert.deepEqual(priorityMerge.take('ab'), undefined)
// assert.deepEqual(priorityMerge.peakInput('a'), undefined)
// assert.deepEqual(priorityMerge.peakInput('b'), undefined)
priorityMerge.push('a', [1, 2, 4]);
priorityMerge.push('b', [3, 5]);
assert.deepEqual(priorityMerge.take('ab'), [1, 2, 3, 4, 5]);
assert.deepEqual(priorityMerge.take('ab'), undefined);
assert.deepEqual(priorityMerge.peakInput('a'), undefined);
assert.deepEqual(priorityMerge.peakInput('b'), undefined);
priorityMerge.push('a', [0]);
priorityMerge.push('b', [1]);
assert.deepEqual(priorityMerge.take('ab'), [0, 1]);
assert.deepEqual(priorityMerge.take('ab'), undefined);
assert.deepEqual(priorityMerge.peakInput('a'), undefined);
assert.deepEqual(priorityMerge.peakInput('b'), undefined);
priorityMerge.push('a', []);
priorityMerge.push('b', []);
assert.deepEqual(priorityMerge.peak('ab'), []);
priorityMerge.push('a', [0]);
assert.deepEqual(priorityMerge.take('ab'), [0]);
assert.deepEqual(priorityMerge.peakInput('a'), undefined);
assert.deepEqual(priorityMerge.peakInput('b'), undefined);
priorityMerge.push('a', [1, 2]);
priorityMerge.push('b', [3]);
assert.deepEqual(priorityMerge.peak('ab'), [1, 2, 3]);
assert.deepEqual(priorityMerge.peakInput('a'), [1, 2]);
assert.deepEqual(priorityMerge.peakInput('b'), [3]);
priorityMerge.push('a', [1]);
assert.deepEqual(priorityMerge.peak('ab'), [1, 3]);
assert.deepEqual(priorityMerge.peakInput('a'), [1]);
assert.deepEqual(priorityMerge.peakInput('b'), [3]);
assert.deepEqual(priorityMerge.take('ab'), [1, 3]);
assert.deepEqual(priorityMerge.peakInput('a'), undefined);
assert.deepEqual(priorityMerge.peakInput('b'), undefined);
priorityMerge.push('a', [1, 2, 4]);
priorityMerge.push('b', [3, 5]);
assert.deepEqual(priorityMerge.peak('ab'), [1, 2, 3, 4, 5]);
priorityMerge.push('b', [0, 3]);
assert.deepEqual(priorityMerge.peak('ab'), [0, 1, 2, 3, 4]);
priorityMerge.push('a', [1, 2]);
assert.deepEqual(priorityMerge.take('ab'), [0, 1, 2, 3]);
assert.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.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