Example #1
0
        public void ParseTest()
        {
            Rational r;

            r = Rational.Parse("-12/30");
            Assert.IsTrue(r.CompareTo(new Rational(-12, 30)) == 0);
            r = Rational.Parse("123");
            Assert.IsTrue(r.CompareTo(new Rational(123)) == 0);
            r = Rational.Parse("1.125");
            Assert.IsTrue(r.CompareTo(new Rational(9, 8)) == 0);
        }
Example #2
0
 static void ShowParse(string s)
 {
     Console.WriteLine("Parse \"{0}\" to Rational: {1}",
                       s, Rational.Parse(s));
 }