Exemple #1
0
        public void TestValidFloatRegex(String floatString)
        {
            Console.WriteLine("ValidTestString '{0}'", floatString);

            //Match m = Sos.FloatNumberRegexBase10.Match(floatString);
            Int32  numberLength = Sos.FloatLength(floatString, 0, floatString.Length);
            String matchString  = floatString.Substring(0, numberLength);

            Console.WriteLine("Matched '{0}'", matchString);
            Assert.AreEqual(floatString.Length, matchString.Length);
        }
Exemple #2
0
        public void TestInvalidFloatRegex(String floatString)
        {
            Console.WriteLine("InvalidTestString '{0}'", floatString);
            //Match m = Sos.FloatNumberRegexBase10.Match(floatString);
            Int32  numberLength = Sos.FloatLength(floatString, 0, floatString.Length);
            String matchString  = floatString.Substring(0, numberLength);

            Console.WriteLine("Invalid '{0}' Matched '{1}'", floatString, matchString);

            if (numberLength > 0)
            {
                try
                {
                    Single.Parse(matchString);
                    Assert.Fail("Expected parse to fail but didn't");
                }
                catch (FormatException)
                {
                }
            }
        }