Exemplo n.º 1
0
        public void GetOutputStructure_WrongArgExpr_ThrowsException()
        {
            TestExprType[][] correctCombs = new TestExprType[][] {
                new TestExprType[] { TestExprType.Boolean },
                new TestExprType[] { TestExprType.None },
                new TestExprType[] { TestExprType.BoolsDataset },
                new TestExprType[] { TestExprType.NonesDataset },
            };

            TestExprType[][] combinations = Enum.GetValues(typeof(TestExprType)).Cast <TestExprType>().GetCombinations(1);
            TestExprType[][] wrongCombs   = combinations.Without(correctCombs);

            foreach (TestExprType[] wrongComb in wrongCombs.Where(wrongComb => (int)wrongComb[0] < 18)) // No mixed datasets
            {
                IExpression notExpr = TestExprFactory.GetExpression(wrongComb);
                notExpr.OperatorDefinition = ModelResolvers.OperatorResolver("not");
                if (notExpr.Operands["ds_1"].Structure.Measures.Count > 1)
                {
                    notExpr.Operands["ds_1"].Structure.Measures.RemoveAt(1);
                }

                // Debug condition example: wrongComb[0] == TestExprType.Integer
                Assert.ThrowsAny <VtlOperatorError>(() => { notExpr.OperatorDefinition.GetOutputStructure(notExpr); });
            }
        }
Exemplo n.º 2
0
        public void GetOutputStructure_WrongArgExpr1Arg_ThrowsException(string opSymbol)
        {
            TestExprType[][] correctCombs = new TestExprType[][] {
                new TestExprType[] { TestExprType.String },
                new TestExprType[] { TestExprType.None },
                new TestExprType[] { TestExprType.StringsDataset },
                new TestExprType[] { TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.MixedNoneStrDataset }
            };

            TestExprType[][] combinations = Enum.GetValues(typeof(TestExprType)).Cast <TestExprType>().GetCombinations(1);
            TestExprType[][] wrongCombs   = combinations.Without(correctCombs.ToArray());

            foreach (TestExprType[] wrongComb in wrongCombs.Where(wrongComb => (int)wrongComb[0] < 18)) // No mixed datasets
            {
                IExpression stringExpr = TestExprFactory.GetExpression(new TestExprType[] { wrongComb[0] });
                stringExpr.OperatorDefinition = ModelResolvers.OperatorResolver(opSymbol);
                if (opSymbol.In("length", "instr") && stringExpr.Operands["ds_1"].Structure.Measures.Count > 1)
                {
                    stringExpr.Operands["ds_1"].Structure.Measures.RemoveAt(1);
                }

                // Debug condition example: wrongComb[0] == TestExprType.Integer
                Assert.ThrowsAny <VtlOperatorError>(() => { stringExpr.OperatorDefinition.GetOutputStructure(stringExpr); });
            }
        }
        public void GetOutputStructure_WrongArgExpr_ThrowsException()
        {
            TestExprType[][] correctCombs = new TestExprType[][] {
                new TestExprType[] { TestExprType.Integer },
                new TestExprType[] { TestExprType.Number },
                new TestExprType[] { TestExprType.None },
                new TestExprType[] { TestExprType.IntsDataset },
                new TestExprType[] { TestExprType.NumbersDataset },
                new TestExprType[] { TestExprType.MixedIntNumDataset },
                new TestExprType[] { TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.MixedNoneIntDataset },
                new TestExprType[] { TestExprType.MixedNoneNumDataset }
            };

            TestExprType[][] combinations = Enum.GetValues(typeof(TestExprType)).Cast <TestExprType>().GetCombinations(1);
            TestExprType[][] wrongCombs   = combinations.Without(correctCombs);

            foreach (string opSymbol in this._operators)
            {
                foreach (TestExprType[] wrongComb in wrongCombs)
                {
                    IExpression unaryArithmeticExpr = TestExprFactory.GetExpression(wrongComb);
                    unaryArithmeticExpr.OperatorDefinition = ModelResolvers.OperatorResolver(opSymbol);

                    // Debug condition example: wrongComb[0] == TestExprType.Integer
                    Assert.ThrowsAny <VtlOperatorError>(() => { unaryArithmeticExpr.OperatorDefinition.GetOutputStructure(unaryArithmeticExpr); });
                }
            }
        }
        public void GetOutputStructure_MultiMeasuresDatasetExpr_ThrowsException()
        {
            TestExprType[][] scalars = new TestExprType[][] {
                new TestExprType[] { TestExprType.Integer },
                new TestExprType[] { TestExprType.Number },
                new TestExprType[] { TestExprType.String },
                new TestExprType[] { TestExprType.Boolean },
                new TestExprType[] { TestExprType.Time },
                new TestExprType[] { TestExprType.Date },
                new TestExprType[] { TestExprType.TimePeriod },
                new TestExprType[] { TestExprType.Duration },
                new TestExprType[] { TestExprType.None }
            };

            TestExprType[][] types    = Enum.GetValues(typeof(TestExprType)).Cast <TestExprType>().GetCombinations(1);
            TestExprType[][] datasets = types.Without(scalars);

            foreach (TestExprType[] dataset in datasets)
            {
                IExpression isNullExpr = TestExprFactory.GetExpression(dataset);
                isNullExpr.OperatorDefinition = ModelResolvers.OperatorResolver("isnull");

                // Debug condition example: dataset[0] == TestExprType.IntsDataset
                Assert.ThrowsAny <VtlOperatorError>(() => { isNullExpr.OperatorDefinition.GetOutputStructure(isNullExpr); });
            }
        }
Exemplo n.º 5
0
        public void GetOutputStructure_WrongArgsExpr_ThrowsException()
        {
            TestExprType[][] correctCombs = new TestExprType[][] {
                new TestExprType[] { TestExprType.String, TestExprType.String },
                new TestExprType[] { TestExprType.String, TestExprType.None },
                new TestExprType[] { TestExprType.None, TestExprType.String },
                new TestExprType[] { TestExprType.None, TestExprType.None },
                new TestExprType[] { TestExprType.StringsDataset, TestExprType.String },
                new TestExprType[] { TestExprType.StringsDataset, TestExprType.None },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.String },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.None }
            };

            TestExprType[][] combinations = Enum.GetValues(typeof(TestExprType)).Cast <TestExprType>().GetCombinations(2);
            TestExprType[][] wrongCombs   = combinations.Without(correctCombs);

            foreach (TestExprType[] wrongComb in wrongCombs.Where(wrongComb => (int)wrongComb[0] < 18 && (int)wrongComb[1] < 18)) // No mixed datasets
            {
                IExpression stringExpr = TestExprFactory.GetExpression(wrongComb);
                stringExpr.OperatorDefinition = ModelResolvers.OperatorResolver("match_characters");

                if (!stringExpr.Operands["ds_1"].IsScalar)
                {
                    stringExpr.Operands["ds_1"].Structure.Measures.RemoveAt(1);
                }
                if (!stringExpr.Operands["ds_2"].IsScalar)
                {
                    stringExpr.Operands["ds_2"].Structure.Measures.RemoveAt(1);
                }

                // Debug condition example: wrongComb[0] == TestExprType.Integer && wrongComb[1] == TestExprType.Integer
                Assert.ThrowsAny <VtlOperatorError>(() => { stringExpr.OperatorDefinition.GetOutputStructure(stringExpr); });
            }
        }
Exemplo n.º 6
0
        public void GetOutputStructure_MultiMeasuresDatasetExpr_ThrowsException(TestExprType type)
        {
            IExpression notExpr = TestExprFactory.GetExpression(new TestExprType[] { type });

            notExpr.OperatorDefinition = ModelResolvers.OperatorResolver("not");

            Assert.ThrowsAny <VtlOperatorError>(() => { notExpr.OperatorDefinition.GetOutputStructure(notExpr); });
        }
Exemplo n.º 7
0
        public void GetOutputStructure_CorrectScalarExpr_BoolScalarStructure(TestExprType type)
        {
            IExpression notExpr = TestExprFactory.GetExpression(new TestExprType[] { type });

            notExpr.OperatorDefinition = ModelResolvers.OperatorResolver("not");

            IDataStructure dataStructure = notExpr.OperatorDefinition.GetOutputStructure(notExpr);

            Assert.True(TestExprFactory.GetExpression(TestExprType.Boolean).Structure.EqualsObj(dataStructure));
        }
Exemplo n.º 8
0
        public void GetOutputStructure_WrongScalarExpr_ThrowsException(TestExprType type)
        {
            IExpression periodIndicatorExpr = TestExprFactory.GetExpression("period_indicator", ExpressionFactoryNameTarget.OperatorSymbol);
            IExpression scalarExpr          = TestExprFactory.GetExpression(type);

            scalarExpr.OperatorDefinition = ModelResolvers.OperatorResolver("const");

            periodIndicatorExpr.AddOperand("ds_1", scalarExpr);

            Assert.ThrowsAny <VtlOperatorError>(() => { periodIndicatorExpr.OperatorDefinition.GetOutputStructure(periodIndicatorExpr); });
        }
Exemplo n.º 9
0
        public void GetOutputStructure_CorrectExpr_CorrectScalarStructure(TestExprType expectedType, string exprText)
        {
            IExpression constExpr = ModelResolvers.ExprResolver();

            constExpr.ExpressionText = exprText;

            constExpr.OperatorDefinition = ModelResolvers.OperatorResolver("const");

            IDataStructure dataStructure = constExpr.OperatorDefinition.GetOutputStructure(constExpr);

            Assert.True(TestExprFactory.GetExpression(expectedType).Structure.EqualsObj(dataStructure));
        }
        public void GetOutputStructure_CorrectExpr_DataStructure(TestExprType type)
        {
            foreach (string opSymbol in this._operators)
            {
                IExpression unaryArithmeticExpr = ModelResolvers.ExprResolver();
                unaryArithmeticExpr.OperatorDefinition = ModelResolvers.OperatorResolver(opSymbol);
                unaryArithmeticExpr.AddOperand("ds_1", TestExprFactory.GetExpression(type));

                IDataStructure dataStructure = unaryArithmeticExpr.OperatorDefinition.GetOutputStructure(unaryArithmeticExpr);

                Assert.True(unaryArithmeticExpr.Operands["ds_1"].Structure.EqualsObj(dataStructure));
            }
        }
Exemplo n.º 11
0
        public void GetOutputStructure_WrongDatasetParamExpr_ThrowsException(TestExprType type)
        {
            IExpression periodIndicatorExpr = TestExprFactory.GetExpression("period_indicator", ExpressionFactoryNameTarget.OperatorSymbol);
            IExpression datasetExpr         = TestExprFactory.GetExpression("get", ExpressionFactoryNameTarget.OperatorSymbol);

            periodIndicatorExpr.AddOperand("ds_1", datasetExpr);

            datasetExpr.Structure = ModelResolvers.DsResolver();
            datasetExpr.Structure.Identifiers.Add(new StructureComponent(BasicDataType.Integer, "Id1"));
            datasetExpr.Structure.Identifiers.Add(new StructureComponent((BasicDataType)type, "Id2"));
            datasetExpr.Structure.Measures.Add(new StructureComponent(BasicDataType.String, "Me1"));

            Assert.ThrowsAny <VtlOperatorError>(() => { periodIndicatorExpr.OperatorDefinition.GetOutputStructure(periodIndicatorExpr); });
        }
        public void GetOutputStructure_OneMeasureDatasetExpr_OneMeasureBoolStructure(TestExprType type)
        {
            IExpression isNullExpr = TestExprFactory.GetExpression(new TestExprType[] { type });

            isNullExpr.OperatorDefinition = ModelResolvers.OperatorResolver("isnull");
            isNullExpr.Operands["ds_1"].Structure.Measures.RemoveAt(1);

            IDataStructure expectedStructure = isNullExpr.Operands["ds_1"].Structure.GetCopy();

            expectedStructure.Measures.Clear();
            expectedStructure.Measures.Add(new StructureComponent(BasicDataType.Boolean, "bool_var"));

            IDataStructure dataStructure = isNullExpr.OperatorDefinition.GetOutputStructure(isNullExpr);

            Assert.True(expectedStructure.EqualsObj(dataStructure));
        }
        public void GetOutputStructure_WrongArgsExpr_ThrowsException()
        {
            TestExprType[][] correctCombs = new TestExprType[][] {
                new TestExprType[] { TestExprType.Integer, TestExprType.Integer },
                new TestExprType[] { TestExprType.Integer, TestExprType.Number },
                new TestExprType[] { TestExprType.Integer, TestExprType.None },
                new TestExprType[] { TestExprType.Number, TestExprType.Number },
                new TestExprType[] { TestExprType.Number, TestExprType.Integer },
                new TestExprType[] { TestExprType.Number, TestExprType.None },
                new TestExprType[] { TestExprType.String, TestExprType.String },
                new TestExprType[] { TestExprType.String, TestExprType.None },
                new TestExprType[] { TestExprType.Boolean, TestExprType.Boolean },
                new TestExprType[] { TestExprType.Boolean, TestExprType.None },
                new TestExprType[] { TestExprType.Time, TestExprType.Time },
                new TestExprType[] { TestExprType.Time, TestExprType.None },
                new TestExprType[] { TestExprType.Date, TestExprType.Date },
                new TestExprType[] { TestExprType.Date, TestExprType.None },
                new TestExprType[] { TestExprType.TimePeriod, TestExprType.TimePeriod },
                new TestExprType[] { TestExprType.TimePeriod, TestExprType.None },
                new TestExprType[] { TestExprType.Duration, TestExprType.Duration },
                new TestExprType[] { TestExprType.Duration, TestExprType.None },
                new TestExprType[] { TestExprType.None, TestExprType.None },
                new TestExprType[] { TestExprType.None, TestExprType.Integer },
                new TestExprType[] { TestExprType.None, TestExprType.Number },
                new TestExprType[] { TestExprType.None, TestExprType.String },
                new TestExprType[] { TestExprType.None, TestExprType.Boolean },
                new TestExprType[] { TestExprType.None, TestExprType.Time },
                new TestExprType[] { TestExprType.None, TestExprType.Date },
                new TestExprType[] { TestExprType.None, TestExprType.TimePeriod },
                new TestExprType[] { TestExprType.None, TestExprType.Duration }
            };

            TestExprType[][] combinations = Enum.GetValues(typeof(TestExprType)).Cast <TestExprType>().GetCombinations(2);
            TestExprType[][] wrongCombs   = combinations.Without(correctCombs);

            foreach (TestExprType[] wrongComb in wrongCombs)
            {
                IExpression collectionExpr = TestExprFactory.GetExpression(wrongComb);
                collectionExpr.OperatorDefinition = ModelResolvers.OperatorResolver("collection");

                // Debug condition example: wrongComb[0] == TestExprType.Integer && wrongComb[1] == TestExprType.Integer
                Assert.ThrowsAny <VtlOperatorError>(() => { collectionExpr.OperatorDefinition.GetOutputStructure(collectionExpr); });
            }
        }
        public void GetOutputStructure_IdWrongArgsExpr_ThrowsException()
        {
            TestExprType[][] correctCombs = new TestExprType[][] {
                new TestExprType[] { TestExprType.None, TestExprType.Integer },
                new TestExprType[] { TestExprType.None, TestExprType.Number },
                new TestExprType[] { TestExprType.None, TestExprType.String },
                new TestExprType[] { TestExprType.None, TestExprType.Boolean },
                new TestExprType[] { TestExprType.None, TestExprType.Time },
                new TestExprType[] { TestExprType.None, TestExprType.Date },
                new TestExprType[] { TestExprType.None, TestExprType.TimePeriod },
                new TestExprType[] { TestExprType.None, TestExprType.Duration }
            };

            TestExprType[][] combinations = Enum.GetValues(typeof(TestExprType)).Cast <TestExprType>().GetCombinations(2);
            TestExprType[][] wrongCombs   = combinations.Without(correctCombs);

            foreach (string opSymbol in this._operators)
            {
                foreach (TestExprType[] wrongComb in wrongCombs)
                {
                    for (int i = 0; i < 2; i++)
                    {
                        IExpression compCreateExpr = TestExprFactory.GetExpression(wrongComb);
                        compCreateExpr.Operands["ds_1"].Structure.Identifiers.Add(compCreateExpr.Operands["ds_1"].Structure.Measures[0]);
                        compCreateExpr.Operands["ds_1"].Structure.Measures.Clear();

                        if (i == 1)
                        {
                            IExpression expr2 = compCreateExpr.Operands["ds_2"];
                            expr2.ExpressionText     = "Me1";
                            expr2.OperatorDefinition = ModelResolvers.OperatorResolver("comp");
                        }

                        compCreateExpr.OperatorDefinition         = ModelResolvers.OperatorResolver(opSymbol);
                        compCreateExpr.OperatorDefinition.Keyword = "identifier";

                        // Debug condition example: wrongComb[0] == TestExprType.Integer && wrongComb[1] == TestExprType.Integer
                        Assert.ThrowsAny <VtlOperatorError>(() => { compCreateExpr.OperatorDefinition.GetOutputStructure(compCreateExpr); });
                    }
                }
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Gets the variable name of a basic data type.
        /// </summary>
        /// <param name="instance">The basic data type to get variable name from.</param>
        /// <returns>The variable name of the basic data type.</returns>
        public static string GetVariableName(this TestExprType instance)
        {
            switch (instance)
            {
            case TestExprType.Integer: return("int_var");

            case TestExprType.Number: return("num_var");

            case TestExprType.String: return("string_var");

            case TestExprType.Boolean: return("bool_var");

            case TestExprType.Time: return("time_var");

            case TestExprType.Date: return("date_var");

            case TestExprType.TimePeriod: return("period_var");

            default: throw new Exception("Unknown basic data type.");
            }
        }
Exemplo n.º 16
0
 /// <summary>
 /// Gets the expression by testing data type.
 /// </summary>
 /// <param name="type">The testing data type.</param>
 /// <returns>The expression.</returns>
 public static IExpression GetExpression(TestExprType type)
 {
     return(TestExprFactory.GetExpression(true, type));
 }
        public void GetOutputStructure_CorrectExprNonJoin_CorrectStructure(string compName, TestExprType compType)
        {
            string       name   = string.Empty;
            TestExprType?dsType = null;

            switch (compType)
            {
            case TestExprType.Integer:
                name   = "int_var";
                dsType = TestExprType.IntsDataset;
                break;

            case TestExprType.Number:
                name   = "num_var";
                dsType = TestExprType.NumbersDataset;
                break;

            case TestExprType.String:
                name   = "string_var";
                dsType = TestExprType.StringsDataset;
                break;

            case TestExprType.Boolean:
                name   = "bool_var";
                dsType = TestExprType.BoolsDataset;
                break;

            case TestExprType.Time:
                name   = "time_var";
                dsType = TestExprType.TimesDataset;
                break;

            case TestExprType.Date:
                name   = "date_var";
                dsType = TestExprType.DatesDataset;
                break;

            case TestExprType.TimePeriod:
                name   = "period_var";
                dsType = TestExprType.TimePeriodsDataset;
                break;

            case TestExprType.Duration:
                name   = "duration_var";
                dsType = TestExprType.DurationsDataset;
                break;

            case TestExprType.None:
                name   = "null";
                dsType = TestExprType.NonesDataset;
                break;

            default: throw new Exception();
            }

            IExpression membershipExpr = TestExprFactory.GetExpression((TestExprType)dsType, compType);

            membershipExpr.Operands["ds_2"].ExpressionText = compName;
            membershipExpr.Operands["ds_2"].Structure.Components[0].ComponentName = compName;

            IDataStructure expectedStructure = TestExprFactory.GetExpression((TestExprType)dsType).Structure;

            expectedStructure.Measures.Clear();
            if (compName == "Me1")
            {
                expectedStructure.Measures.Add(new StructureComponent((BasicDataType)compType, compName));
            }
            else
            {
                if (compName != "Id1")
                {
                    expectedStructure.Measures.Add(new StructureComponent((BasicDataType)compType, name));
                }
                else
                {
                    membershipExpr.Operands["ds_2"].Structure = ModelResolvers.DsResolver(compName, ComponentType.Identifier, (BasicDataType)compType);
                    expectedStructure.Measures.Add(new StructureComponent((BasicDataType)compType, compType.GetVariableName()));
                }
            }

            if (compName == "NV_At1")
            {
                membershipExpr.Operands["ds_1"].Structure.NonViralAttributes.Add(new StructureComponent((BasicDataType)compType, compName));
                membershipExpr.Operands["ds_2"].Structure = ModelResolvers.DsResolver(compName, ComponentType.NonViralAttribute, (BasicDataType)compType);
                expectedStructure.NonViralAttributes.Add(new StructureComponent((BasicDataType)compType, compName));
            }
            else if (compName == "V_At1")
            {
                membershipExpr.Operands["ds_1"].Structure.ViralAttributes.Add(new StructureComponent((BasicDataType)compType, compName));
                membershipExpr.Operands["ds_2"].Structure = ModelResolvers.DsResolver(compName, ComponentType.ViralAttribute, (BasicDataType)compType);
                expectedStructure.ViralAttributes.Add(new StructureComponent((BasicDataType)compType, compName));
            }

            membershipExpr.OperatorDefinition = ModelResolvers.OperatorResolver("#");

            IDataStructure dataStructure = membershipExpr.OperatorDefinition.GetOutputStructure(membershipExpr);

            Assert.True(expectedStructure.EqualsObj(dataStructure));
            Assert.Equal(expectedStructure.Measures[0].ComponentName, dataStructure.Measures[0].ComponentName);
        }
Exemplo n.º 18
0
        public void GetOutputStructure_WrongComponentTwoDatasetsJoinExpr_DurationScalarStructure(bool isMemership, TestExprType type)
        {
            foreach (string name in DatasetClauseOperator.ClauseNames.Where(name => !name.In("Pivot", "Unpivot", "Subspace")))
            {
                IExpression joinExpr            = ModelResolvers.JoinExprResolver(TestExprFactory.GetExpression("join", ExpressionFactoryNameTarget.OperatorSymbol));
                IExpression ds1Expr             = TestExprFactory.GetExpression("get", ExpressionFactoryNameTarget.OperatorSymbol);
                IExpression ds2Expr             = TestExprFactory.GetExpression("get", ExpressionFactoryNameTarget.OperatorSymbol);
                IExpression clauseExpr          = TestExprFactory.GetExpression(name, ExpressionFactoryNameTarget.ResultName);
                IExpression periodIndicatorExpr = TestExprFactory.GetExpression("period_indicator", ExpressionFactoryNameTarget.OperatorSymbol);
                IExpression paramExpr           = TestExprFactory.GetExpression(type);
                if (isMemership)
                {
                    paramExpr.OperatorDefinition = ModelResolvers.OperatorResolver("#");
                }

                joinExpr.AddOperand("ds", ModelResolvers.ExprResolver());
                joinExpr.Operands["ds"].AddOperand("ds_1", ds1Expr);
                joinExpr.Operands["ds"].AddOperand("ds_2", ds2Expr);
                joinExpr.AddOperand(name, clauseExpr);
                clauseExpr.AddOperand("ds_1", periodIndicatorExpr);
                periodIndicatorExpr.AddOperand("ds_1", paramExpr);

                ds1Expr.Structure = ModelResolvers.DsResolver();
                ds1Expr.Structure.Identifiers.Add(new StructureComponent(BasicDataType.Integer, "Id1"));
                ds1Expr.Structure.Identifiers.Add(new StructureComponent((BasicDataType)type, "Id2"));
                ds1Expr.Structure.Measures.Add(new StructureComponent(BasicDataType.String, "Me1"));
                ds2Expr.Structure = ds1Expr.Structure.GetCopy();

                Assert.ThrowsAny <VtlOperatorError>(() => { periodIndicatorExpr.OperatorDefinition.GetOutputStructure(periodIndicatorExpr); });
            }
        }
        public void GetOutputStructure_WrongArgsExpr_ThrowsException()
        {
            TestExprType[][] correctCombs = new TestExprType[][] {
                new TestExprType[] { TestExprType.Integer, TestExprType.Integer },
                new TestExprType[] { TestExprType.Integer, TestExprType.Number },
                new TestExprType[] { TestExprType.Integer, TestExprType.None },
                new TestExprType[] { TestExprType.Number, TestExprType.Integer },
                new TestExprType[] { TestExprType.Number, TestExprType.Number },
                new TestExprType[] { TestExprType.Number, TestExprType.None },
                new TestExprType[] { TestExprType.String, TestExprType.String },
                new TestExprType[] { TestExprType.String, TestExprType.None },
                new TestExprType[] { TestExprType.Boolean, TestExprType.Boolean },
                new TestExprType[] { TestExprType.Boolean, TestExprType.None },
                new TestExprType[] { TestExprType.Time, TestExprType.Time },
                new TestExprType[] { TestExprType.Time, TestExprType.None },
                new TestExprType[] { TestExprType.Date, TestExprType.Date },
                new TestExprType[] { TestExprType.Date, TestExprType.None },
                new TestExprType[] { TestExprType.TimePeriod, TestExprType.TimePeriod },
                new TestExprType[] { TestExprType.TimePeriod, TestExprType.None },
                new TestExprType[] { TestExprType.Duration, TestExprType.Duration },
                new TestExprType[] { TestExprType.Duration, TestExprType.None },
                new TestExprType[] { TestExprType.None, TestExprType.None },
                new TestExprType[] { TestExprType.None, TestExprType.Integer },
                new TestExprType[] { TestExprType.None, TestExprType.Number },
                new TestExprType[] { TestExprType.None, TestExprType.String },
                new TestExprType[] { TestExprType.None, TestExprType.Boolean },
                new TestExprType[] { TestExprType.None, TestExprType.Time },
                new TestExprType[] { TestExprType.None, TestExprType.Date },
                new TestExprType[] { TestExprType.None, TestExprType.TimePeriod },
                new TestExprType[] { TestExprType.None, TestExprType.Duration },
                new TestExprType[] { TestExprType.Integer, TestExprType.IntsDataset },
                new TestExprType[] { TestExprType.Integer, TestExprType.NumbersDataset },
                new TestExprType[] { TestExprType.Integer, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.Number, TestExprType.IntsDataset },
                new TestExprType[] { TestExprType.Number, TestExprType.NumbersDataset },
                new TestExprType[] { TestExprType.Number, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.String, TestExprType.StringsDataset },
                new TestExprType[] { TestExprType.String, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.Boolean, TestExprType.BoolsDataset },
                new TestExprType[] { TestExprType.Boolean, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.Time, TestExprType.TimesDataset },
                new TestExprType[] { TestExprType.Time, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.Date, TestExprType.DatesDataset },
                new TestExprType[] { TestExprType.Date, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.TimePeriod, TestExprType.TimePeriodsDataset },
                new TestExprType[] { TestExprType.TimePeriod, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.Duration, TestExprType.DurationsDataset },
                new TestExprType[] { TestExprType.Duration, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.None, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.None, TestExprType.IntsDataset },
                new TestExprType[] { TestExprType.None, TestExprType.NumbersDataset },
                new TestExprType[] { TestExprType.None, TestExprType.StringsDataset },
                new TestExprType[] { TestExprType.None, TestExprType.BoolsDataset },
                new TestExprType[] { TestExprType.None, TestExprType.TimesDataset },
                new TestExprType[] { TestExprType.None, TestExprType.DatesDataset },
                new TestExprType[] { TestExprType.None, TestExprType.TimePeriodsDataset },
                new TestExprType[] { TestExprType.None, TestExprType.DurationsDataset },
                new TestExprType[] { TestExprType.IntsDataset, TestExprType.IntsDataset },
                new TestExprType[] { TestExprType.IntsDataset, TestExprType.NumbersDataset },
                new TestExprType[] { TestExprType.IntsDataset, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.NumbersDataset, TestExprType.IntsDataset },
                new TestExprType[] { TestExprType.NumbersDataset, TestExprType.NumbersDataset },
                new TestExprType[] { TestExprType.NumbersDataset, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.StringsDataset, TestExprType.StringsDataset },
                new TestExprType[] { TestExprType.StringsDataset, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.BoolsDataset, TestExprType.BoolsDataset },
                new TestExprType[] { TestExprType.BoolsDataset, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.TimesDataset, TestExprType.TimesDataset },
                new TestExprType[] { TestExprType.TimesDataset, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.DatesDataset, TestExprType.DatesDataset },
                new TestExprType[] { TestExprType.DatesDataset, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.TimePeriodsDataset, TestExprType.TimePeriodsDataset },
                new TestExprType[] { TestExprType.TimePeriodsDataset, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.DurationsDataset, TestExprType.DurationsDataset },
                new TestExprType[] { TestExprType.DurationsDataset, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.NonesDataset },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.IntsDataset },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.NumbersDataset },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.StringsDataset },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.BoolsDataset },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.TimesDataset },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.DatesDataset },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.TimePeriodsDataset },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.DurationsDataset },
                new TestExprType[] { TestExprType.IntsDataset, TestExprType.Integer },
                new TestExprType[] { TestExprType.IntsDataset, TestExprType.Number },
                new TestExprType[] { TestExprType.IntsDataset, TestExprType.None },
                new TestExprType[] { TestExprType.NumbersDataset, TestExprType.Integer },
                new TestExprType[] { TestExprType.NumbersDataset, TestExprType.Number },
                new TestExprType[] { TestExprType.NumbersDataset, TestExprType.None },
                new TestExprType[] { TestExprType.StringsDataset, TestExprType.String },
                new TestExprType[] { TestExprType.StringsDataset, TestExprType.None },
                new TestExprType[] { TestExprType.BoolsDataset, TestExprType.Boolean },
                new TestExprType[] { TestExprType.BoolsDataset, TestExprType.None },
                new TestExprType[] { TestExprType.TimesDataset, TestExprType.Time },
                new TestExprType[] { TestExprType.TimesDataset, TestExprType.None },
                new TestExprType[] { TestExprType.DatesDataset, TestExprType.Date },
                new TestExprType[] { TestExprType.DatesDataset, TestExprType.None },
                new TestExprType[] { TestExprType.TimePeriodsDataset, TestExprType.TimePeriod },
                new TestExprType[] { TestExprType.TimePeriodsDataset, TestExprType.None },
                new TestExprType[] { TestExprType.DurationsDataset, TestExprType.Duration },
                new TestExprType[] { TestExprType.DurationsDataset, TestExprType.None },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.None },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.Integer },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.Number },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.String },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.Boolean },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.Time },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.Date },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.TimePeriod },
                new TestExprType[] { TestExprType.NonesDataset, TestExprType.Duration }
            };

            TestExprType[][] combinations = Enum.GetValues(typeof(TestExprType)).Cast <TestExprType>().GetCombinations(2);
            TestExprType[][] wrongCombs   = combinations.Without(correctCombs);

            foreach (string opSymbol in this._operators)
            {
                foreach (TestExprType[] wrongComb in wrongCombs.Where(wrongComb => (int)wrongComb[0] < 18 && (int)wrongComb[1] < 18)) // No mixed datasets
                {
                    IExpression equalityExpr = TestExprFactory.GetExpression(wrongComb);
                    equalityExpr.OperatorDefinition = ModelResolvers.OperatorResolver(opSymbol);

                    if (equalityExpr.Operands["ds_1"].Structure.Measures.Count > 1)
                    {
                        equalityExpr.Operands["ds_1"].Structure.Measures.RemoveAt(1);
                    }

                    if (equalityExpr.Operands["ds_2"].Structure.Measures.Count > 1)
                    {
                        equalityExpr.Operands["ds_2"].Structure.Measures.RemoveAt(1);
                    }

                    // Debug condition example: wrongComb[0] == TestExprType.Integer && wrongComb[1] == TestExprType.Integer
                    Assert.ThrowsAny <VtlOperatorError>(() => { equalityExpr.OperatorDefinition.GetOutputStructure(equalityExpr); });
                }
            }
        }