mirror of https://github.com/etesync/android
* generalise davdroid.ArrayUtils.partition; tests * lower multi-get limit to 35pull/2/head
parent
4505a5958d
commit
558075f1bb
@ -0,0 +1,32 @@
|
||||
package at.bitfire.davdroid.test;
|
||||
import java.util.Arrays;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import at.bitfire.davdroid.ArrayUtils;
|
||||
|
||||
|
||||
public class ArrayUtilsTest extends TestCase {
|
||||
|
||||
public void testPartition() {
|
||||
// n == 0
|
||||
assertTrue(Arrays.deepEquals(
|
||||
new Long[0][0],
|
||||
ArrayUtils.partition(new Long[] { }, 5)));
|
||||
|
||||
// n < max
|
||||
assertTrue(Arrays.deepEquals(
|
||||
new Long[][] { { 1l, 2l } },
|
||||
ArrayUtils.partition(new Long[] { 1l, 2l }, 5)));
|
||||
|
||||
// n == max
|
||||
assertTrue(Arrays.deepEquals(
|
||||
new Long[][] { { 1l, 2l }, { 3l, 4l } },
|
||||
ArrayUtils.partition(new Long[] { 1l, 2l, 3l, 4l }, 2)));
|
||||
|
||||
// n > max
|
||||
assertTrue(Arrays.deepEquals(
|
||||
new Long[][] { { 1l, 2l, 3l, 4l, 5l }, { 6l, 7l, 8l, 9l, 10l }, { 11l } },
|
||||
ArrayUtils.partition(new Long[] { 1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l, 9l, 10l, 11l }, 5)));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue