Project

General

Profile

Tmp » History » Version 1

Николай Пакулин, 03/30/2015 05:49 PM

1 1 Николай Пакулин
h1. Кусочки кода
2
3
<pre>
4
static void assertTestString(CharSequence s) {
5
		int pos = 0;
6
		int len = s.length();
7
		int rest = 0;
8
		char fill = 0;
9
		
10
		for (pos = 0; pos < len; pos++) {
11
			if (rest == 0) {
12
				fill = s.charAt(pos);
13
				if (fill == 0) {
14
					continue;
15
				}
16
				rest = fill - 1;
17
				continue;
18
			} else {
19
				assertEquals("Position " + pos + ": expected symbol \\u" 
20
						+ new Integer(fill) + " got \\u" 
21
						+ new Integer(s.charAt(pos))
22
					, fill, s.charAt(pos));
23
				rest --;
24
			}
25
		}
26
		assertEquals("expected "+ rest + " more characters", 
27
				0, rest);
28
	}
29
</pre>