"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 Merge_1 = __importDefault(require("../Class/Merge"));
const Pin_1 = require("../Pin");
const debug_1 = require("../debug");
const system_1 = require("./util/system");
const merge0 = new Merge_1.default(system_1.system);
merge0.play();
false && (0, debug_1.watchUnitAndLog)(merge0);
merge0.addInput('a', new Pin_1.Pin({}, system_1.system));
merge0.push('a', 1);
assert_1.default.equal(merge0.peakInput('a'), 1);
merge0.addOutput('a', new Pin_1.Pin({}, system_1.system));
assert_1.default.equal(merge0.takeOutput('a'), 1);
merge0.addInput('b', new Pin_1.Pin({}, system_1.system));
merge0.addInput('c', new Pin_1.Pin({}, system_1.system));
merge0.push('a', 1);
merge0.push('b', 2);
merge0.push('c', 3);
assert_1.default.equal(merge0.peakInput('a'), undefined);
assert_1.default.equal(merge0.peakInput('b'), undefined);
assert_1.default.equal(merge0.peakInput('c'), 3);
assert_1.default.equal(merge0.peakOutput('a'), 3);
merge0.addOutput('b', new Pin_1.Pin({}, system_1.system));
assert_1.default.equal(merge0.peakOutput('b'), 3);
assert_1.default.equal(merge0.take('a'), 3);
assert_1.default.equal(merge0.take('b'), 3);
assert_1.default.equal(merge0.peakInput('a'), undefined);
assert_1.default.equal(merge0.peakInput('b'), undefined);
assert_1.default.equal(merge0.peakInput('c'), undefined);
merge0.push('a', 1);
assert_1.default.equal(merge0.take('a'), 1);
assert_1.default.equal(merge0.take('b'), 1);
assert_1.default.equal(merge0.peakInput('a'), undefined);
assert_1.default.equal(merge0.peakInput('b'), undefined);
assert_1.default.equal(merge0.peakInput('c'), undefined);
assert_1.default.equal(merge0.peakOutput('a'), undefined);
assert_1.default.equal(merge0.peakOutput('b'), undefined);
merge0.push('a', 1);
assert_1.default.equal(merge0.peakOutput('a'), 1);
assert_1.default.equal(merge0.peakOutput('b'), 1);
merge0.push('b', 2);
assert_1.default.equal(merge0.peakOutput('a'), 2);
assert_1.default.equal(merge0.peakOutput('b'), 2);
assert_1.default.equal(merge0.take('a'), 2);
assert_1.default.equal(merge0.take('b'), 2);
assert_1.default.equal(merge0.peakInput('a'), undefined);
assert_1.default.equal(merge0.peakInput('b'), undefined);
// merge0.push('a', 3)
// assert.equal(merge0.take('a'), 3)
// merge0.removeOutput('b')
// assert.equal(merge0.peakInput('a'), undefined)
// assert.equal(merge0.peakInput('b'), undefined)
merge0.addInput('d', new Pin_1.Pin({ data: 10 }, system_1.system));
assert_1.default.equal(merge0.take('a'), 10);
assert_1.default.equal(merge0.peakInput('a'), undefined);
assert_1.default.equal(merge0.peakInput('b'), undefined);
assert_1.default.equal(merge0.peakInput('c'), undefined);
merge0.push('d', 20);
assert_1.default.equal(merge0.peakOutput('a'), 20);
merge0.removeInput('d', false);
assert_1.default.equal(merge0.peakOutput('a'), 20);
const merge1 = new Merge_1.default(system_1.system);
merge1.play();
false && (0, debug_1.watchUnitAndLog)(merge1);
merge1.addInput('a', new Pin_1.Pin({}, system_1.system));
merge1.addInput('b', new Pin_1.Pin({}, system_1.system));
merge1.addOutput('a', new Pin_1.Pin({}, system_1.system));
merge1.push('a', 0);
assert_1.default.equal(merge1.peakInput('a'), 0);
assert_1.default.equal(merge1.peakInput('b'), undefined);
assert_1.default.equal(merge1.peakOutput('a'), 0);
merge1.removeInput('a', false);
assert_1.default.equal(merge1.peakOutput('a'), 0);
const merge2 = new Merge_1.default(system_1.system);
merge2.play();
false && (0, debug_1.watchUnitAndLog)(merge2);
merge2.addInput('a', new Pin_1.Pin({}, system_1.system));
merge2.addInput('b', new Pin_1.Pin({}, system_1.system));
merge2.addOutput('a', new Pin_1.Pin({}, system_1.system));
merge2.addOutput('b', new Pin_1.Pin({}, system_1.system));
merge2.push('a', 0);
merge2.pushOutput('a', 1);
assert_1.default.equal(merge2.peakInput('a'), 0);
assert_1.default.equal(merge2.peakOutput('a'), 1);
merge2.pushOutput('b', 2);
assert_1.default.equal(merge2.peakInput('a'), undefined);
assert_1.default.equal(merge2.peakOutput('a'), 1);
assert_1.default.equal(merge2.peakOutput('b'), 2);
merge2.push('b', 0);
assert_1.default.equal(merge2.peakInput('a'), undefined);
assert_1.default.equal(merge2.peakInput('b'), 0);
assert_1.default.equal(merge2.peakOutput('a'), 0);
assert_1.default.equal(merge2.peakOutput('b'), 0);
merge2.pushOutput('a', 1);
assert_1.default.equal(merge2.peakInput('b'), 0);
assert_1.default.equal(merge2.peakOutput('a'), 1);
assert_1.default.equal(merge2.peakOutput('b'), 0);
merge2.takeOutput('a');
assert_1.default.equal(merge2.peakInput('b'), 0);
assert_1.default.equal(merge2.peakOutput('a'), undefined);
assert_1.default.equal(merge2.peakOutput('b'), 0);
merge2.pushOutput('a', 1);
assert_1.default.equal(merge2.peakInput('b'), 0);
assert_1.default.equal(merge2.peakOutput('a'), 1);
assert_1.default.equal(merge2.peakOutput('b'), 0);
merge2.takeOutput('a');
assert_1.default.equal(merge2.peakInput('b'), 0);
assert_1.default.equal(merge2.peakOutput('a'), undefined);
assert_1.default.equal(merge2.peakOutput('b'), 0);
merge2.push('b', 0);
assert_1.default.equal(merge2.peakInput('a'), undefined);
assert_1.default.equal(merge2.peakInput('b'), 0);
assert_1.default.equal(merge2.peakOutput('a'), 0);
assert_1.default.equal(merge2.peakOutput('b'), 0);
merge2.pushOutput('a', 1);
assert_1.default.equal(merge2.peakInput('b'), 0);
assert_1.default.equal(merge2.peakOutput('a'), 1);
assert_1.default.equal(merge2.peakOutput('b'), 0);
merge2.takeInput('b');
assert_1.default.equal(merge2.peakInput('b'), undefined);
assert_1.default.equal(merge2.peakOutput('a'), 1);
assert_1.default.equal(merge2.peakOutput('b'), undefined);
//# sourceMappingURL=Merge.js.map