Example #1
0
        public void InitNumber4()
        {
            TFrac  fracClass  = new TFrac(-100, -99);
            string fracCompar = "100/99";

            Assert.AreEqual(fracCompar, fracClass.ToString());
        }
Example #2
0
        public void InitNumber5()
        {
            TFrac  fracClass  = new TFrac(0, 0);
            string fracCompar = "0/1";

            Assert.AreEqual(fracCompar, fracClass.ToString());
        }
Example #3
0
        public void InitCopy2()
        {
            TFrac fracClass = new TFrac(1, 4);
            TFrac copyClass = new TFrac(fracClass);

            Assert.AreEqual(fracClass.ToString(), copyClass.ToString());
        }
Example #4
0
        public void InitNumber2()
        {
            TFrac  fracClass  = new TFrac(17, 9);
            string fracCompar = "17/9";

            Assert.AreEqual(fracCompar, fracClass.ToString());
        }
Example #5
0
        public void InitString3()
        {
            string fracString = "1/999";
            TFrac  fracClass  = new TFrac(fracString);

            Assert.AreEqual(fracString, fracClass.ToString());
        }
Example #6
0
        public void InitNumber3()
        {
            TFrac  fracClass  = new TFrac(100, 100);
            string fracCompar = "1/1";

            Assert.AreEqual(fracCompar, fracClass.ToString());
        }
Example #7
0
        public void InitNumber1()
        {
            TFrac  fracClass  = new TFrac(2, 4);
            string fracCompar = "1/2";

            Assert.AreEqual(fracCompar, fracClass.ToString());
        }
Example #8
0
        public void InitString6()
        {
            string fracString = "00000003/000004";
            TFrac  fracClass  = new TFrac(fracString);
            string fracCompar = "3/4";

            Assert.AreEqual(fracCompar, fracClass.ToString());
        }
Example #9
0
        public void InitString5()
        {
            string fracString = "-100/60";
            TFrac  fracClass  = new TFrac(fracString);
            string fracCompar = "-5/3";

            Assert.AreEqual(fracCompar, fracClass.ToString());
        }
Example #10
0
        public void InitString4()
        {
            string fracString = "100/10";
            TFrac  fracClass  = new TFrac(fracString);
            string fracCompar = "10/1";

            Assert.AreEqual(fracCompar, fracClass.ToString());
        }
Example #11
0
        public void Square3()
        {
            TFrac fracClass = new TFrac(-2, 3);

            fracClass = fracClass.Square() as TFrac;
            string answer = "4/9";

            Assert.AreEqual(answer, fracClass.ToString());
        }
Example #12
0
        public void Square2()
        {
            TFrac fracClass = new TFrac(0, 1);

            fracClass = fracClass.Square() as TFrac;
            string answer = "0/1";

            Assert.AreEqual(answer, fracClass.ToString());
        }
Example #13
0
        public void Reverse3()
        {
            TFrac fracClass = new TFrac(5, 6);

            fracClass = fracClass.Reverse() as TFrac;
            string answer = "6/5";

            Assert.AreEqual(answer, fracClass.ToString());
        }
Example #14
0
        public void Reverse1()
        {
            TFrac fracClass = new TFrac(-2, 3);

            fracClass = fracClass.Reverse() as TFrac;
            string answer = "-3/2";

            Assert.AreEqual(answer, fracClass.ToString());
        }
Example #15
0
        public void Multiply3()
        {
            TFrac fracClass1 = new TFrac(1, 6);
            TFrac fracClass2 = new TFrac(1, 6);

            fracClass2 = fracClass1 * fracClass2;
            string answer = "1/36";

            Assert.AreEqual(answer, fracClass2.ToString());
        }
Example #16
0
        public void Divide5()
        {
            TFrac fracClass1 = new TFrac(2, 3);
            TFrac fracClass2 = new TFrac(2, 3);

            fracClass2 = fracClass1 / fracClass2;
            string answer = "1/1";

            Assert.AreEqual(answer, fracClass2.ToString());
        }
Example #17
0
        public void Divide3()
        {
            TFrac fracClass1 = new TFrac(0, 1);
            TFrac fracClass2 = new TFrac(5, 6);

            fracClass2 = fracClass1 / fracClass2;
            string answer = "0/1";

            Assert.AreEqual(answer, fracClass2.ToString());
        }
Example #18
0
        public void Substract4()
        {
            TFrac fracClass1 = new TFrac(-1, 6);
            TFrac fracClass2 = new TFrac(-1, 6);

            fracClass2 = fracClass1 - fracClass2;
            string answer = "0/1";

            Assert.AreEqual(answer, fracClass2.ToString());
        }
Example #19
0
        public void Substract2()
        {
            TFrac fracClass1 = new TFrac(5, 1);
            TFrac fracClass2 = new TFrac(1, 1);

            fracClass2 = fracClass1 - fracClass2;
            string answer = "4/1";

            Assert.AreEqual(answer, fracClass2.ToString());
        }
Example #20
0
        public void Multiply4()
        {
            TFrac fracClass1 = new TFrac(-1, 6);
            TFrac fracClass2 = new TFrac(12, 1);

            fracClass2 = fracClass1 * fracClass2;
            string answer = "-2/1";

            Assert.AreEqual(answer, fracClass2.ToString());
        }
Example #21
0
        public void Add3()
        {
            TFrac fracClass1 = new TFrac(-6, 2);
            TFrac fracClass2 = new TFrac(6, 2);

            fracClass2 = fracClass1 + fracClass2;
            string answer = "0/1";

            Assert.AreEqual(answer, fracClass2.ToString());
        }
Example #22
0
        public void Add4()
        {
            TFrac fracClass1 = new TFrac(50, 3);
            TFrac fracClass2 = new TFrac(0, 1);

            fracClass2 = fracClass1 + fracClass2;
            string answer = "50/3";

            Assert.AreEqual(answer, fracClass2.ToString());
        }
Example #23
0
        public void Divide6()
        {
            TFrac fracClass1 = new TFrac(-1, 3);
            TFrac fracClass2 = new TFrac(-9, 5);

            fracClass2 = fracClass1 / fracClass2;
            string answer = "5/27";

            Assert.AreEqual(answer, fracClass2.ToString());
        }
Example #24
0
        public void Add1()
        {
            TFrac fracClass1 = new TFrac(1, 2);
            TFrac fracClass2 = new TFrac(-3, 4);

            fracClass2 = fracClass1 + fracClass2;
            string answer = "-1/4";

            Assert.AreEqual(answer, fracClass2.ToString());
        }