コード例 #1
0
        private void StartTest(bool arg2_isComp, string opSymbol, ComponentType compType, TestExprType[] dataTypes)
        {
            IExpression expr1 = TestExprFactory.GetExpression(dataTypes[0]);
            IExpression expr2 = TestExprFactory.GetExpression(dataTypes[1]);

            expr1.ExpressionText     = expr1.Structure.Components[0].ComponentName = "Component";
            expr1.OperatorDefinition = ModelResolvers.OperatorResolver("comp");

            if (arg2_isComp)
            {
                expr2.ExpressionText     = expr2.Structure.Components[0].ComponentName = "Component";
                expr2.OperatorDefinition = ModelResolvers.OperatorResolver("comp");
            }

            IExpression compCreateExpr = TestExprFactory.FoldExpression(expr1, expr2);

            compCreateExpr.OperatorDefinition = ModelResolvers.OperatorResolver(opSymbol);

            compCreateExpr.OperatorDefinition.Keyword = this.GetKeywordByCompType(compType);
            compCreateExpr.Structure = compCreateExpr.OperatorDefinition.GetOutputStructure(compCreateExpr);
            StructureComponent[] components = this.GetComponentsByCompType(compCreateExpr.Structure, compType);

            for (int i = 0; i < compCreateExpr.Structure.Components.Count; i++)
            {
                Assert.True(compCreateExpr.Structure.Components[i].ComponentName == expr1.Structure.Components[i].ComponentName);
            }

            BasicDataType type = expr2.Structure.Components[0].ValueDomain.DataType;

            if (type == BasicDataType.None || (type == BasicDataType.Integer && expr1.Structure.Components[0].ValueDomain.DataType == BasicDataType.Number))
            {
                type = expr1.Structure.Components[0].ValueDomain.DataType;
            }

            Assert.Equal(components.Length, expr2.Structure.Components.Count);
            Assert.Equal(components[0].ValueDomain.DataType, type);
        }