Merge "Update InputPointers unit test comments"
This commit is contained in:
commit
4fe0a8e620
1 changed files with 49 additions and 49 deletions
|
@ -23,7 +23,7 @@ public class InputPointersTests extends AndroidTestCase {
|
||||||
|
|
||||||
public void testNewInstance() {
|
public void testNewInstance() {
|
||||||
final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
|
final InputPointers src = new InputPointers(DEFAULT_CAPACITY);
|
||||||
assertEquals("newInstance size", 0, src.getPointerSize());
|
assertEquals("new instance size", 0, src.getPointerSize());
|
||||||
assertNotNull("new instance xCoordinates", src.getXCoordinates());
|
assertNotNull("new instance xCoordinates", src.getXCoordinates());
|
||||||
assertNotNull("new instance yCoordinates", src.getYCoordinates());
|
assertNotNull("new instance yCoordinates", src.getYCoordinates());
|
||||||
assertNotNull("new instance pointerIds", src.getPointerIds());
|
assertNotNull("new instance pointerIds", src.getPointerIds());
|
||||||
|
@ -38,11 +38,11 @@ public class InputPointersTests extends AndroidTestCase {
|
||||||
final int[] times = src.getXCoordinates();
|
final int[] times = src.getXCoordinates();
|
||||||
|
|
||||||
src.reset();
|
src.reset();
|
||||||
assertEquals("after reset size", 0, src.getPointerSize());
|
assertEquals("size after reset", 0, src.getPointerSize());
|
||||||
assertNotSame("after reset xCoordinates", xCoordinates, src.getXCoordinates());
|
assertNotSame("xCoordinates after reset", xCoordinates, src.getXCoordinates());
|
||||||
assertNotSame("after reset yCoordinates", yCoordinates, src.getYCoordinates());
|
assertNotSame("yCoordinates after reset", yCoordinates, src.getYCoordinates());
|
||||||
assertNotSame("after reset pointerIds", pointerIds, src.getPointerIds());
|
assertNotSame("pointerIds after reset", pointerIds, src.getPointerIds());
|
||||||
assertNotSame("after reset times", times, src.getTimes());
|
assertNotSame("times after reset", times, src.getTimes());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAdd() {
|
public void testAdd() {
|
||||||
|
@ -50,7 +50,7 @@ public class InputPointersTests extends AndroidTestCase {
|
||||||
final int limit = src.getXCoordinates().length * 2 + 10;
|
final int limit = src.getXCoordinates().length * 2 + 10;
|
||||||
for (int i = 0; i < limit; i++) {
|
for (int i = 0; i < limit; i++) {
|
||||||
src.addPointer(i, i * 2, i * 3, i * 4);
|
src.addPointer(i, i * 2, i * 3, i * 4);
|
||||||
assertEquals("after add " + i, i + 1, src.getPointerSize());
|
assertEquals("size after add " + i, i + 1, src.getPointerSize());
|
||||||
}
|
}
|
||||||
for (int i = 0; i < limit; i++) {
|
for (int i = 0; i < limit; i++) {
|
||||||
assertEquals("xCoordinates at " + i, i, src.getXCoordinates()[i]);
|
assertEquals("xCoordinates at " + i, i, src.getXCoordinates()[i]);
|
||||||
|
@ -65,7 +65,7 @@ public class InputPointersTests extends AndroidTestCase {
|
||||||
final int limit = 1000, step = 100;
|
final int limit = 1000, step = 100;
|
||||||
for (int i = 0; i < limit; i += step) {
|
for (int i = 0; i < limit; i += step) {
|
||||||
src.addPointer(i, i, i * 2, i * 3, i * 4);
|
src.addPointer(i, i, i * 2, i * 3, i * 4);
|
||||||
assertEquals("after add at " + i, i + 1, src.getPointerSize());
|
assertEquals("size after add at " + i, i + 1, src.getPointerSize());
|
||||||
}
|
}
|
||||||
for (int i = 0; i < limit; i += step) {
|
for (int i = 0; i < limit; i += step) {
|
||||||
assertEquals("xCoordinates at " + i, i, src.getXCoordinates()[i]);
|
assertEquals("xCoordinates at " + i, i, src.getXCoordinates()[i]);
|
||||||
|
@ -83,11 +83,11 @@ public class InputPointersTests extends AndroidTestCase {
|
||||||
}
|
}
|
||||||
final InputPointers dst = new InputPointers(DEFAULT_CAPACITY);
|
final InputPointers dst = new InputPointers(DEFAULT_CAPACITY);
|
||||||
dst.set(src);
|
dst.set(src);
|
||||||
assertEquals("after set size", dst.getPointerSize(), src.getPointerSize());
|
assertEquals("size after set", dst.getPointerSize(), src.getPointerSize());
|
||||||
assertSame("after set xCoordinates", dst.getXCoordinates(), src.getXCoordinates());
|
assertSame("xCoordinates after set", dst.getXCoordinates(), src.getXCoordinates());
|
||||||
assertSame("after set yCoordinates", dst.getYCoordinates(), src.getYCoordinates());
|
assertSame("yCoordinates after set", dst.getYCoordinates(), src.getYCoordinates());
|
||||||
assertSame("after set pointerIds", dst.getPointerIds(), src.getPointerIds());
|
assertSame("pointerIds after set", dst.getPointerIds(), src.getPointerIds());
|
||||||
assertSame("after set times", dst.getTimes(), src.getTimes());
|
assertSame("times after set", dst.getTimes(), src.getTimes());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCopy() {
|
public void testCopy() {
|
||||||
|
@ -98,19 +98,19 @@ public class InputPointersTests extends AndroidTestCase {
|
||||||
}
|
}
|
||||||
final InputPointers dst = new InputPointers(DEFAULT_CAPACITY);
|
final InputPointers dst = new InputPointers(DEFAULT_CAPACITY);
|
||||||
dst.copy(src);
|
dst.copy(src);
|
||||||
assertEquals("after copy size", dst.getPointerSize(), src.getPointerSize());
|
assertEquals("size after copy", dst.getPointerSize(), src.getPointerSize());
|
||||||
assertNotSame("after copy xCoordinates", dst.getXCoordinates(), src.getXCoordinates());
|
assertNotSame("xCoordinates after copy", dst.getXCoordinates(), src.getXCoordinates());
|
||||||
assertNotSame("after copy yCoordinates", dst.getYCoordinates(), src.getYCoordinates());
|
assertNotSame("yCoordinates after copy", dst.getYCoordinates(), src.getYCoordinates());
|
||||||
assertNotSame("after copy pointerIds", dst.getPointerIds(), src.getPointerIds());
|
assertNotSame("pointerIds after copy", dst.getPointerIds(), src.getPointerIds());
|
||||||
assertNotSame("after copy times", dst.getTimes(), src.getTimes());
|
assertNotSame("times after copy", dst.getTimes(), src.getTimes());
|
||||||
final int size = dst.getPointerSize();
|
final int size = dst.getPointerSize();
|
||||||
assertArrayEquals("after copy xCoordinates values",
|
assertArrayEquals("xCoordinates values after copy",
|
||||||
dst.getXCoordinates(), 0, src.getXCoordinates(), 0, size);
|
dst.getXCoordinates(), 0, src.getXCoordinates(), 0, size);
|
||||||
assertArrayEquals("after copy yCoordinates values",
|
assertArrayEquals("yCoordinates values after copy",
|
||||||
dst.getYCoordinates(), 0, src.getYCoordinates(), 0, size);
|
dst.getYCoordinates(), 0, src.getYCoordinates(), 0, size);
|
||||||
assertArrayEquals("after copy pointerIds values",
|
assertArrayEquals("pointerIds values after copy",
|
||||||
dst.getPointerIds(), 0, src.getPointerIds(), 0, size);
|
dst.getPointerIds(), 0, src.getPointerIds(), 0, size);
|
||||||
assertArrayEquals("after copy times values",
|
assertArrayEquals("times values after copy",
|
||||||
dst.getTimes(), 0, src.getTimes(), 0, size);
|
dst.getTimes(), 0, src.getTimes(), 0, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,36 +130,36 @@ public class InputPointersTests extends AndroidTestCase {
|
||||||
dstCopy.copy(dst);
|
dstCopy.copy(dst);
|
||||||
|
|
||||||
dst.append(src, 0, 0);
|
dst.append(src, 0, 0);
|
||||||
assertEquals("after append zero size", dstLen, dst.getPointerSize());
|
assertEquals("size after append zero", dstLen, dst.getPointerSize());
|
||||||
assertArrayEquals("after append zero xCoordinates", dstCopy.getXCoordinates(), 0,
|
assertArrayEquals("xCoordinates after append zero",
|
||||||
dst.getXCoordinates(), 0, dstLen);
|
dstCopy.getXCoordinates(), 0, dst.getXCoordinates(), 0, dstLen);
|
||||||
assertArrayEquals("after append zero yCoordinates", dstCopy.getYCoordinates(), 0,
|
assertArrayEquals("yCoordinates after append zero",
|
||||||
dst.getYCoordinates(), 0, dstLen);
|
dstCopy.getYCoordinates(), 0, dst.getYCoordinates(), 0, dstLen);
|
||||||
assertArrayEquals("after append zero pointerIds", dstCopy.getPointerIds(), 0,
|
assertArrayEquals("pointerIds after append zero",
|
||||||
dst.getPointerIds(), 0, dstLen);
|
dstCopy.getPointerIds(), 0, dst.getPointerIds(), 0, dstLen);
|
||||||
assertArrayEquals("after append zero times", dstCopy.getTimes(), 0,
|
assertArrayEquals("times after append zero",
|
||||||
dst.getTimes(), 0, dstLen);
|
dstCopy.getTimes(), 0, dst.getTimes(), 0, dstLen);
|
||||||
|
|
||||||
dst.append(src, 0, srcLen);
|
dst.append(src, 0, srcLen);
|
||||||
assertEquals("after append size", dstLen + srcLen, dst.getPointerSize());
|
assertEquals("size after append", dstLen + srcLen, dst.getPointerSize());
|
||||||
assertTrue("after append size primitive length",
|
assertTrue("primitive length after append",
|
||||||
dst.getPointerIds().length >= dstLen + srcLen);
|
dst.getPointerIds().length >= dstLen + srcLen);
|
||||||
assertArrayEquals("after append xCoordinates", dstCopy.getXCoordinates(), 0,
|
assertArrayEquals("original xCoordinates values after append",
|
||||||
dst.getXCoordinates(), 0, dstLen);
|
dstCopy.getXCoordinates(), 0, dst.getXCoordinates(), 0, dstLen);
|
||||||
assertArrayEquals("after append yCoordinates", dstCopy.getYCoordinates(), 0,
|
assertArrayEquals("original yCoordinates values after append",
|
||||||
dst.getYCoordinates(), 0, dstLen);
|
dstCopy.getYCoordinates(), 0, dst.getYCoordinates(), 0, dstLen);
|
||||||
assertArrayEquals("after append pointerIds", dstCopy.getPointerIds(), 0,
|
assertArrayEquals("original pointerIds values after append",
|
||||||
dst.getPointerIds(), 0, dstLen);
|
dstCopy.getPointerIds(), 0, dst.getPointerIds(), 0, dstLen);
|
||||||
assertArrayEquals("after append times", dstCopy.getTimes(), 0,
|
assertArrayEquals("original times values after append",
|
||||||
dst.getTimes(), 0, dstLen);
|
dstCopy.getTimes(), 0, dst.getTimes(), 0, dstLen);
|
||||||
assertArrayEquals("after append xCoordinates", dst.getXCoordinates(), dstLen,
|
assertArrayEquals("appended xCoordinates values after append",
|
||||||
src.getXCoordinates(), 0, srcLen);
|
src.getXCoordinates(), 0, dst.getXCoordinates(), dstLen, srcLen);
|
||||||
assertArrayEquals("after append yCoordinates", dst.getYCoordinates(), dstLen,
|
assertArrayEquals("appended yCoordinates values after append",
|
||||||
src.getYCoordinates(), 0, srcLen);
|
src.getYCoordinates(), 0, dst.getYCoordinates(), dstLen, srcLen);
|
||||||
assertArrayEquals("after append pointerIds", dst.getPointerIds(), dstLen,
|
assertArrayEquals("appended pointerIds values after append",
|
||||||
src.getPointerIds(), 0, srcLen);
|
src.getPointerIds(), 0, dst.getPointerIds(), dstLen, srcLen);
|
||||||
assertArrayEquals("after append times", dst.getTimes(), dstLen,
|
assertArrayEquals("appended times values after append",
|
||||||
src.getTimes(), 0, srcLen);
|
src.getTimes(), 0, dst.getTimes(), dstLen, srcLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertArrayEquals(String message, int[] expecteds, int expectedPos,
|
private static void assertArrayEquals(String message, int[] expecteds, int expectedPos,
|
||||||
|
|
Loading…
Reference in a new issue