"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 Graph_1 = require("../../Class/Graph");
const debug_1 = require("../../debug");
const _ids_1 = require("../../system/_ids");
const system_1 = require("../util/system");
const spec0 = system_1.system.emptySpec();
const composition0 = new Graph_1.Graph(spec0, {}, system_1.system);
false && (0, debug_1.watchUnitAndLog)(composition0);
false && (0, debug_1.watchGraphAndLog)(composition0);
const addId = '0';
composition0.addUnitSpec(addId, {
    unit: {
        id: _ids_1.ID_ADD,
        input: {
            b: {
                data: '0',
            },
        },
        output: {},
    },
});
composition0.play();
const addUnit = composition0.getUnit(addId);
assert_1.default.equal(addUnit.peakInput('b'), 0);
composition0.setUnitInputConstant(addId, 'a', true);
composition0.setUnitInputConstant(addId, 'b', true);
assert_1.default.equal(addUnit.peakInput('a'), undefined);
composition0.setUnitInputData(addId, 'a', 1);
assert_1.default.equal(addUnit.peakInput('a'), 1);
assert_1.default.equal(addUnit.take('a + b'), 1);
composition0.setUnitInputData(addId, 'b', 2);
assert_1.default.equal(addUnit.take('a + b'), 3);
composition0.setUnitInputData(addId, 'a', 4);
assert_1.default.equal(addUnit.take('a + b'), 6);
composition0.setUnitInputData(addId, 'a', 5);
assert_1.default.equal(addUnit.take('a + b'), 7);
const spec1 = system_1.system.emptySpec();
const composition1 = new Graph_1.Graph(spec1, {}, system_1.system);
composition1.addUnitSpec(addId, {
    unit: {
        id: _ids_1.ID_ADD,
        input: {
            a: {
                data: '1',
                constant: true,
            },
            b: {
                data: '2',
                constant: true,
            },
        },
        output: {},
    },
});
composition1.play();
assert_1.default.equal(composition1.getUnit(addId).take('a + b'), 3);
composition1.setUnitInputData(addId, 'a', 9);
assert_1.default.equal(composition1.getUnit(addId).getOutput('a + b').take(), 11);
//# sourceMappingURL=add.js.map