From f5830988878e8b8fba1916fa4c8e8c2d589f2500 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 19 Jul 2012 19:44:54 +0900 Subject: [PATCH] Update InputPointers unit test comments --- .../inputmethod/latin/InputPointersTests.java | 98 +++++++++---------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/tests/src/com/android/inputmethod/latin/InputPointersTests.java b/tests/src/com/android/inputmethod/latin/InputPointersTests.java index 0ab3cb970..6f04f3ebb 100644 --- a/tests/src/com/android/inputmethod/latin/InputPointersTests.java +++ b/tests/src/com/android/inputmethod/latin/InputPointersTests.java @@ -23,7 +23,7 @@ public class InputPointersTests extends AndroidTestCase { public void testNewInstance() { 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 yCoordinates", src.getYCoordinates()); assertNotNull("new instance pointerIds", src.getPointerIds()); @@ -38,11 +38,11 @@ public class InputPointersTests extends AndroidTestCase { final int[] times = src.getXCoordinates(); src.reset(); - assertEquals("after reset size", 0, src.getPointerSize()); - assertNotSame("after reset xCoordinates", xCoordinates, src.getXCoordinates()); - assertNotSame("after reset yCoordinates", yCoordinates, src.getYCoordinates()); - assertNotSame("after reset pointerIds", pointerIds, src.getPointerIds()); - assertNotSame("after reset times", times, src.getTimes()); + assertEquals("size after reset", 0, src.getPointerSize()); + assertNotSame("xCoordinates after reset", xCoordinates, src.getXCoordinates()); + assertNotSame("yCoordinates after reset", yCoordinates, src.getYCoordinates()); + assertNotSame("pointerIds after reset", pointerIds, src.getPointerIds()); + assertNotSame("times after reset", times, src.getTimes()); } public void testAdd() { @@ -50,7 +50,7 @@ public class InputPointersTests extends AndroidTestCase { final int limit = src.getXCoordinates().length * 2 + 10; for (int i = 0; i < limit; i++) { 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++) { assertEquals("xCoordinates at " + i, i, src.getXCoordinates()[i]); @@ -65,7 +65,7 @@ public class InputPointersTests extends AndroidTestCase { final int limit = 1000, step = 100; for (int i = 0; i < limit; i += step) { 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) { assertEquals("xCoordinates at " + i, i, src.getXCoordinates()[i]); @@ -83,11 +83,11 @@ public class InputPointersTests extends AndroidTestCase { } final InputPointers dst = new InputPointers(DEFAULT_CAPACITY); dst.set(src); - assertEquals("after set size", dst.getPointerSize(), src.getPointerSize()); - assertSame("after set xCoordinates", dst.getXCoordinates(), src.getXCoordinates()); - assertSame("after set yCoordinates", dst.getYCoordinates(), src.getYCoordinates()); - assertSame("after set pointerIds", dst.getPointerIds(), src.getPointerIds()); - assertSame("after set times", dst.getTimes(), src.getTimes()); + assertEquals("size after set", dst.getPointerSize(), src.getPointerSize()); + assertSame("xCoordinates after set", dst.getXCoordinates(), src.getXCoordinates()); + assertSame("yCoordinates after set", dst.getYCoordinates(), src.getYCoordinates()); + assertSame("pointerIds after set", dst.getPointerIds(), src.getPointerIds()); + assertSame("times after set", dst.getTimes(), src.getTimes()); } public void testCopy() { @@ -98,19 +98,19 @@ public class InputPointersTests extends AndroidTestCase { } final InputPointers dst = new InputPointers(DEFAULT_CAPACITY); dst.copy(src); - assertEquals("after copy size", dst.getPointerSize(), src.getPointerSize()); - assertNotSame("after copy xCoordinates", dst.getXCoordinates(), src.getXCoordinates()); - assertNotSame("after copy yCoordinates", dst.getYCoordinates(), src.getYCoordinates()); - assertNotSame("after copy pointerIds", dst.getPointerIds(), src.getPointerIds()); - assertNotSame("after copy times", dst.getTimes(), src.getTimes()); + assertEquals("size after copy", dst.getPointerSize(), src.getPointerSize()); + assertNotSame("xCoordinates after copy", dst.getXCoordinates(), src.getXCoordinates()); + assertNotSame("yCoordinates after copy", dst.getYCoordinates(), src.getYCoordinates()); + assertNotSame("pointerIds after copy", dst.getPointerIds(), src.getPointerIds()); + assertNotSame("times after copy", dst.getTimes(), src.getTimes()); final int size = dst.getPointerSize(); - assertArrayEquals("after copy xCoordinates values", + assertArrayEquals("xCoordinates values after copy", dst.getXCoordinates(), 0, src.getXCoordinates(), 0, size); - assertArrayEquals("after copy yCoordinates values", + assertArrayEquals("yCoordinates values after copy", dst.getYCoordinates(), 0, src.getYCoordinates(), 0, size); - assertArrayEquals("after copy pointerIds values", + assertArrayEquals("pointerIds values after copy", dst.getPointerIds(), 0, src.getPointerIds(), 0, size); - assertArrayEquals("after copy times values", + assertArrayEquals("times values after copy", dst.getTimes(), 0, src.getTimes(), 0, size); } @@ -130,36 +130,36 @@ public class InputPointersTests extends AndroidTestCase { dstCopy.copy(dst); dst.append(src, 0, 0); - assertEquals("after append zero size", dstLen, dst.getPointerSize()); - assertArrayEquals("after append zero xCoordinates", dstCopy.getXCoordinates(), 0, - dst.getXCoordinates(), 0, dstLen); - assertArrayEquals("after append zero yCoordinates", dstCopy.getYCoordinates(), 0, - dst.getYCoordinates(), 0, dstLen); - assertArrayEquals("after append zero pointerIds", dstCopy.getPointerIds(), 0, - dst.getPointerIds(), 0, dstLen); - assertArrayEquals("after append zero times", dstCopy.getTimes(), 0, - dst.getTimes(), 0, dstLen); + assertEquals("size after append zero", dstLen, dst.getPointerSize()); + assertArrayEquals("xCoordinates after append zero", + dstCopy.getXCoordinates(), 0, dst.getXCoordinates(), 0, dstLen); + assertArrayEquals("yCoordinates after append zero", + dstCopy.getYCoordinates(), 0, dst.getYCoordinates(), 0, dstLen); + assertArrayEquals("pointerIds after append zero", + dstCopy.getPointerIds(), 0, dst.getPointerIds(), 0, dstLen); + assertArrayEquals("times after append zero", + dstCopy.getTimes(), 0, dst.getTimes(), 0, dstLen); dst.append(src, 0, srcLen); - assertEquals("after append size", dstLen + srcLen, dst.getPointerSize()); - assertTrue("after append size primitive length", + assertEquals("size after append", dstLen + srcLen, dst.getPointerSize()); + assertTrue("primitive length after append", dst.getPointerIds().length >= dstLen + srcLen); - assertArrayEquals("after append xCoordinates", dstCopy.getXCoordinates(), 0, - dst.getXCoordinates(), 0, dstLen); - assertArrayEquals("after append yCoordinates", dstCopy.getYCoordinates(), 0, - dst.getYCoordinates(), 0, dstLen); - assertArrayEquals("after append pointerIds", dstCopy.getPointerIds(), 0, - dst.getPointerIds(), 0, dstLen); - assertArrayEquals("after append times", dstCopy.getTimes(), 0, - dst.getTimes(), 0, dstLen); - assertArrayEquals("after append xCoordinates", dst.getXCoordinates(), dstLen, - src.getXCoordinates(), 0, srcLen); - assertArrayEquals("after append yCoordinates", dst.getYCoordinates(), dstLen, - src.getYCoordinates(), 0, srcLen); - assertArrayEquals("after append pointerIds", dst.getPointerIds(), dstLen, - src.getPointerIds(), 0, srcLen); - assertArrayEquals("after append times", dst.getTimes(), dstLen, - src.getTimes(), 0, srcLen); + assertArrayEquals("original xCoordinates values after append", + dstCopy.getXCoordinates(), 0, dst.getXCoordinates(), 0, dstLen); + assertArrayEquals("original yCoordinates values after append", + dstCopy.getYCoordinates(), 0, dst.getYCoordinates(), 0, dstLen); + assertArrayEquals("original pointerIds values after append", + dstCopy.getPointerIds(), 0, dst.getPointerIds(), 0, dstLen); + assertArrayEquals("original times values after append", + dstCopy.getTimes(), 0, dst.getTimes(), 0, dstLen); + assertArrayEquals("appended xCoordinates values after append", + src.getXCoordinates(), 0, dst.getXCoordinates(), dstLen, srcLen); + assertArrayEquals("appended yCoordinates values after append", + src.getYCoordinates(), 0, dst.getYCoordinates(), dstLen, srcLen); + assertArrayEquals("appended pointerIds values after append", + src.getPointerIds(), 0, dst.getPointerIds(), dstLen, srcLen); + assertArrayEquals("appended times values after append", + src.getTimes(), 0, dst.getTimes(), dstLen, srcLen); } private static void assertArrayEquals(String message, int[] expecteds, int expectedPos,