示例#1
0
        public void ParseTest_Fail(string s)
        {
            //action
            Action action = () => CPolynomial.Parse(s);

            //assert
            action.ShouldThrow <FormatException>();
        }
示例#2
0
        public void ParseTest_Success3()
        {
            //arrange
            CPolynomial expected = new CPolynomial(new Complex[] { 0, 2 });

            //action
            CPolynomial actual = CPolynomial.Parse("2x");

            //assert
            actual.Should().Be(expected);
        }
示例#3
0
        public void ParseTest_Success5()
        {
            //arrange
            CPolynomial expected = new CPolynomial(new Complex[] { 3, new Complex(-4, 12.3), 1 });

            //action
            CPolynomial actual = CPolynomial.Parse("x+3 + x^2-(5-12.3i)*x");

            //assert
            actual.Should().Be(expected);
        }
示例#4
0
        public void ParseTest_Success2()
        {
            //arrange
            CPolynomial expected = new CPolynomial(new Complex[] { new Complex(0, -0.3) });

            //action
            CPolynomial actual = CPolynomial.Parse("-0.3i");

            //assert
            actual.Should().Be(expected);
        }