private void Test(string Script, object[][] ExpectedOutput)
        {
            Variables  v   = new Variables();
            Expression Exp = new Expression(Script);
            object     Obj = Exp.Evaluate(v);

            Console.Out.WriteLine(Expression.ToString(Obj));

            ObjectMatrix M = Obj as ObjectMatrix;
            int          NrRows, RowIndex;
            int          NrColumns, ColumnIndex;

            Assert.IsNotNull(M, "Object matrix expected.");
            Assert.AreEqual(NrRows = ExpectedOutput.Length, M.Rows, "Number of rows in response incorrect.");

            for (RowIndex = 0; RowIndex < NrRows; RowIndex++)
            {
                object[]     ExpectedRow = ExpectedOutput[RowIndex];
                ObjectVector Row         = M.GetRow(RowIndex) as ObjectVector;

                Assert.IsNotNull(Row, "Object row vector expected.");
                Assert.AreEqual(NrColumns = ExpectedRow.Length, Row.Dimension, "Number of columns in response incorrect.");

                for (ColumnIndex = 0; ColumnIndex < NrColumns; ColumnIndex++)
                {
                    Assert.AreEqual(ExpectedRow[ColumnIndex], Row.GetElement(ColumnIndex).AssociatedObjectValue);
                }
            }
        }
Beispiel #2
0
        public static SKColor[] ToPalette(ObjectVector Vector)
        {
            int i, c = Vector.Dimension;

            SKColor[] Palette = new SKColor[c];

            for (i = 0; i < c; i++)
            {
                Palette[i] = Graph.ToColor(Vector.GetElement(i).AssociatedObjectValue);
            }

            return(Palette);
        }