Exemple #1
0
        public void TestFullRune()
        {
            foreach (var rm in runeMap)
            {
                Assert.IsTrue(Utf8.FullRune(rm.Bytes), "Error with FullRune on ({0})", rm.Bytes);
                Assert.IsTrue(Utf8.FullRune(ustring.Make(rm.Bytes)), "Error with FullRune(ustring) on {0}", rm.Bytes);

                var brokenSequence = new byte [rm.Bytes.Length - 1];
                Array.Copy(rm.Bytes, brokenSequence, rm.Bytes.Length - 1);
                Assert.IsFalse(Utf8.FullRune(brokenSequence), "Expected false for a partial sequence");
                Assert.IsFalse(Utf8.FullRune(ustring.Make(brokenSequence)), "Expected false for a partial sequence");
            }
            Assert.IsTrue(Utf8.FullRune(ustring.Make(0xc0)));
            Assert.IsTrue(Utf8.FullRune(ustring.Make(0xc0)));
        }