示例#1
0
        public void TestGetString()
        {
            var test1  = new TComplex(3, 4);
            var resulr = test1.GetString();

            Assert.AreEqual(resulr, "3 + i * 4");
        }
示例#2
0
        public void GetDegree1()
        {
            TComplex testClass = new TComplex(3, 4);
            double   answer    = 53.1301;

            Assert.AreEqual(answer, testClass.GetDegree(), 4);
        }
示例#3
0
        public void TestDegree()
        {
            var test1  = new TComplex(3, 4);
            var resulr = test1.Degree();

            Assert.AreEqual(53.1301, resulr, 4);
        }
示例#4
0
        public void TestRad()
        {
            var test1  = new TComplex(3, 4);
            var resulr = test1.Rad();

            Assert.AreEqual(0.927295, resulr, 5);
        }
示例#5
0
        public void GetDegree2()
        {
            TComplex testClass = new TComplex(0, -3);
            double   answer    = -90;

            Assert.AreEqual(answer, testClass.GetDegree(), 4);
        }
示例#6
0
        public void GetRad1()
        {
            TComplex testClass = new TComplex(3, 4);
            double   answer    = 0.927295;

            Assert.AreEqual(answer, testClass.GetRad(), 4);
        }
示例#7
0
        public void TestAbs()
        {
            var test1  = new TComplex(3, 4);
            var resulr = test1.Abs();

            Assert.AreEqual(resulr, 5);
        }
示例#8
0
        public void Abs1()
        {
            TComplex testClass = new TComplex(3, 4);
            double   answer    = 5;

            Assert.AreEqual(answer, testClass.Abs(), 4);
        }
示例#9
0
        public void Init6()
        {
            TComplex testClass = new TComplex(0, -22.22);
            string   output    = "0 + i * -22.22";

            Assert.AreEqual(output, testClass.ToString());
        }
示例#10
0
        public void TestTComplexDouble()
        {
            var testClass = new TComplex(55.89, 44.44);

            Assert.AreEqual(testClass.real, 55.89);
            Assert.AreEqual(testClass.imaginary, 44.44);
        }
示例#11
0
        public void Init4()
        {
            TComplex testClass = new TComplex(4.01, 6);
            string   output    = "4.01 + i * 6";

            Assert.AreEqual(output, testClass.ToString());
        }
示例#12
0
        public void Init5()
        {
            TComplex testClass = new TComplex(-3.02, 7);
            string   output    = "-3.02 + i * 7";

            Assert.AreEqual(output, testClass.ToString());
        }
示例#13
0
        public void Init2()
        {
            TComplex testClass = new TComplex(0, 0);
            string   output    = "0 + i * 0";

            Assert.AreEqual(output, testClass.ToString());
        }
示例#14
0
        public void Init3()
        {
            TComplex testClass = new TComplex(3, -2);
            string   output    = "3 + i * -2";

            Assert.AreEqual(output, testClass.ToString());
        }
示例#15
0
        public void GetRad2()
        {
            TComplex testClass = new TComplex(0, -3);
            double   answer    = -1.570796;

            Assert.AreEqual(answer, testClass.GetRad(), 4);
        }
示例#16
0
        public void Init1()
        {
            TComplex testClass = new TComplex(6, 3);
            string   output    = "6 + i * 3";

            Assert.AreEqual(output, testClass.ToString());
        }
示例#17
0
        public void Abs2()
        {
            TComplex testClass = new TComplex(0, -3);
            double   answer    = 3;

            Assert.AreEqual(answer, testClass.Abs(), 4);
        }
示例#18
0
        public void TestGetImaginaryNumber()
        {
            var test1  = new TComplex(3, 4);
            var resulr = test1.GetImaginaryNumber();

            Assert.AreEqual(resulr, 4);
        }
示例#19
0
        public void TestGetRealNumber()
        {
            var test1  = new TComplex(3, 4);
            var resulr = test1.GetRealNumber();

            Assert.AreEqual(resulr, 3);
        }
示例#20
0
        public void TestNeRavnTrue()
        {
            var test1  = new TComplex(3, 4);
            var resulr = test1.NeRavn(test1);

            Assert.IsFalse(resulr);
        }
示例#21
0
        public void TestRoot()
        {
            var test1  = new TComplex(3, 4);
            var resulr = test1.Sqrt(3, 4);

            Assert.AreEqual(resulr.real, 2.567133, 5);
            Assert.AreEqual(resulr.imaginary, 2.142468, 5);
        }
示例#22
0
        public void TestTComplexString()
        {
            string output    = "7,5 + i * 3,1";
            var    testClass = new TComplex(output);

            Assert.AreEqual(testClass.real, 7.5);
            Assert.AreEqual(testClass.imaginary, 3.1);
        }
示例#23
0
        public void TestRavnFalse()
        {
            var test1  = new TComplex(3, 4);
            var test2  = new TComplex(4, -1);
            var resulr = test1.Ravn(test2);

            Assert.IsFalse(resulr);
        }
示例#24
0
        public void TestReverse()
        {
            var test1  = new TComplex(0, -3);
            var resulr = test1.Reverse();

            Assert.AreEqual(resulr.real, 0);
            Assert.AreEqual(resulr.imaginary, 0.333333, 5);
        }
示例#25
0
        public void TestPow()
        {
            var test1  = new TComplex(3, 4);
            var resulr = test1.Pow(5);

            Assert.AreEqual(resulr.real, -237, 4);
            Assert.AreEqual(resulr.imaginary, -3116, 4);
        }
示例#26
0
        public void TestCopy()
        {
            var test1 = new TComplex(55.89, 44.44);
            var test2 = test1.Copy();

            Assert.AreEqual(test1.real, test2.real);
            Assert.AreEqual(test1.imaginary, test2.imaginary);
        }
示例#27
0
        public void TestMinus()
        {
            var test1  = new TComplex(0, 4);
            var resulr = test1.Minus();

            Assert.AreEqual(resulr.real, 0);
            Assert.AreEqual(resulr.imaginary, -4);
        }
示例#28
0
        public void TestSquare()
        {
            var test1  = new TComplex(3, 4);
            var resulr = test1.Square();

            Assert.AreEqual(resulr.real, -7);
            Assert.AreEqual(resulr.imaginary, 24);
        }
示例#29
0
        public void Root2()
        {
            TComplex testClass = new TComplex(16, -2);

            testClass = testClass.Root(10, 4);
            string output = "-0.301 + i * 1.286";

            Assert.AreEqual(output, testClass.ToString());
        }
示例#30
0
        public void Root1()
        {
            TComplex testClass = new TComplex(3, 4);

            testClass = testClass.Root(5, 3);
            string output = "-0.353 + i * 1.334";

            Assert.AreEqual(output, testClass.ToString());
        }