Project

General

Profile

Actions

Tmp » History » Revision 1

Revision 1/6 | Next »
Николай Пакулин, 03/30/2015 05:49 PM


Кусочки кода

static void assertTestString(CharSequence s) {
        int pos = 0;
        int len = s.length();
        int rest = 0;
        char fill = 0;

        for (pos = 0; pos < len; pos++) {
            if (rest == 0) {
                fill = s.charAt(pos);
                if (fill == 0) {
                    continue;
                }
                rest = fill - 1;
                continue;
            } else {
                assertEquals("Position " + pos + ": expected symbol \\u" 
                        + new Integer(fill) + " got \\u" 
                        + new Integer(s.charAt(pos))
                    , fill, s.charAt(pos));
                rest --;
            }
        }
        assertEquals("expected "+ rest + " more characters", 
                0, rest);
    }

Updated by Николай Пакулин over 9 years ago · 6 revisions