コード例 #1
0
        public void TestWithInvalidNumber()
        {
            var extractor = new NumericTokenExtractor();

            var token = extractor.ExtractToken("abc", 0, new Context(ExpressiveOptions.None));

            Assert.IsNull(token);
        }
コード例 #2
0
        public void TestWithMultipleDecimalPlaces()
        {
            var extractor = new NumericTokenExtractor();

            var token = extractor.ExtractToken("123.45.678", 0, new Context(ExpressiveOptions.None));

            Assert.IsNotNull(token);
            Assert.AreEqual("123.45", token.CurrentToken);
        }
コード例 #3
0
        public void TestWithDecimalPlaceAndNegativeSign()
        {
            var extractor = new NumericTokenExtractor();

            var token = extractor.ExtractToken("-123.45", 0, new Context(ExpressiveOptions.None));

            Assert.IsNotNull(token);
            Assert.AreEqual("-123.45", token.CurrentToken);
        }
コード例 #4
0
        public void TestWithIntegerAndPositiveSign()
        {
            var extractor = new NumericTokenExtractor();

            var token = extractor.ExtractToken("+123", 0, new Context(ExpressiveOptions.None));

            Assert.IsNotNull(token);
            Assert.AreEqual("+123", token.CurrentToken);
        }
コード例 #5
0
        public void TestWithScientificNotationAndNegativeSign()
        {
            var extractor = new NumericTokenExtractor();

            var token = extractor.ExtractToken("1.23e-2", 0, new Context(ExpressiveOptions.None));

            Assert.IsNotNull(token);
            Assert.AreEqual("1.23e-2", token.CurrentToken);
        }