143
144 @Test
145 public void testLong() {
146 long[] src = {234, 5345, 756, 23, 8, 345, 873, 440};
147 testHelper("longArraycopy", src);
148 }
149
150 @Test
151 public void testDouble() {
152 double[] src = {234, 5345, 756, 23, 8, 345, 873, 440};
153 testHelper("doubleArraycopy", src);
154 }
155
156 @Test
157 public void testObject() {
158 Object[] src = {"one", "two", "three", new ArrayList<>(), new HashMap<>()};
159 testHelper("objectArraycopy", src);
160 }
161
162 /**
163 * Tests {@link ArrayCopySnippets#checkcastArraycopyWork}.
164 */
165 @Test
166 public void testArrayStoreException() {
167 Object[] src = {"one", "two", "three", new ArrayList<>(), new HashMap<>()};
168 Object[] dst = new CharSequence[src.length];
169 // Will throw ArrayStoreException for 4th element
170 test("objectArraycopy", src, 0, dst, 0, src.length);
171 }
172
173 @Test
174 public void testDisjointObject() {
175 Integer[] src1 = {1, 2, 3, 4};
176 test("objectArraycopy", src1, 0, src1, 1, src1.length - 1);
177
178 Integer[] src2 = {1, 2, 3, 4};
179 test("objectArraycopy", src2, 1, src2, 0, src2.length - 1);
180 }
181
182 @Test
183 public void testObjectExact() {
|
143
144 @Test
145 public void testLong() {
146 long[] src = {234, 5345, 756, 23, 8, 345, 873, 440};
147 testHelper("longArraycopy", src);
148 }
149
150 @Test
151 public void testDouble() {
152 double[] src = {234, 5345, 756, 23, 8, 345, 873, 440};
153 testHelper("doubleArraycopy", src);
154 }
155
156 @Test
157 public void testObject() {
158 Object[] src = {"one", "two", "three", new ArrayList<>(), new HashMap<>()};
159 testHelper("objectArraycopy", src);
160 }
161
162 /**
163 * Tests {@link ArrayCopySnippets#arraycopyCheckcastSnippet}.
164 */
165 @Test
166 public void testArrayStoreException() {
167 Object[] src = {"one", "two", "three", new ArrayList<>(), new HashMap<>()};
168 Object[] dst = new CharSequence[src.length];
169 // Will throw ArrayStoreException for 4th element
170 test("objectArraycopy", src, 0, dst, 0, src.length);
171 }
172
173 @Test
174 public void testDisjointObject() {
175 Integer[] src1 = {1, 2, 3, 4};
176 test("objectArraycopy", src1, 0, src1, 1, src1.length - 1);
177
178 Integer[] src2 = {1, 2, 3, 4};
179 test("objectArraycopy", src2, 1, src2, 0, src2.length - 1);
180 }
181
182 @Test
183 public void testObjectExact() {
|