Represent complex number token.
상속: IToken
예제 #1
0
        public void EqualsNullTest()
        {
            var token = new ComplexNumberToken(new Complex(5.3, 2.1));

            Assert.False(token.Equals(null));
            Assert.NotEqual(null, token);
        }
예제 #2
0
        public void EqualsSameObjectTest()
        {
            var token = new ComplexNumberToken(new Complex(5.3, 2.1));

            Assert.True(token.Equals(token));
            Assert.Equal(token, token);
        }
예제 #3
0
        public void EqualsDiffTypeTest()
        {
            var token = new ComplexNumberToken(new Complex(5.3, 2.1));

            Assert.False(token.Equals(1));
            Assert.NotEqual((object)1, token);
        }
예제 #4
0
        public void EqualsDiffComplexTest()
        {
            var token1 = new ComplexNumberToken(new Complex(5.3, 2.1));
            var token2 = new ComplexNumberToken(new Complex(5.9, 43.1));

            Assert.False(token1.Equals(token2));
            Assert.NotEqual(token1, token2);
        }
예제 #5
0
        public void NegativeReToStringTest()
        {
            var token = new ComplexNumberToken(new Complex(-5.3, -2.12));

            Assert.Equal("Complex Number: -5.3-2.12i", token.ToString());
        }
예제 #6
0
        public void ImOneToStringTest()
        {
            var token = new ComplexNumberToken(new Complex(0, 1));

            Assert.Equal("Complex Number: i", token.ToString());
        }
예제 #7
0
        public void ZeroReToStringTest()
        {
            var token = new ComplexNumberToken(new Complex(0, 1.3));

            Assert.Equal("Complex Number: 1.3i", token.ToString());
        }
예제 #8
0
        public void ZeroImToStringTest()
        {
            var token = new ComplexNumberToken(new Complex(5.3, 0));

            Assert.Equal("Complex Number: 5.3", token.ToString());
        }
예제 #9
0
        public void PositiveReToStringTest()
        {
            var token = new ComplexNumberToken(new Complex(5.3, 2.12));

            Assert.Equal("Complex Number: 5.3+2.12i", token.ToString());
        }