"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/array/PrependIf/spec.json');
const PrependIf = (0, fromSpec_1.fromSpec)(spec, _specs_1.default);
const prependIf = new PrependIf(system_1.system);
const dataCounter = (0, util_1.countEvent)(prependIf.getOutput('a'), 'data');
const dropCounter = (0, util_1.countEvent)(prependIf.getOutput('a'), 'drop');
false && (0, debug_1.watchUnitAndLog)(prependIf);
false && (0, debug_1.watchGraphAndLog)(prependIf);
false && (0, debug_1.watchGraphAndLog)(prependIf.getUnit('pick'));
false && (0, debug_1.watchTreeAndLog)(prependIf);
prependIf.play();
prependIf.push('a', []);
prependIf.push('b', 0);
prependIf.push('test', false);
assert.deepEqual(prependIf.peakInput('a'), []);
assert.deepEqual(prependIf.peakInput('b'), 0);
assert.deepEqual(prependIf.peakInput('test'), false);
assert.deepEqual(prependIf.take('a'), []);
assert.deepEqual(prependIf.peakInput('a'), undefined);
assert.deepEqual(prependIf.peakInput('b'), undefined);
assert.deepEqual(prependIf.peakInput('test'), undefined);
prependIf.push('a', []);
prependIf.push('b', 0);
prependIf.push('test', true);
assert.deepEqual(prependIf.peakInput('a'), []);
assert.deepEqual(prependIf.peakInput('b'), 0);
assert.deepEqual(prependIf.peakInput('test'), true);
assert.deepEqual(prependIf.take('a'), [0]);
assert.deepEqual(prependIf.peakInput('a'), undefined);
assert.deepEqual(prependIf.peakInput('b'), undefined);
assert.deepEqual(prependIf.peakInput('test'), undefined);
dataCounter.reset();
dropCounter.reset();
prependIf.push('a', []);
prependIf.push('b', 0);
prependIf.push('test', false);
assert.equal(dataCounter.count, 1);
assert.equal(dropCounter.count, 0);
assert.deepEqual(prependIf.peak('a'), []);
prependIf.push('test', true);
assert.equal(dataCounter.count, 2);
assert.equal(dropCounter.count, 0);
assert.deepEqual(prependIf.peak('a'), [0]);
prependIf.push('test', false);
assert.equal(dataCounter.count, 3);
assert.equal(dropCounter.count, 0);
assert.deepEqual(prependIf.take('a'), []);
assert.deepEqual(prependIf.peakInput('a'), undefined);
assert.deepEqual(prependIf.peakInput('b'), undefined);
assert.deepEqual(prependIf.peakInput('test'), undefined);
dataCounter.reset();
dropCounter.reset();
prependIf.push('a', []);
prependIf.push('b', 0);
prependIf.push('test', true);
assert.equal(dataCounter.count, 1);
assert.equal(dropCounter.count, 0);
assert.deepEqual(prependIf.peak('a'), [0]);
prependIf.push('test', false);
assert.equal(dataCounter.count, 2);
assert.equal(dropCounter.count, 0);
assert.deepEqual(prependIf.peak('a'), []);
prependIf.push('test', true);
assert.equal(dataCounter.count, 3);
assert.equal(dropCounter.count, 0);
assert.deepEqual(prependIf.take('a'), [0]);
assert.deepEqual(prependIf.peakInput('a'), undefined);
assert.deepEqual(prependIf.peakInput('b'), undefined);
assert.deepEqual(prependIf.peakInput('test'), undefined);
dataCounter.reset();
dropCounter.reset();
prependIf.push('test', true);
prependIf.push('b', 0);
prependIf.push('a', []);
assert.equal(dataCounter.count, 1);
assert.equal(dropCounter.count, 0);
assert.deepEqual(prependIf.peak('a'), [0]);
prependIf.push('test', false);
assert.equal(dataCounter.count, 2);
assert.equal(dropCounter.count, 0);
assert.deepEqual(prependIf.take('a'), []);
//# sourceMappingURL=PrependIf.js.map