コード例 #1
0
        public void Operation4()
        {
            TFrac         leftFrac  = new TFrac(56, 7);
            TFrac         rightFrac = new TFrac(-22, 3);
            TProc <TFrac> proc      = new TProc <TFrac>(leftFrac, rightFrac);

            proc.Operation = TProc <TFrac> .Oper.Div;
            proc.DoOper();
            string answer = "-12/11";

            Assert.AreEqual(answer, proc.Lop_Res.ToString());
        }
コード例 #2
0
        public void Operation2()
        {
            TFrac         leftFrac  = new TFrac(3, 4);
            TFrac         rightFrac = new TFrac(5, 6);
            TProc <TFrac> proc      = new TProc <TFrac>(leftFrac, rightFrac);

            proc.Operation = TProc <TFrac> .Oper.Sub;
            proc.DoOper();
            string answer = "-1/12";

            Assert.AreEqual(answer, proc.Lop_Res.ToString());
        }
コード例 #3
0
        public void Operation3()
        {
            TFrac         leftFrac  = new TFrac(12, 7);
            TFrac         rightFrac = new TFrac(5, 9);
            TProc <TFrac> proc      = new TProc <TFrac>(leftFrac, rightFrac);

            proc.Operation = TProc <TFrac> .Oper.Mul;
            proc.DoOper();
            string answer = "20/21";

            Assert.AreEqual(answer, proc.Lop_Res.ToString());
        }
コード例 #4
0
        public void Operation1()
        {
            TFrac         leftFrac  = new TFrac(1, 2);
            TFrac         rightFrac = new TFrac(1, 2);
            TProc <TFrac> proc      = new TProc <TFrac>(leftFrac, rightFrac);

            proc.Operation = TProc <TFrac> .Oper.Add;
            proc.DoOper();
            string answer = "1/1";

            Assert.AreEqual(answer, proc.Lop_Res.ToString());
        }