private static final int ARTESTLEN = 12;
public void testAddRangeGeneric() {
CharacterSet.Builder b = new CharacterSet.Builder();
CharacterSet s2, s3;
int[] array1 = new int[ARTESTLEN];
int[] array2 = new int[ARTESTLEN];
for(int i = 0; i < (1<<ARTESTLEN); i++) {
fillArray(array1, i);
for(int start = 0; start < ARTESTLEN; start++) {
for(int end = start; end < ARTESTLEN; end++) {
for(int e = 0; e < ARTESTLEN; e++) {
array2[e] = (e >= start && e <= end) ? 1 : array1[e];
}
b.clear();
int q = 0;
while(q < array1.length) {
if(array1[q] == 1) {
int st = q;
while(q+1 < array1.length && array1[q+1] == 1) {
q++;
}
b.addRange(st, q);
}
q++;
}
b.addRange(start, end);
s2 = b.create();
s3 = fromArray(array2,b);
Assert.assertEquals(i+": "+start+"-"+end,
s3.toString(), s2.toString());
}
}
}
}