"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 system_1 = require("../../util/system");
const spec = require('../../../system/core/loop/RangeReverse/spec.json');
const RangeReverse = (0, fromSpec_1.fromSpec)(spec, _specs_1.default, {});
const rangeRev = new RangeReverse(system_1.system);
false && (0, debug_1.watchUnitAndLog)(rangeRev);
false && (0, debug_1.watchGraphAndLog)(rangeRev);
rangeRev.play();
rangeRev.push('a', 5);
rangeRev.push('b', 5);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 5);
rangeRev.push('b', 5);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 2);
rangeRev.push('b', 3);
assert_1.default.equal(rangeRev.take('i'), 2);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 2);
rangeRev.push('b', 3);
assert_1.default.equal(rangeRev.take('i'), 2);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 3);
rangeRev.push('b', 2);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 2);
rangeRev.push('b', 3);
assert_1.default.equal(rangeRev.take('i'), 2);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 2);
rangeRev.push('b', 4);
assert_1.default.equal(rangeRev.take('i'), 3);
assert_1.default.equal(rangeRev.take('i'), 2);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 2);
rangeRev.push('b', 5);
assert_1.default.equal(rangeRev.take('i'), 4);
assert_1.default.equal(rangeRev.take('i'), 3);
assert_1.default.equal(rangeRev.take('i'), 2);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 2);
rangeRev.push('b', 2);
rangeRev.push('a', 1);
rangeRev.push('b', 1);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 2);
rangeRev.push('b', 4);
assert_1.default.equal(rangeRev.peakInput('a'), 2);
assert_1.default.equal(rangeRev.peakInput('b'), 4);
assert_1.default.equal(rangeRev.take('i'), 3);
assert_1.default.equal(rangeRev.take('i'), 2);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', -2);
rangeRev.push('b', -1);
assert_1.default.equal(rangeRev.peakInput('a'), -2);
assert_1.default.equal(rangeRev.peakInput('b'), -1);
assert_1.default.equal(rangeRev.take('i'), -2);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 0);
rangeRev.push('b', 2);
assert_1.default.equal(rangeRev.peakInput('a'), 0);
assert_1.default.equal(rangeRev.peakInput('b'), 2);
assert_1.default.equal(rangeRev.peak('i'), 1);
rangeRev.push('a', 1);
assert_1.default.equal(rangeRev.take('i'), 1);
assert_1.default.equal(rangeRev.peak('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 0);
rangeRev.push('b', 2);
assert_1.default.equal(rangeRev.peakInput('a'), 0);
assert_1.default.equal(rangeRev.peakInput('b'), 2);
assert_1.default.equal(rangeRev.take('i'), 1);
rangeRev.push('b', 1);
assert_1.default.equal(rangeRev.take('i'), 0);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 0);
rangeRev.push('b', 2);
assert_1.default.equal(rangeRev.peakInput('a'), 0);
assert_1.default.equal(rangeRev.peakInput('b'), 2);
assert_1.default.equal(rangeRev.peak('i'), 1);
rangeRev.push('a', 2);
assert_1.default.equal(rangeRev.peak('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('a', 0);
rangeRev.push('b', 2);
assert_1.default.equal(rangeRev.peakInput('a'), 0);
assert_1.default.equal(rangeRev.peakInput('b'), 2);
assert_1.default.equal(rangeRev.take('i'), 1);
assert_1.default.equal(rangeRev.takeInput('b'), 2);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), 0);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.setInputConstant('a', true);
rangeRev.push('a', 0);
rangeRev.push('b', 2);
assert_1.default.equal(rangeRev.peakInput('a'), 0);
assert_1.default.equal(rangeRev.peakInput('b'), 2);
assert_1.default.equal(rangeRev.take('i'), 1);
assert_1.default.equal(rangeRev.take('i'), 0);
assert_1.default.equal(rangeRev.peakInput('a'), 0);
assert_1.default.equal(rangeRev.take('i'), undefined);
rangeRev.setInputConstant('a', false);
assert_1.default.equal(rangeRev.peakInput('a'), 0);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
rangeRev.push('b', 1);
assert_1.default.equal(rangeRev.take('i'), 0);
assert_1.default.equal(rangeRev.take('i'), undefined);
assert_1.default.equal(rangeRev.peakInput('a'), undefined);
assert_1.default.equal(rangeRev.peakInput('b'), undefined);
// // infinite loop
// rangeRev.setInputConstant('a', true)
// rangeRev.setInputConstant('b', true)
// rangeRev.setOutputIgnored('i', true)
// rangeRev.push('a', 0)
// rangeRev.push('b', 1)
//# sourceMappingURL=RangeReverse.js.map