public void testParseLong() throws IOException
    {
        assertTrue(0l == NumberParser.parseLong(new byte[] { '0' }, 0, 1, 10));
        assertTrue(1l == NumberParser.parseLong(new byte[] { '1' }, 0, 1, 10));
        assertTrue(-1l == NumberParser.parseLong(new byte[] { '-', '1' }, 0, 2, 10));

        final LinkedBuffer lb = LinkedBuffer.allocate(256);
        final WriteSession session = new WriteSession(lb);

        assertTrue(lb == StringSerializer.writeLong(
                Long.MAX_VALUE, session, session.tail));

        assertTrue(Long.MAX_VALUE == NumberParser.parseLong(
                session.toByteArray(), 0, session.size, 10));

        session.clear();

        assertTrue(lb == StringSerializer.writeLong(
                Long.MAX_VALUE - 1, session, session.tail));

        assertTrue(Long.MAX_VALUE - 1 == NumberParser.parseLong(
                session.toByteArray(), 0, session.size, 10));

        session.clear();

        assertTrue(lb == StringSerializer.writeLong(
                Long.MIN_VALUE, session, session.tail));

        assertTrue(Long.MIN_VALUE == NumberParser.parseLong(
                session.toByteArray(), 0, session.size, 10));

        session.clear();

        assertTrue(lb == StringSerializer.writeLong(
                Long.MIN_VALUE + 1, session, session.tail));

        assertTrue(Long.MIN_VALUE + 1 == NumberParser.parseLong(
                session.toByteArray(), 0, session.size, 10));
    }
Test for parsing numbers from raw ascii buffers.

@author David Yu
@created Dec 4, 2010
protostuff-api/src/test/java/io/protostuff/NumberParserTest.java