public void CanFormatComplexToString(float real, float imag, string expected)
 {
     var numberFormat = NumberFormatInfo.CurrentInfo;
     var a = new Complex32(real, imag);
     Assert.AreEqual(
         String.Format(
             expected,
             numberFormat.NumberDecimalSeparator,
             numberFormat.NaNSymbol,
             numberFormat.PositiveInfinitySymbol),
         a.ToString());
 }
        public void CanFormatComplexToString(float real, float imag, string expected)
        {
            var numberFormat = NumberFormatInfo.CurrentInfo;
            var a            = new Complex32(real, imag);

            Assert.AreEqual(
                String.Format(
                    expected,
                    numberFormat.NumberDecimalSeparator,
                    numberFormat.NaNSymbol,
                    numberFormat.PositiveInfinitySymbol),
                a.ToString());
        }
 public void CanFormatComplexToString(
     [Values(1, 1, 1, 0, 0, 0, Single.NaN, Single.NaN, 0, Single.PositiveInfinity, 1.1f, -1.1f, 0, 0, 1.1f)] float real, 
     [Values(-2, 2, 0, -2, 2, 0, Single.NaN, 0, Single.NaN, Single.PositiveInfinity, 0, 0, 1.1f, -1.1f, 1.1f)] float imag, 
     [Values("(1, -2)", "(1, 2)", "(1, 0)", "(0, -2)", "(0, 2)", "(0, 0)", "({1}, {1})", "({1}, 0)", "(0, {1})", "({2}, {2})", "(1{0}1, 0)", "(-1{0}1, 0)", "(0, 1{0}1)", "(0, -1{0}1)", "(1{0}1, 1{0}1)")] string expected)
 {
     var numberFormat = NumberFormatInfo.CurrentInfo;
     var a = new Complex32(real, imag);
     Assert.AreEqual(
         String.Format(
             expected, 
             numberFormat.NumberDecimalSeparator, 
             numberFormat.NaNSymbol, 
             numberFormat.PositiveInfinitySymbol), 
         a.ToString());
 }
Example #4
0
        public void CanFormatComplexToString(
            [Values(1, 1, 1, 0, 0, 0, Single.NaN, Single.NaN, 0, Single.PositiveInfinity, 1.1f, -1.1f, 0, 0, 1.1f)] float real,
            [Values(-2, 2, 0, -2, 2, 0, Single.NaN, 0, Single.NaN, Single.PositiveInfinity, 0, 0, 1.1f, -1.1f, 1.1f)] float imag,
            [Values("(1, -2)", "(1, 2)", "(1, 0)", "(0, -2)", "(0, 2)", "(0, 0)", "({1}, {1})", "({1}, 0)", "(0, {1})", "({2}, {2})", "(1{0}1, 0)", "(-1{0}1, 0)", "(0, 1{0}1)", "(0, -1{0}1)", "(1{0}1, 1{0}1)")] string expected)
        {
            var numberFormat = NumberFormatInfo.CurrentInfo;
            var a            = new Complex32(real, imag);

            Assert.AreEqual(
                String.Format(
                    expected,
                    numberFormat.NumberDecimalSeparator,
                    numberFormat.NaNSymbol,
                    numberFormat.PositiveInfinitySymbol),
                a.ToString());
        }