Ejemplo n.º 1
0
        public void TestFirst()
        {
            CharArrayIterator ci = new CharArrayIterator();

            ci.SetText("testing".toCharArray(), 0, "testing".Length);
            ci.Next();
            // Sets the position to getBeginIndex() and returns the character at that position.
            assertEquals('t', ci.First());
            assertEquals(ci.BeginIndex, ci.Index);
            // or DONE if the text is empty
            ci.SetText(new char[] { }, 0, 0);
            assertEquals(CharacterIterator.Done, ci.First());
        }
Ejemplo n.º 2
0
        public void TestBasicUsage()
        {
            CharArrayIterator ci = new CharArrayIterator();

            ci.SetText("testing".toCharArray(), 0, "testing".Length);
            assertEquals(0, ci.BeginIndex);
            assertEquals(7, ci.EndIndex);
            assertEquals(0, ci.Index);
            assertEquals('t', ci.Current);
            assertEquals('e', ci.Next());
            assertEquals('g', ci.Last());
            assertEquals('n', ci.Previous());
            assertEquals('t', ci.First());
            assertEquals(CharacterIterator.Done, ci.Previous());
        }