1/* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.rs.unittest; 18 19import android.content.Context; 20import android.content.res.Resources; 21import android.renderscript.Allocation; 22import android.renderscript.Element; 23import android.renderscript.RenderScript; 24import android.renderscript.Type; 25 26import java.util.Random; 27 28public class UT_alloc_copy extends UnitTest { 29 30 public UT_alloc_copy(Context ctx) { 31 super("Allocation CopyTo", ctx); 32 } 33 34 public void run() { 35 RenderScript mRS = createRenderScript(false); 36 37 allocation_copy1DRangeTo_Byte(mRS); 38 allocation_copy1DRangeTo_Short(mRS); 39 allocation_copy1DRangeTo_Int(mRS); 40 allocation_copy1DRangeTo_Float(mRS); 41 allocation_copy1DRangeTo_Long(mRS); 42 43 allocation_copy2DRangeTo_Byte(mRS); 44 allocation_copy2DRangeTo_Short(mRS); 45 allocation_copy2DRangeTo_Int(mRS); 46 allocation_copy2DRangeTo_Float(mRS); 47 allocation_copy2DRangeTo_Long(mRS); 48 49 allocation_copy1DRangeToUnchecked_Byte(mRS); 50 allocation_copy1DRangeToUnchecked_Short(mRS); 51 allocation_copy1DRangeToUnchecked_Int(mRS); 52 allocation_copy1DRangeToUnchecked_Float(mRS); 53 allocation_copy1DRangeToUnchecked_Long(mRS); 54 55 mRS.destroy(); 56 passTest(); 57 } 58 59 public void allocation_copy1DRangeTo_Byte(RenderScript mRS) { 60 Random random = new Random(0x172d8ab9); 61 int width = random.nextInt(512); 62 int arr_len = width; 63 64 byte[] inArray = new byte[arr_len]; 65 byte[] outArray = new byte[arr_len]; 66 random.nextBytes(inArray); 67 68 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I8(mRS)); 69 typeBuilder.setX(width); 70 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 71 int offset = random.nextInt(arr_len); 72 int count = arr_len - offset; 73 alloc.copy1DRangeFrom(offset, count, inArray); 74 alloc.copy1DRangeTo(offset, count, outArray); 75 76 boolean result = true; 77 for (int i = 0; i < count; i++) { 78 if (inArray[i] != outArray[i]) { 79 result = false; 80 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 81 break; 82 } 83 } 84 for (int i = count; i < arr_len; i++) { 85 if (outArray[i] != 0) { 86 result = false; 87 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 88 break; 89 } 90 } 91 if (result) { 92 android.util.Log.v("Allocation CopyTo Test", "copy1DRangeTo_Byte TEST PASSED"); 93 } else { 94 failTest(); 95 } 96 } 97 98 public void allocation_copy1DRangeTo_Short(RenderScript mRS) { 99 Random random = new Random(0x172d8ab9); 100 int width = random.nextInt(512); 101 int arr_len = width; 102 103 short[] inArray = new short[arr_len]; 104 short[] outArray = new short[arr_len]; 105 106 for (int i = 0; i < arr_len; i++) { 107 inArray[i] = (short)random.nextInt(); 108 } 109 110 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I16(mRS)); 111 typeBuilder.setX(width); 112 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 113 int offset = random.nextInt(arr_len); 114 int count = arr_len - offset; 115 alloc.copy1DRangeFrom(offset, count, inArray); 116 alloc.copy1DRangeTo(offset, count, outArray); 117 118 boolean result = true; 119 for (int i = 0; i < count; i++) { 120 if (inArray[i] != outArray[i]) { 121 result = false; 122 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 123 break; 124 } 125 } 126 for (int i = count; i < arr_len; i++) { 127 if (outArray[i] != 0) { 128 result = false; 129 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 130 break; 131 } 132 } 133 if (result) { 134 android.util.Log.v("Allocation CopyTo Test", "copy1DRangeTo_Short TEST PASSED"); 135 } else { 136 failTest(); 137 } 138 } 139 140 public void allocation_copy1DRangeTo_Int(RenderScript mRS) { 141 Random random = new Random(0x172d8ab9); 142 int width = random.nextInt(512); 143 int arr_len = width; 144 145 int[] inArray = new int[arr_len]; 146 int[] outArray = new int[arr_len]; 147 148 for (int i = 0; i < arr_len; i++) { 149 inArray[i] = random.nextInt(); 150 } 151 152 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I32(mRS)); 153 typeBuilder.setX(width); 154 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 155 int offset = random.nextInt(arr_len); 156 int count = arr_len - offset; 157 alloc.copy1DRangeFrom(offset, count, inArray); 158 alloc.copy1DRangeTo(offset, count, outArray); 159 160 boolean result = true; 161 for (int i = 0; i < count; i++) { 162 if (inArray[i] != outArray[i]) { 163 result = false; 164 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 165 break; 166 } 167 } 168 for (int i = count; i < arr_len; i++) { 169 if (outArray[i] != 0) { 170 result = false; 171 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 172 break; 173 } 174 } 175 if (result) { 176 android.util.Log.v("Allocation CopyTo Test", "copy1DRangeTo_Int TEST PASSED"); 177 } else { 178 failTest(); 179 } 180 } 181 182 public void allocation_copy1DRangeTo_Float(RenderScript mRS) { 183 Random random = new Random(0x172d8ab9); 184 int width = random.nextInt(512); 185 int arr_len = width; 186 187 float[] inArray = new float[arr_len]; 188 float[] outArray = new float[arr_len]; 189 190 for (int i = 0; i < arr_len; i++) { 191 inArray[i] = random.nextFloat(); 192 } 193 194 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F32(mRS)); 195 typeBuilder.setX(width); 196 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 197 int offset = random.nextInt(arr_len); 198 int count = arr_len - offset; 199 alloc.copy1DRangeFrom(offset, count, inArray); 200 alloc.copy1DRangeTo(offset, count, outArray); 201 202 boolean result = true; 203 for (int i = 0; i < count; i++) { 204 if (inArray[i] != outArray[i]) { 205 result = false; 206 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 207 break; 208 } 209 } 210 for (int i = count; i < arr_len; i++) { 211 if (outArray[i] != 0f) { 212 result = false; 213 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 214 break; 215 } 216 } 217 if (result) { 218 android.util.Log.v("Allocation CopyTo Test", "copy1DRangeTo_Float TEST PASSED"); 219 } else { 220 failTest(); 221 } 222 } 223 224 public void allocation_copy1DRangeTo_Long(RenderScript mRS) { 225 Random random = new Random(0x172d8ab9); 226 int width = random.nextInt(512); 227 int arr_len = width; 228 229 long[] inArray = new long[arr_len]; 230 long[] outArray = new long[arr_len]; 231 232 for (int i = 0; i < arr_len; i++) { 233 inArray[i] = random.nextLong(); 234 } 235 236 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I64(mRS)); 237 typeBuilder.setX(width); 238 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 239 int offset = random.nextInt(arr_len); 240 int count = arr_len - offset; 241 alloc.copy1DRangeFrom(offset, count, inArray); 242 alloc.copy1DRangeTo(offset, count, outArray); 243 244 boolean result = true; 245 for (int i = 0; i < count; i++) { 246 if (inArray[i] != outArray[i]) { 247 result = false; 248 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 249 break; 250 } 251 } 252 for (int i = count; i < arr_len; i++) { 253 if (outArray[i] != 0) { 254 result = false; 255 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 256 break; 257 } 258 } 259 if (result) { 260 android.util.Log.v("Allocation CopyTo Test", "copy1DRangeTo_Long TEST PASSED"); 261 } else { 262 failTest(); 263 } 264 } 265 266 public void allocation_copy2DRangeTo_Byte(RenderScript mRS) { 267 Random random = new Random(0x172d8ab9); 268 int width = random.nextInt(128); 269 int height = random.nextInt(128); 270 int xoff = random.nextInt(width); 271 int yoff = random.nextInt(height); 272 int xcount = width - xoff; 273 int ycount = height - yoff; 274 int arr_len = xcount * ycount; 275 276 byte[] inArray = new byte[arr_len]; 277 byte[] outArray = new byte[arr_len]; 278 random.nextBytes(inArray); 279 280 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I8(mRS)); 281 typeBuilder.setX(width).setY(height); 282 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 283 alloc.copy2DRangeFrom(xoff, yoff, xcount, ycount, inArray); 284 alloc.copy2DRangeTo(xoff, yoff, xcount, ycount, outArray); 285 286 boolean result = true; 287 for (int i = 0; i < arr_len; i++) { 288 if (inArray[i] != outArray[i]) { 289 result = false; 290 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 291 break; 292 } 293 } 294 if (result) { 295 android.util.Log.v("Allocation CopyTo Test", "copy2DRangeTo_Byte TEST PASSED"); 296 } else { 297 failTest(); 298 } 299 } 300 301 public void allocation_copy2DRangeTo_Short(RenderScript mRS) { 302 Random random = new Random(0x172d8ab9); 303 int width = random.nextInt(128); 304 int height = random.nextInt(128); 305 int xoff = random.nextInt(width); 306 int yoff = random.nextInt(height); 307 int xcount = width - xoff; 308 int ycount = height - yoff; 309 int arr_len = xcount * ycount; 310 311 short[] inArray = new short[arr_len]; 312 short[] outArray = new short[arr_len]; 313 314 for (int i = 0; i < arr_len; i++) { 315 inArray[i] = (short)random.nextInt(); 316 } 317 318 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I16(mRS)); 319 typeBuilder.setX(width).setY(height); 320 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 321 alloc.copy2DRangeFrom(xoff, yoff, xcount, ycount, inArray); 322 alloc.copy2DRangeTo(xoff, yoff, xcount, ycount, outArray); 323 324 boolean result = true; 325 for (int i = 0; i < arr_len; i++) { 326 if (inArray[i] != outArray[i]) { 327 result = false; 328 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 329 break; 330 } 331 } 332 if (result) { 333 android.util.Log.v("Allocation CopyTo Test", "copy2DRangeTo_Short TEST PASSED"); 334 } else { 335 failTest(); 336 } 337 } 338 339 public void allocation_copy2DRangeTo_Int(RenderScript mRS) { 340 Random random = new Random(0x172d8ab9); 341 int width = random.nextInt(128); 342 int height = random.nextInt(128); 343 int xoff = random.nextInt(width); 344 int yoff = random.nextInt(height); 345 int xcount = width - xoff; 346 int ycount = height - yoff; 347 int arr_len = xcount * ycount; 348 349 int[] inArray = new int[arr_len]; 350 int[] outArray = new int[arr_len]; 351 352 for (int i = 0; i < arr_len; i++) { 353 inArray[i] = random.nextInt(); 354 } 355 356 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I32(mRS)); 357 typeBuilder.setX(width).setY(height); 358 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 359 alloc.copy2DRangeFrom(xoff, yoff, xcount, ycount, inArray); 360 alloc.copy2DRangeTo(xoff, yoff, xcount, ycount, outArray); 361 362 boolean result = true; 363 for (int i = 0; i < arr_len; i++) { 364 if (inArray[i] != outArray[i]) { 365 result = false; 366 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 367 break; 368 } 369 } 370 if (result) { 371 android.util.Log.v("Allocation CopyTo Test", "copy2DRangeTo_Int TEST PASSED"); 372 } else { 373 failTest(); 374 } 375 } 376 377 public void allocation_copy2DRangeTo_Float(RenderScript mRS) { 378 Random random = new Random(0x172d8ab9); 379 int width = random.nextInt(128); 380 int height = random.nextInt(128); 381 int xoff = random.nextInt(width); 382 int yoff = random.nextInt(height); 383 int xcount = width - xoff; 384 int ycount = height - yoff; 385 int arr_len = xcount * ycount; 386 387 float[] inArray = new float[arr_len]; 388 float[] outArray = new float[arr_len]; 389 390 for (int i = 0; i < arr_len; i++) { 391 inArray[i] = random.nextFloat(); 392 } 393 394 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F32(mRS)); 395 typeBuilder.setX(width).setY(height); 396 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 397 alloc.copy2DRangeFrom(xoff, yoff, xcount, ycount, inArray); 398 alloc.copy2DRangeTo(xoff, yoff, xcount, ycount, outArray); 399 400 boolean result = true; 401 for (int i = 0; i < arr_len; i++) { 402 if (inArray[i] != outArray[i]) { 403 result = false; 404 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 405 break; 406 } 407 } 408 if (result) { 409 android.util.Log.v("Allocation CopyTo Test", "copy2DRangeTo_Float TEST PASSED"); 410 } else { 411 failTest(); 412 } 413 } 414 415 public void allocation_copy2DRangeTo_Long(RenderScript mRS) { 416 Random random = new Random(0x172d8ab9); 417 int width = random.nextInt(128); 418 int height = random.nextInt(128); 419 int xoff = random.nextInt(width); 420 int yoff = random.nextInt(height); 421 int xcount = width - xoff; 422 int ycount = height - yoff; 423 int arr_len = xcount * ycount; 424 425 long[] inArray = new long[arr_len]; 426 long[] outArray = new long[arr_len]; 427 428 for (int i = 0; i < arr_len; i++) { 429 inArray[i] = random.nextLong(); 430 } 431 432 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I64(mRS)); 433 typeBuilder.setX(width).setY(height); 434 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 435 alloc.copy2DRangeFrom(xoff, yoff, xcount, ycount, inArray); 436 alloc.copy2DRangeTo(xoff, yoff, xcount, ycount, outArray); 437 438 boolean result = true; 439 for (int i = 0; i < arr_len; i++) { 440 if (inArray[i] != outArray[i]) { 441 result = false; 442 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 443 break; 444 } 445 } 446 if (result) { 447 android.util.Log.v("Allocation CopyTo Test", "copy2DRangeTo_Long TEST PASSED"); 448 } else { 449 failTest(); 450 } 451 } 452 453 454 public void allocation_copy1DRangeToUnchecked_Byte(RenderScript mRS) { 455 Random random = new Random(0x172d8ab9); 456 int width = random.nextInt(512); 457 int arr_len = width; 458 459 byte[] inArray = new byte[arr_len]; 460 byte[] outArray = new byte[arr_len]; 461 random.nextBytes(inArray); 462 463 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I8(mRS)); 464 typeBuilder.setX(width); 465 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 466 int offset = random.nextInt(arr_len); 467 int count = arr_len - offset; 468 alloc.copy1DRangeFrom(offset, count, inArray); 469 alloc.copy1DRangeToUnchecked(offset, count, outArray); 470 471 boolean result = true; 472 for (int i = 0; i < count; i++) { 473 if (inArray[i] != outArray[i]) { 474 result = false; 475 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 476 break; 477 } 478 } 479 for (int i = count; i < arr_len; i++) { 480 if (outArray[i] != 0) { 481 result = false; 482 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 483 break; 484 } 485 } 486 if (result) { 487 android.util.Log.v("Allocation CopyTo Test", "copy1DRangeToUnchecked_Byte TEST PASSED"); 488 } else { 489 failTest(); 490 } 491 } 492 493 public void allocation_copy1DRangeToUnchecked_Short(RenderScript mRS) { 494 Random random = new Random(0x172d8ab9); 495 int width = random.nextInt(512); 496 int arr_len = width; 497 498 short[] inArray = new short[arr_len]; 499 short[] outArray = new short[arr_len]; 500 501 for (int i = 0; i < arr_len; i++) { 502 inArray[i] = (short)random.nextInt(); 503 } 504 505 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I16(mRS)); 506 typeBuilder.setX(width); 507 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 508 int offset = random.nextInt(arr_len); 509 int count = arr_len - offset; 510 alloc.copy1DRangeFrom(offset, count, inArray); 511 alloc.copy1DRangeToUnchecked(offset, count, outArray); 512 513 boolean result = true; 514 for (int i = 0; i < count; i++) { 515 if (inArray[i] != outArray[i]) { 516 result = false; 517 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 518 break; 519 } 520 } 521 for (int i = count; i < arr_len; i++) { 522 if (outArray[i] != 0) { 523 result = false; 524 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 525 break; 526 } 527 } 528 if (result) { 529 android.util.Log.v("Allocation CopyTo Test", "copy1DRangeToUnchecked_Short TEST PASSED"); 530 } else { 531 failTest(); 532 } 533 } 534 535 public void allocation_copy1DRangeToUnchecked_Int(RenderScript mRS) { 536 Random random = new Random(0x172d8ab9); 537 int width = random.nextInt(512); 538 int arr_len = width; 539 540 int[] inArray = new int[arr_len]; 541 int[] outArray = new int[arr_len]; 542 543 for (int i = 0; i < arr_len; i++) { 544 inArray[i] = random.nextInt(); 545 } 546 547 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I32(mRS)); 548 typeBuilder.setX(width); 549 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 550 int offset = random.nextInt(arr_len); 551 int count = arr_len - offset; 552 alloc.copy1DRangeFrom(offset, count, inArray); 553 alloc.copy1DRangeToUnchecked(offset, count, outArray); 554 555 boolean result = true; 556 for (int i = 0; i < count; i++) { 557 if (inArray[i] != outArray[i]) { 558 result = false; 559 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 560 break; 561 } 562 } 563 for (int i = count; i < arr_len; i++) { 564 if (outArray[i] != 0) { 565 result = false; 566 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 567 break; 568 } 569 } 570 if (result) { 571 android.util.Log.v("Allocation CopyTo Test", "copy1DRangeToUnchecked_Int TEST PASSED"); 572 } else { 573 failTest(); 574 } 575 } 576 577 public void allocation_copy1DRangeToUnchecked_Float(RenderScript mRS) { 578 Random random = new Random(0x172d8ab9); 579 int width = random.nextInt(512); 580 int arr_len = width; 581 582 float[] inArray = new float[arr_len]; 583 float[] outArray = new float[arr_len]; 584 585 for (int i = 0; i < arr_len; i++) { 586 inArray[i] = random.nextFloat(); 587 } 588 589 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F32(mRS)); 590 typeBuilder.setX(width); 591 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 592 int offset = random.nextInt(arr_len); 593 int count = arr_len - offset; 594 alloc.copy1DRangeFrom(offset, count, inArray); 595 alloc.copy1DRangeToUnchecked(offset, count, outArray); 596 597 boolean result = true; 598 for (int i = 0; i < count; i++) { 599 if (inArray[i] != outArray[i]) { 600 result = false; 601 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 602 break; 603 } 604 } 605 for (int i = count; i < arr_len; i++) { 606 if (outArray[i] != 0f) { 607 result = false; 608 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 609 break; 610 } 611 } 612 if (result) { 613 android.util.Log.v("Allocation CopyTo Test", "copy1DRangeToUnchecked_Float TEST PASSED"); 614 } else { 615 failTest(); 616 } 617 } 618 619 public void allocation_copy1DRangeToUnchecked_Long(RenderScript mRS) { 620 Random random = new Random(0x172d8ab9); 621 int width = random.nextInt(512); 622 int arr_len = width; 623 624 long[] inArray = new long[arr_len]; 625 long[] outArray = new long[arr_len]; 626 627 for (int i = 0; i < arr_len; i++) { 628 inArray[i] = random.nextLong(); 629 } 630 631 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I64(mRS)); 632 typeBuilder.setX(width); 633 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 634 int offset = random.nextInt(arr_len); 635 int count = arr_len - offset; 636 alloc.copy1DRangeFrom(offset, count, inArray); 637 alloc.copy1DRangeToUnchecked(offset, count, outArray); 638 639 boolean result = true; 640 for (int i = 0; i < count; i++) { 641 if (inArray[i] != outArray[i]) { 642 result = false; 643 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 644 break; 645 } 646 } 647 for (int i = count; i < arr_len; i++) { 648 if (outArray[i] != 0) { 649 result = false; 650 android.util.Log.v("Allocation CopyTo Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 651 break; 652 } 653 } 654 if (result) { 655 android.util.Log.v("Allocation CopyTo Test", "copy1DRangeToUnchecked_Long TEST PASSED"); 656 } else { 657 failTest(); 658 } 659 } 660} 661