"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 fromSpec_1 = require("../../../spec/fromSpec");
const _specs_1 = __importDefault(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_1.default.equal(pick.take('a'), 1);
assert_1.default.equal(pick.peakInput('a'), undefined);
assert_1.default.equal(pick.peakInput('b'), undefined);
assert_1.default.equal(pick.peakInput('c'), undefined);
pick.push('a', 1);
pick.push('b', 2);
pick.push('c', false);
assert_1.default.equal(pick.take('a'), 2);
assert_1.default.equal(pick.peakInput('a'), undefined);
assert_1.default.equal(pick.peakInput('b'), undefined);
assert_1.default.equal(pick.peakInput('c'), undefined);
dataCounter.reset();
dropCounter.reset();
pick.push('a', 1);
pick.push('b', 2);
pick.push('c', false);
assert_1.default.equal(dataCounter.count, 1);
assert_1.default.equal(dropCounter.count, 0);
assert_1.default.equal(pick.peakOutput('a'), 2);
pick.push('c', true);
assert_1.default.equal(dataCounter.count, 2);
assert_1.default.equal(dropCounter.count, 0);
assert_1.default.equal(pick.takeOutput('a'), 1);
dataCounter.reset();
dropCounter.reset();
pick.push('a', 1);
pick.push('b', 2);
pick.push('c', true);
assert_1.default.equal(dataCounter.count, 1);
assert_1.default.equal(dropCounter.count, 0);
assert_1.default.equal(pick.peakOutput('a'), 1);
pick.push('c', false);
assert_1.default.equal(dataCounter.count, 2);
assert_1.default.equal(dropCounter.count, 0);
assert_1.default.equal(pick.takeOutput('a'), 2);
//# sourceMappingURL=Pick.js.map