Beispiel #1
0
        public void Comparison_Test()
        {
            var     natural1 = new Natural(50);
            var     natural2 = new Natural(25);
            int     larger = 50, smaller = 25;
            int     expected = -1;
            Natural actual;

            actual = natural1.Max(natural2);
            Assert.AreEqual(larger, actual.GetIntValue());
            Console.WriteLine(actual.GetIntValue() + " is larger than 25");

            //natural2 = new Natural(75);
            actual = natural1.Min(natural2);
            Assert.AreEqual(smaller, actual.GetIntValue());
            Console.WriteLine(actual.GetIntValue() + " is smaller than 50");

            int output = actual.CompareTo(natural1);

            Assert.AreEqual(expected, output);
            Console.WriteLine("The comparison of natural1 and natural2 produces: " + output);
        }