"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 util_1 = require("../../util");
const system_1 = require("../../util/system");
const spec = require('../../../system/core/control/Pick/spec.json');
const Pick = (0, fromSpec_1.fromSpec)(spec, _specs_1.default, {});
const pick = new Pick(system_1.system);
false && (0, debug_1.watchUnitAndLog)(pick);
false && (0, debug_1.watchGraphAndLog)(pick);
const dataCounter = (0, util_1.countEvent)(pick.getOutput('a'), 'data');
const dropCounter = (0, util_1.countEvent)(pick.getOutput('a'), 'drop');
pick.play();
pick.push('a', 1);
pick.push('b', 2);
pick.push('c', true);
assert.equal(pick.take('a'), 1);
assert.equal(pick.peakInput('a'), undefined);
assert.equal(pick.peakInput('b'), undefined);
assert.equal(pick.peakInput('c'), undefined);
pick.push('a', 1);
pick.push('b', 2);
pick.push('c', false);
assert.equal(pick.take('a'), 2);
assert.equal(pick.peakInput('a'), undefined);
assert.equal(pick.peakInput('b'), undefined);
assert.equal(pick.peakInput('c'), undefined);
dataCounter.reset();
dropCounter.reset();
pick.push('a', 1);
pick.push('b', 2);
pick.push('c', false);
assert.equal(dataCounter.count, 1);
assert.equal(dropCounter.count, 0);
assert.equal(pick.peakOutput('a'), 2);
pick.push('c', true);
assert.equal(dataCounter.count, 2);
assert.equal(dropCounter.count, 0);
assert.equal(pick.takeOutput('a'), 1);
dataCounter.reset();
dropCounter.reset();
pick.push('a', 1);
pick.push('b', 2);
pick.push('c', true);
assert.equal(dataCounter.count, 1);
assert.equal(dropCounter.count, 0);
assert.equal(pick.peakOutput('a'), 1);
pick.push('c', false);
assert.equal(dataCounter.count, 2);
assert.equal(dropCounter.count, 0);
assert.equal(pick.takeOutput('a'), 2);
//# sourceMappingURL=Pick.js.map