示例#1
0
        public void ToString_CultureDE()
        {
            string    s = "(1,5; 0; 0; 0)\n(0; 1,5; 0; 0)\n(0; 0; 1,5; 0)\n(0; 0; 0; 1)";
            double4x4 f = double4x4.Scale(1.5f);

            Assert.Equal(s, f.ToString(new CultureInfo("de-DE")));
        }
示例#2
0
        public void ToString_InvariantCulture()
        {
            string    s = "(1.5, 0, 0, 0)\n(0, 1.5, 0, 0)\n(0, 0, 1.5, 0)\n(0, 0, 0, 1)";
            double4x4 f = double4x4.Scale(1.5f);

            Assert.Equal(s, f.ToString(CultureInfo.InvariantCulture));
        }
示例#3
0
        public void ToString_IsString()
        {
            var mat = new double4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);

            var actual = mat.ToString();

            Assert.Equal("(1, 0, 0, 0)\n(0, 1, 0, 0)\n(0, 0, 1, 0)\n(0, 0, 0, 1)", actual);
        }
示例#4
0
        public void ConvertFromDouble4x4(int i, float f, double d, bool isTrue, string text, double2 d2, double3 d3, double4 d4, double4x4 d4x4, float2 f2, float3 f3, float4 f4, float4x4 f4x4)
        {
            text = d4x4.ToString();
            d4   = d4x4.Row0;
            f4   = f4x4.Row0;

            ConverterClass source   = new ConverterClass();
            ConverterClass expected = new ConverterClass();
            Node           root     = new Node(source);
            Node           node     = new Node(expected);
            Circuit        circuit  = new Circuit();

            circuit.AddNode(root);
            circuit.AddNode(node);
            circuit.AddRoot(root);

            source.d4x4 = d4x4;

            root.Attach("d4x4", node, "i");
            root.Attach("d4x4", node, "f");
            root.Attach("d4x4", node, "d");
            root.Attach("d4x4", node, "isTrue");
            root.Attach("d4x4", node, "text");
            root.Attach("d4x4", node, "d2");
            root.Attach("d4x4", node, "d3");
            root.Attach("d4x4", node, "d4");
            root.Attach("d4x4", node, "d4x4");
            root.Attach("d4x4", node, "f2");
            root.Attach("d4x4", node, "f3");
            root.Attach("d4x4", node, "f4");
            root.Attach("d4x4", node, "f4x4");

            circuit.Execute();

            Assert.True(expected.i == i, "Error when parsing to int: Should be " + i + " but is " + expected.i + ".");
            Assert.True(expected.f == f, "Error when parsing to float: Should be " + f + " but is " + expected.f + ".");
            Assert.True(expected.d == d, "Error when parsing to double: Should be " + d + " but is " + expected.d + ".");
            Assert.True(expected.isTrue == isTrue, "Error when parsing to bool: Should be " + isTrue + " but is " + expected.isTrue + ".");
            Assert.True(expected.text == text, "Error when parsing to string: Should be " + text + " but is " + expected.text + ".");
            Assert.True(expected.d2 == d2, "Error when parsing to double2: Should be " + d2 + " but is " + expected.d2 + ".");
            Assert.True(expected.d3 == d3, "Error when parsing to double3: Should be " + d3 + " but is " + expected.d3 + ".");
            Assert.True(expected.d4 == d4, "Error when parsing to double4: Should be " + d4 + " but is " + expected.d4 + ".");
            Assert.True(expected.d4x4 == d4x4, "Error when parsing to double4x4: Should be " + d4x4 + " but is " + expected.d4x4 + ".");
            Assert.True(expected.f2 == f2, "Error when parsing to float2: Should be " + f2 + " but is " + expected.f2 + ".");
            Assert.True(expected.f3 == f3, "Error when parsing to float3: Should be " + f3 + " but is " + expected.f3 + ".");
            Assert.True(expected.f4 == f4, "Error when parsing to float4: Should be " + f4 + " but is " + expected.f4 + ".");
            Assert.True(expected.f4x4 == f4x4, "Error when parsing to float4x4: Should be " + f4x4 + " but is " + expected.f4x4 + ".");
        }
示例#5
0
        public void Parse_ToString_CultureDE()
        {
            double4x4 f = double4x4.Scale(1.5f);

            Assert.Equal(f, double4x4.Parse(f.ToString(new CultureInfo("de-DE")), new CultureInfo("de-DE")));
        }
示例#6
0
        public void Parse_ToString_InvariantCulture()
        {
            double4x4 f = double4x4.Scale(1.5f);

            Assert.Equal(f, double4x4.Parse(f.ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture));
        }
示例#7
0
        public void Parse_ToString_NoCulture()
        {
            double4x4 f = double4x4.Scale(1.5f);

            Assert.Equal(f, double4x4.Parse(f.ToString()));
        }
示例#8
0
        public void MatrixToString()
        {
            double4x4 m = new double4x4(
                1, 2, 3, 4,
                5, 6, 7, 8,
                9, 1, 3, 5,
                7, 2, 4, 6);

            Assert.AreEqual(
                "|     1      2      3      4|\n|     5      6      7      8|\n|     9      1      3      5|\n|     7      2      4      6|", m.ToString());
        }