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