예제 #1
0
        public void ParseDouble(double n)
        {
            var s = n.ToString();

            Assert.Equal(n, StringToken.FromString(s).ParseDouble());
            Assert.Equal(n, StringToken.FromChars(("x" + s + "z").ToCharArray(),
                                                  1, s.Length).ParseDouble());
        }
예제 #2
0
        public void AsSpan()
        {
            var span1 = StringToken.FromString("abc").AsSpan();

            Assert.Equal(3, span1.Length);
            Assert.Equal("abc", span1.ToString());

            var span2 = StringToken.FromChars("xabcz".ToCharArray(), 1, 3).AsSpan();

            Assert.Equal(3, span2.Length);
            Assert.Equal("abc", span2.ToString());
        }
예제 #3
0
        public void FromChars()
        {
            var st = StringToken.FromChars("xabcz".ToCharArray(), 1, 3);

            Assert.Equal(3, st.Length);
            ShouldEqual("abc", st);
            ShouldEqual(StringToken.FromString("abc"), st);
            ShouldEqual(StringToken.FromChars("xabcz".ToCharArray(), 1, 3), st);
            ShouldNotEqual("def", st);
            ShouldNotEqual(StringToken.FromString("def"), st);
            ShouldNotEqual(StringToken.FromChars("def".ToCharArray(), 0, 3), st);
            ShouldNotEqual(StringToken.FromChars("abc".ToCharArray(), 0, 2), st);
        }
 public void FromStringToken()
 {
     DoEqualityTests(new PropertyNameToken(StringToken.FromChars("xabcz".ToCharArray(), 1, 3)));
 }