Accord.Tests.Math.MatrixFormatTest.ToStringTest2 C# (CSharp) Method

ToStringTest2() private method

private ToStringTest2 ( ) : void
return void
        public void ToStringTest2()
        {
            double[][] matrix = 
            {
                new double[] { 1, 2 },
                new double[] { 3, 4 },
            };

            string expected, actual;

            expected = "[1 2; 3 4]";
            actual = Matrix.ToString(matrix, OctaveMatrixFormatProvider.InvariantCulture);
            Assert.AreEqual(expected, actual);


            expected = "1 2 " + Environment.NewLine + "3 4";
            actual = Matrix.ToString(matrix, DefaultMatrixFormatProvider.InvariantCulture);
            Assert.AreEqual(expected, actual);


            expected = "new double[][] {" + Environment.NewLine +
                       "    new double[] { 1, 2 }," + Environment.NewLine +
                       "    new double[] { 3, 4 } " + Environment.NewLine +
                       "};";
            actual = Matrix.ToString(matrix, CSharpJaggedMatrixFormatProvider.InvariantCulture);
            Assert.AreEqual(expected, actual);


            expected = "new double[,] {" + Environment.NewLine +
                       "    { 1, 2 }," + Environment.NewLine +
                       "    { 3, 4 } " + Environment.NewLine +
                       "};";
            actual = Matrix.ToString(matrix, CSharpMatrixFormatProvider.InvariantCulture);
            Assert.AreEqual(expected, actual);
        }