"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Graph_1 = require("../../Class/Graph");
const SELF_1 = require("../../constant/SELF");
const debug_1 = require("../../debug");
const _ids_1 = require("../../system/_ids");
const assert_1 = require("../../util/assert");
const system_1 = require("../util/system");
const UNIT_ID_RANGE = 'UNIT_ID_RANGE';
const UNIT_ID_ADD_UNIT = 'UNIT_ID_ADD_UNIT';
const UNIT_ID_EMPTY = 'UNIT_ID_EMPTY';
const spec = system_1.system.emptySpec();
const composition0 = new Graph_1.Graph(spec, {}, system_1.system);
false && (0, debug_1.watchUnitAndLog)(composition0);
false && (0, debug_1.watchGraphAndLog)(composition0);
composition0.play();
composition0.addUnitSpec(UNIT_ID_EMPTY, {
    unit: {
        id: _ids_1.ID_EMPTY,
        input: {},
    },
});
composition0.addUnitSpec(UNIT_ID_ADD_UNIT, {
    unit: {
        id: _ids_1.ID_ADD_UNIT,
        input: {
            class: {
                data: {
                    ref: [[]],
                    data: {
                        unit: {
                            id: _ids_1.ID_RANGE,
                            input: {
                                a: {
                                    constant: true,
                                    data: {
                                        data: 0,
                                    },
                                },
                                b: {
                                    constant: true,
                                    data: {
                                        data: 3,
                                    },
                                },
                            },
                        },
                    },
                },
            },
        },
    },
});
composition0.addMerge({
    [UNIT_ID_ADD_UNIT]: {
        input: {
            graph: true,
        },
    },
    [UNIT_ID_EMPTY]: {
        output: {
            [SELF_1.SELF]: true,
        },
    },
}, '0');
composition0.setUnitPinData(UNIT_ID_ADD_UNIT, 'input', 'id', UNIT_ID_RANGE);
const empty = composition0.getUnit(UNIT_ID_EMPTY);
assert_1.assert.equal(empty.getUnitCount(), 1);
const range = empty.getUnit(UNIT_ID_RANGE);
assert_1.assert.equal(range.getPinData('input', 'a'), 0);
assert_1.assert.equal(range.getPinData('input', 'b'), 3);
assert_1.assert.equal(range.getPinData('output', 'i'), 0);
//# sourceMappingURL=addUnit.js.map