// Path: src/main/java/io/github/karols/hocr4j/dom/HocrParser.java
// static ArrayList<String> lex(String hocr) {
//     ArrayList<String> result = new ArrayList<String>();
//     int offset = 0;
//     while (hocr.length() > offset) {
//         int elemLength = elementLength(hocr, offset);
//         String elem = hocr.substring(offset, offset + elemLength);
//         result.add(elem);
//         offset += elemLength;
//     }
//     return result;
// }//tested


import org.junit.Test;
import static io.github.karols.hocr4j.dom.HocrParser.lex;
import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
package io.github.karols.hocr4j.dom;



/**
 * HocrParser Tester.
 *
 * @author <Authors name>
 * @version 1.0
 * @since <pre>Oct 4, 2013</pre>
 */
public class HocrParserTest {

    /**
     * Method: lex(String hocr)
     */
    @Test
    public void testLex() throws Exception {
        assertEquals(asList("a"), lex("a"));
        assertEquals(asList("<a>", "</a>"), lex("<a></a>"));
        assertEquals(asList("<a>", "a", "</a>"), lex("<a>a</a>"));
        assertEquals(asList("<a>", "<aa", "</a>"), lex("<a><aa</a>"));
        assertEquals(asList("<a>", "aa", "<", "</a>"), lex("<a>aa<</a>"));
        assertEquals(asList("<a>", "a", "<a", "</a>"), lex("<a>a<a</a>"));
        assertEquals(asList("<a>", "<", "</a>"), lex("<a><</a>"));
        assertEquals(asList("<a>", ">", "</a>"), lex("<a>></a>"));
        assertEquals(asList("<a>", "<", "<", "</a>"), lex("<a><<</a>"));
// Path: src/main/java/io/github/karols/hocr4j/dom/HocrParser.java
// static ArrayList<String> lex(String hocr) {
//     ArrayList<String> result = new ArrayList<String>();
//     int offset = 0;
//     while (hocr.length() > offset) {
//         int elemLength = elementLength(hocr, offset);
//         String elem = hocr.substring(offset, offset + elemLength);
//         result.add(elem);
//         offset += elemLength;
//     }
//     return result;
// }//tested


// Path: src/test/java/io/github/karols/hocr4j/dom/HocrParserTest.java
import org.junit.Test;
import static io.github.karols.hocr4j.dom.HocrParser.lex;
import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;

package io.github.karols.hocr4j.dom;



/**
 * HocrParser Tester.
 *
 * @author <Authors name>
 * @version 1.0
 * @since <pre>Oct 4, 2013</pre>
 */
public class HocrParserTest {

    /**
     * Method: lex(String hocr)
     */
    @Test
    public void testLex() throws Exception {
        assertEquals(asList("a"), lex("a"));
        assertEquals(asList("<a>", "</a>"), lex("<a></a>"));
        assertEquals(asList("<a>", "a", "</a>"), lex("<a>a</a>"));
        assertEquals(asList("<a>", "<aa", "</a>"), lex("<a><aa</a>"));
        assertEquals(asList("<a>", "aa", "<", "</a>"), lex("<a>aa<</a>"));
        assertEquals(asList("<a>", "a", "<a", "</a>"), lex("<a>a<a</a>"));
        assertEquals(asList("<a>", "<", "</a>"), lex("<a><</a>"));
        assertEquals(asList("<a>", ">", "</a>"), lex("<a>></a>"));
        assertEquals(asList("<a>", "<", "<", "</a>"), lex("<a><<</a>"));
        assertEquals(asList("<a>", ">", "<", "</a>"), lex("<a>><</a>"));