1/* 2 * Copyright (C) 2015 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.test_compatlegacy; 18 19import android.content.Context; 20import android.content.res.Resources; 21import android.support.v8.renderscript.*; 22import java.util.Random; 23 24public class UT_alloc_copyPadded extends UnitTest { 25 private Resources mRes; 26 27 protected UT_alloc_copyPadded(RSTestCore rstc, Resources res, Context ctx) { 28 super(rstc, "Allocation CopyTo Padded", ctx); 29 mRes = res; 30 } 31 32 public void run() { 33 RenderScript mRS = RenderScript.create(mCtx); 34 35 testAllocation_Byte3_1D(mRS); 36 testAllocation_Byte3_2D(mRS); 37 testAllocation_Byte3_3D(mRS); 38 39 testAllocation_Short3_1D(mRS); 40 testAllocation_Short3_2D(mRS); 41 testAllocation_Short3_3D(mRS); 42 43 testAllocation_Int3_1D(mRS); 44 testAllocation_Int3_2D(mRS); 45 testAllocation_Int3_3D(mRS); 46 47 testAllocation_Float3_1D(mRS); 48 testAllocation_Float3_2D(mRS); 49 testAllocation_Float3_3D(mRS); 50 51 testAllocation_Double3_1D(mRS); 52 testAllocation_Double3_2D(mRS); 53 testAllocation_Double3_3D(mRS); 54 55 testAllocation_Long3_1D(mRS); 56 testAllocation_Long3_2D(mRS); 57 testAllocation_Long3_3D(mRS); 58 59 60 testAllocation_copy1DRangeTo_Byte3(mRS); 61 testAllocation_copy1DRangeTo_Short3(mRS); 62 testAllocation_copy1DRangeTo_Int3(mRS); 63 testAllocation_copy1DRangeTo_Float3(mRS); 64 testAllocation_copy1DRangeTo_Long3(mRS); 65 66 testAllocation_copy2DRangeTo_Byte3(mRS); 67 testAllocation_copy2DRangeTo_Short3(mRS); 68 testAllocation_copy2DRangeTo_Int3(mRS); 69 testAllocation_copy2DRangeTo_Float3(mRS); 70 testAllocation_copy2DRangeTo_Long3(mRS); 71 72 testAllocation_copy1DRangeToUnchecked_Byte3(mRS); 73 testAllocation_copy1DRangeToUnchecked_Short3(mRS); 74 testAllocation_copy1DRangeToUnchecked_Int3(mRS); 75 testAllocation_copy1DRangeToUnchecked_Float3(mRS); 76 testAllocation_copy1DRangeToUnchecked_Long3(mRS); 77 78 mRS.destroy(); 79 passTest(); 80 } 81 82 public void testAllocation_Byte3_1D(RenderScript mRS) { 83 Random random = new Random(0x172d8ab9); 84 int width = random.nextInt(512); 85 int arr_len = width * 3; 86 87 byte[] inArray = new byte[arr_len]; 88 byte[] outArray = new byte[arr_len]; 89 random.nextBytes(inArray); 90 91 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I8_3(mRS)); 92 typeBuilder.setX(width); 93 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 94 alloc.setAutoPadding(true); 95 alloc.copyFrom(inArray); 96 alloc.copyTo(outArray); 97 98 boolean result = true; 99 for (int i = 0; i < arr_len; i++) { 100 if (inArray[i] != outArray[i]) { 101 result = false; 102 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 103 break; 104 } 105 } 106 if (result) { 107 android.util.Log.v("Alloc Padding Test", "Byte1D TEST PASSED"); 108 } else { 109 failTest(); 110 } 111 } 112 113 public void testAllocation_Byte3_2D(RenderScript mRS) { 114 Random random = new Random(0x172d8ab9); 115 int width = random.nextInt(128); 116 int height = random.nextInt(128); 117 int arr_len = width * height * 3; 118 119 byte[] inArray = new byte[arr_len]; 120 byte[] outArray = new byte[arr_len]; 121 random.nextBytes(inArray); 122 123 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I8_3(mRS)); 124 typeBuilder.setX(width).setY(height); 125 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 126 alloc.setAutoPadding(true); 127 alloc.copyFrom(inArray); 128 alloc.copyTo(outArray); 129 130 boolean result = true; 131 for (int i = 0; i < arr_len; i++) { 132 if (inArray[i] != outArray[i]) { 133 result = false; 134 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 135 break; 136 } 137 } 138 if (result) { 139 android.util.Log.v("Alloc Padding Test", "Byte2D TEST PASSED"); 140 } else { 141 failTest(); 142 } 143 } 144 145 public void testAllocation_Byte3_3D(RenderScript mRS) { 146 Random random = new Random(0x172d8ab9); 147 int w = random.nextInt(32); 148 int h = random.nextInt(32); 149 int d = random.nextInt(32); 150 int arr_len = w * d * h * 3; 151 152 byte[] inArray = new byte[arr_len]; 153 byte[] outArray = new byte[arr_len]; 154 random.nextBytes(inArray); 155 156 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I8_3(mRS)); 157 typeBuilder.setX(w).setY(h).setZ(d); 158 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 159 alloc.setAutoPadding(true); 160 alloc.copyFrom(inArray); 161 alloc.copyTo(outArray); 162 163 boolean result = true; 164 for (int i = 0; i < arr_len; i++) { 165 if (inArray[i] != outArray[i]) { 166 result = false; 167 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 168 break; 169 } 170 } 171 if (result) { 172 android.util.Log.v("Alloc Padding Test", "Byte3D TEST PASSED"); 173 } else { 174 failTest(); 175 } 176 } 177 178 public void testAllocation_Short3_1D(RenderScript mRS) { 179 Random random = new Random(0x172d8ab9); 180 int width = random.nextInt(512); 181 int arr_len = width * 3; 182 183 short[] inArray = new short[arr_len]; 184 short[] outArray = new short[arr_len]; 185 186 for (int i = 0; i < arr_len; i++) { 187 inArray[i] = (short)random.nextInt(); 188 } 189 190 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I16_3(mRS)); 191 typeBuilder.setX(width); 192 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 193 alloc.setAutoPadding(true); 194 alloc.copyFrom(inArray); 195 alloc.copyTo(outArray); 196 197 boolean result = true; 198 for (int i = 0; i < arr_len; i++) { 199 if (inArray[i] != outArray[i]) { 200 result = false; 201 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 202 break; 203 } 204 } 205 if (result) { 206 android.util.Log.v("Alloc Padding Test", "Short1D TEST PASSED"); 207 } else { 208 failTest(); 209 } 210 } 211 212 public void testAllocation_Short3_2D(RenderScript mRS) { 213 Random random = new Random(0x172d8ab9); 214 int width = random.nextInt(128); 215 int height = random.nextInt(128); 216 int arr_len = width * height * 3; 217 218 short[] inArray = new short[arr_len]; 219 short[] outArray = new short[arr_len]; 220 221 for (int i = 0; i < arr_len; i++) { 222 inArray[i] = (short)random.nextInt(); 223 } 224 225 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I16_3(mRS)); 226 typeBuilder.setX(width).setY(height); 227 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 228 alloc.setAutoPadding(true); 229 alloc.copyFrom(inArray); 230 alloc.copyTo(outArray); 231 232 boolean result = true; 233 for (int i = 0; i < arr_len; i++) { 234 if (inArray[i] != outArray[i]) { 235 result = false; 236 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 237 break; 238 } 239 } 240 if (result) { 241 android.util.Log.v("Alloc Padding Test", "Short2D TEST PASSED"); 242 } else { 243 failTest(); 244 } 245 } 246 247 public void testAllocation_Short3_3D(RenderScript mRS) { 248 Random random = new Random(0x172d8ab9); 249 int w = random.nextInt(32); 250 int h = random.nextInt(32); 251 int d = random.nextInt(32); 252 int arr_len = w * d * h * 3; 253 254 short[] inArray = new short[arr_len]; 255 short[] outArray = new short[arr_len]; 256 257 for (int i = 0; i < arr_len; i++) { 258 inArray[i] = (short)random.nextInt(); 259 } 260 261 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I16_3(mRS)); 262 typeBuilder.setX(w).setY(h).setZ(d); 263 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 264 alloc.setAutoPadding(true); 265 alloc.copyFrom(inArray); 266 alloc.copyTo(outArray); 267 268 boolean result = true; 269 for (int i = 0; i < arr_len; i++) { 270 if (inArray[i] != outArray[i]) { 271 result = false; 272 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 273 break; 274 } 275 } 276 if (result) { 277 android.util.Log.v("Alloc Padding Test", "Short3D TEST PASSED"); 278 } else { 279 failTest(); 280 } 281 } 282 283 public void testAllocation_Int3_1D(RenderScript mRS) { 284 Random random = new Random(0x172d8ab9); 285 int width = random.nextInt(512); 286 int arr_len = width * 3; 287 288 int[] inArray = new int[arr_len]; 289 int[] outArray = new int[arr_len]; 290 291 for (int i = 0; i < arr_len; i++) { 292 inArray[i] = random.nextInt(); 293 } 294 295 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I32_3(mRS)); 296 typeBuilder.setX(width); 297 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 298 alloc.setAutoPadding(true); 299 alloc.copyFrom(inArray); 300 alloc.copyTo(outArray); 301 302 boolean result = true; 303 for (int i = 0; i < arr_len; i++) { 304 if (inArray[i] != outArray[i]) { 305 result = false; 306 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 307 break; 308 } 309 } 310 if (result) { 311 android.util.Log.v("Alloc Padding Test", "Int1D TEST PASSED"); 312 } else { 313 failTest(); 314 } 315 } 316 317 public void testAllocation_Int3_2D(RenderScript mRS) { 318 Random random = new Random(0x172d8ab9); 319 int width = random.nextInt(128); 320 int height = random.nextInt(128); 321 int arr_len = width * height * 3; 322 323 int[] inArray = new int[arr_len]; 324 int[] outArray = new int[arr_len]; 325 326 for (int i = 0; i < arr_len; i++) { 327 inArray[i] = random.nextInt(); 328 } 329 330 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I32_3(mRS)); 331 typeBuilder.setX(width).setY(height); 332 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 333 alloc.setAutoPadding(true); 334 alloc.copyFrom(inArray); 335 alloc.copyTo(outArray); 336 337 boolean result = true; 338 for (int i = 0; i < arr_len; i++) { 339 if (inArray[i] != outArray[i]) { 340 result = false; 341 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 342 break; 343 } 344 } 345 if (result) { 346 android.util.Log.v("Alloc Padding Test", "Int2D TEST PASSED"); 347 } else { 348 failTest(); 349 } 350 } 351 352 public void testAllocation_Int3_3D(RenderScript mRS) { 353 Random random = new Random(0x172d8ab9); 354 int w = random.nextInt(32); 355 int h = random.nextInt(32); 356 int d = random.nextInt(32); 357 int arr_len = w * d * h * 3; 358 359 int[] inArray = new int[arr_len]; 360 int[] outArray = new int[arr_len]; 361 362 for (int i = 0; i < arr_len; i++) { 363 inArray[i] = random.nextInt(); 364 } 365 366 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I32_3(mRS)); 367 typeBuilder.setX(w).setY(h).setZ(d); 368 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 369 alloc.setAutoPadding(true); 370 alloc.copyFrom(inArray); 371 alloc.copyTo(outArray); 372 373 boolean result = true; 374 for (int i = 0; i < arr_len; i++) { 375 if (inArray[i] != outArray[i]) { 376 result = false; 377 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 378 break; 379 } 380 } 381 if (result) { 382 android.util.Log.v("Alloc Padding Test", "Int3D TEST PASSED"); 383 } else { 384 failTest(); 385 } 386 } 387 388 public void testAllocation_Float3_1D(RenderScript mRS) { 389 Random random = new Random(0x172d8ab9); 390 int width = random.nextInt(512); 391 int arr_len = width * 3; 392 393 float[] inArray = new float[arr_len]; 394 float[] outArray = new float[arr_len]; 395 396 for (int i = 0; i < arr_len; i++) { 397 inArray[i] = random.nextFloat(); 398 } 399 400 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F32_3(mRS)); 401 typeBuilder.setX(width); 402 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 403 alloc.setAutoPadding(true); 404 alloc.copyFrom(inArray); 405 alloc.copyTo(outArray); 406 407 boolean result = true; 408 for (int i = 0; i < arr_len; i++) { 409 if (inArray[i] != outArray[i]) { 410 result = false; 411 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 412 break; 413 } 414 } 415 if (result) { 416 android.util.Log.v("Alloc Padding Test", "Float1D TEST PASSED"); 417 } else { 418 failTest(); 419 } 420 } 421 public void testAllocation_Float3_2D(RenderScript mRS) { 422 Random random = new Random(0x172d8ab9); 423 int width = random.nextInt(128); 424 int height = random.nextInt(128); 425 int arr_len = width * height * 3; 426 427 float[] inArray = new float[arr_len]; 428 float[] outArray = new float[arr_len]; 429 430 for (int i = 0; i < arr_len; i++) { 431 inArray[i] = random.nextFloat(); 432 } 433 434 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F32_3(mRS)); 435 typeBuilder.setX(width).setY(height); 436 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 437 alloc.setAutoPadding(true); 438 alloc.copyFrom(inArray); 439 alloc.copyTo(outArray); 440 441 boolean result = true; 442 for (int i = 0; i < arr_len; i++) { 443 if (inArray[i] != outArray[i]) { 444 result = false; 445 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 446 break; 447 } 448 } 449 if (result) { 450 android.util.Log.v("Alloc Padding Test", "Float2D TEST PASSED"); 451 } else { 452 failTest(); 453 } 454 } 455 public void testAllocation_Float3_3D(RenderScript mRS) { 456 Random random = new Random(0x172d8ab9); 457 int w = random.nextInt(32); 458 int h = random.nextInt(32); 459 int d = random.nextInt(32); 460 int arr_len = w * d * h * 3; 461 462 float[] inArray = new float[arr_len]; 463 float[] outArray = new float[arr_len]; 464 465 for (int i = 0; i < arr_len; i++) { 466 inArray[i] = random.nextFloat(); 467 } 468 469 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F32_3(mRS)); 470 typeBuilder.setX(w).setY(h).setZ(d); 471 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 472 alloc.setAutoPadding(true); 473 alloc.copyFrom(inArray); 474 alloc.copyTo(outArray); 475 476 boolean result = true; 477 for (int i = 0; i < arr_len; i++) { 478 if (inArray[i] != outArray[i]) { 479 result = false; 480 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 481 break; 482 } 483 } 484 if (result) { 485 android.util.Log.v("Alloc Padding Test", "Float3D TEST PASSED"); 486 } else { 487 failTest(); 488 } 489 } 490 491 public void testAllocation_Double3_1D(RenderScript mRS) { 492 Random random = new Random(0x172d8ab9); 493 int width = random.nextInt(512); 494 int arr_len = width * 3; 495 496 double[] inArray = new double[arr_len]; 497 double[] outArray = new double[arr_len]; 498 499 for (int i = 0; i < arr_len; i++) { 500 inArray[i] = (double)random.nextFloat(); 501 } 502 503 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F64_3(mRS)); 504 typeBuilder.setX(width); 505 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 506 alloc.setAutoPadding(true); 507 alloc.copyFrom(inArray); 508 alloc.copyTo(outArray); 509 510 boolean result = true; 511 for (int i = 0; i < arr_len; i++) { 512 if (inArray[i] != outArray[i]) { 513 result = false; 514 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 515 break; 516 } 517 } 518 if (result) { 519 android.util.Log.v("Alloc Padding Test", "Double1D TEST PASSED"); 520 } else { 521 failTest(); 522 } 523 } 524 public void testAllocation_Double3_2D(RenderScript mRS) { 525 Random random = new Random(0x172d8ab9); 526 int width = random.nextInt(128); 527 int height = random.nextInt(128); 528 int arr_len = width * height * 3; 529 530 double[] inArray = new double[arr_len]; 531 double[] outArray = new double[arr_len]; 532 533 for (int i = 0; i < arr_len; i++) { 534 inArray[i] = (double)random.nextFloat(); 535 } 536 537 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F64_3(mRS)); 538 typeBuilder.setX(width).setY(height); 539 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 540 alloc.setAutoPadding(true); 541 alloc.copyFrom(inArray); 542 alloc.copyTo(outArray); 543 544 boolean result = true; 545 for (int i = 0; i < arr_len; i++) { 546 if (inArray[i] != outArray[i]) { 547 result = false; 548 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 549 break; 550 } 551 } 552 if (result) { 553 android.util.Log.v("Alloc Padding Test", "Double2D TEST PASSED"); 554 } else { 555 failTest(); 556 } 557 } 558 public void testAllocation_Double3_3D(RenderScript mRS) { 559 Random random = new Random(0x172d8ab9); 560 int w = random.nextInt(32); 561 int h = random.nextInt(32); 562 int d = random.nextInt(32); 563 int arr_len = w * d * h * 3; 564 565 double[] inArray = new double[arr_len]; 566 double[] outArray = new double[arr_len]; 567 568 for (int i = 0; i < arr_len; i++) { 569 inArray[i] = (double)random.nextFloat(); 570 } 571 572 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F64_3(mRS)); 573 typeBuilder.setX(w).setY(h).setZ(d); 574 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 575 alloc.setAutoPadding(true); 576 alloc.copyFrom(inArray); 577 alloc.copyTo(outArray); 578 579 boolean result = true; 580 for (int i = 0; i < arr_len; i++) { 581 if (inArray[i] != outArray[i]) { 582 result = false; 583 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 584 break; 585 } 586 } 587 if (result) { 588 android.util.Log.v("Alloc Padding Test", "Double3D TEST PASSED"); 589 } else { 590 failTest(); 591 } 592 } 593 594 public void testAllocation_Long3_1D(RenderScript mRS) { 595 Random random = new Random(0x172d8ab9); 596 int width = random.nextInt(512); 597 int arr_len = width * 3; 598 599 long[] inArray = new long[arr_len]; 600 long[] outArray = new long[arr_len]; 601 602 for (int i = 0; i < arr_len; i++) { 603 inArray[i] = random.nextLong(); 604 } 605 606 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I64_3(mRS)); 607 typeBuilder.setX(width); 608 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 609 alloc.setAutoPadding(true); 610 alloc.copyFrom(inArray); 611 alloc.copyTo(outArray); 612 613 boolean result = true; 614 for (int i = 0; i < arr_len; i++) { 615 if (inArray[i] != outArray[i]) { 616 result = false; 617 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 618 break; 619 } 620 } 621 if (result) { 622 android.util.Log.v("Alloc Padding Test", "Long1D TEST PASSED"); 623 } else { 624 failTest(); 625 } 626 } 627 628 public void testAllocation_Long3_2D(RenderScript mRS) { 629 Random random = new Random(0x172d8ab9); 630 int width = random.nextInt(128); 631 int height = random.nextInt(128); 632 int arr_len = width * height * 3; 633 634 long[] inArray = new long[arr_len]; 635 long[] outArray = new long[arr_len]; 636 637 for (int i = 0; i < arr_len; i++) { 638 inArray[i] = random.nextLong(); 639 } 640 641 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I64_3(mRS)); 642 typeBuilder.setX(width).setY(height); 643 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 644 alloc.setAutoPadding(true); 645 alloc.copyFrom(inArray); 646 alloc.copyTo(outArray); 647 648 boolean result = true; 649 for (int i = 0; i < arr_len; i++) { 650 if (inArray[i] != outArray[i]) { 651 result = false; 652 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 653 break; 654 } 655 } 656 if (result) { 657 android.util.Log.v("Alloc Padding Test", "Long2D TEST PASSED"); 658 } else { 659 failTest(); 660 } 661 } 662 663 public void testAllocation_Long3_3D(RenderScript mRS) { 664 Random random = new Random(0x172d8ab9); 665 int w = random.nextInt(32); 666 int h = random.nextInt(32); 667 int d = random.nextInt(32); 668 int arr_len = w * d * h * 3; 669 670 long[] inArray = new long[arr_len]; 671 long[] outArray = new long[arr_len]; 672 673 for (int i = 0; i < arr_len; i++) { 674 inArray[i] = random.nextLong(); 675 } 676 677 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I64_3(mRS)); 678 typeBuilder.setX(w).setY(h).setZ(d); 679 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 680 alloc.setAutoPadding(true); 681 alloc.copyFrom(inArray); 682 alloc.copyTo(outArray); 683 684 boolean result = true; 685 for (int i = 0; i < arr_len; i++) { 686 if (inArray[i] != outArray[i]) { 687 result = false; 688 android.util.Log.v("Alloc Padding Test", "" + i + " " + inArray[i] + " " + outArray[i]); 689 break; 690 } 691 } 692 if (result) { 693 android.util.Log.v("Alloc Padding Test", "Long3D TEST PASSED"); 694 } else { 695 failTest(); 696 } 697 } 698 699 700 public void testAllocation_copy1DRangeTo_Byte3(RenderScript mRS) { 701 Random random = new Random(0x172d8ab9); 702 int width = random.nextInt(512); 703 int arr_len = width * 3; 704 705 byte[] inArray = new byte[arr_len]; 706 byte[] outArray = new byte[arr_len]; 707 random.nextBytes(inArray); 708 709 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I8_3(mRS)); 710 typeBuilder.setX(width); 711 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 712 alloc.setAutoPadding(true); 713 int offset = random.nextInt(width); 714 int count = width - offset; 715 alloc.copy1DRangeFrom(offset, count, inArray); 716 alloc.copy1DRangeTo(offset, count, outArray); 717 718 boolean result = true; 719 for (int i = 0; i < count * 3; i++) { 720 if (inArray[i] != outArray[i]) { 721 result = false; 722 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 723 break; 724 } 725 } 726 for (int i = count * 3; i < arr_len; i++) { 727 if (outArray[i] != 0) { 728 result = false; 729 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 730 break; 731 } 732 } 733 if (result) { 734 android.util.Log.v("Alloc Padding Test", "copy1DRangeTo_Byte TEST PASSED"); 735 } else { 736 failTest(); 737 } 738 } 739 740 public void testAllocation_copy1DRangeTo_Short3(RenderScript mRS) { 741 Random random = new Random(0x172d8ab9); 742 int width = random.nextInt(512); 743 int arr_len = width * 3; 744 745 short[] inArray = new short[arr_len]; 746 short[] outArray = new short[arr_len]; 747 748 for (int i = 0; i < arr_len; i++) { 749 inArray[i] = (short)random.nextInt(); 750 } 751 752 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I16_3(mRS)); 753 typeBuilder.setX(width); 754 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 755 alloc.setAutoPadding(true); 756 int offset = random.nextInt(width); 757 int count = width - offset; 758 alloc.copy1DRangeFrom(offset, count, inArray); 759 alloc.copy1DRangeTo(offset, count, outArray); 760 761 boolean result = true; 762 for (int i = 0; i < count * 3; i++) { 763 if (inArray[i] != outArray[i]) { 764 result = false; 765 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 766 break; 767 } 768 } 769 for (int i = count * 3; i < arr_len; i++) { 770 if (outArray[i] != 0) { 771 result = false; 772 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 773 break; 774 } 775 } 776 if (result) { 777 android.util.Log.v("Alloc Padding Test", "copy1DRangeTo_Short TEST PASSED"); 778 } else { 779 failTest(); 780 } 781 } 782 783 public void testAllocation_copy1DRangeTo_Int3(RenderScript mRS) { 784 Random random = new Random(0x172d8ab9); 785 int width = random.nextInt(512); 786 int arr_len = width * 3; 787 788 int[] inArray = new int[arr_len]; 789 int[] outArray = new int[arr_len]; 790 791 for (int i = 0; i < arr_len; i++) { 792 inArray[i] = random.nextInt(); 793 } 794 795 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I32_3(mRS)); 796 typeBuilder.setX(width); 797 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 798 alloc.setAutoPadding(true); 799 int offset = random.nextInt(width); 800 int count = width - offset; 801 alloc.copy1DRangeFrom(offset, count, inArray); 802 alloc.copy1DRangeTo(offset, count, outArray); 803 804 boolean result = true; 805 for (int i = 0; i < count * 3; i++) { 806 if (inArray[i] != outArray[i]) { 807 result = false; 808 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 809 break; 810 } 811 } 812 for (int i = count * 3; i < arr_len; i++) { 813 if (outArray[i] != 0) { 814 result = false; 815 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 816 break; 817 } 818 } 819 if (result) { 820 android.util.Log.v("Alloc Padding Test", "copy1DRangeTo_Int TEST PASSED"); 821 } else { 822 failTest(); 823 } 824 } 825 826 public void testAllocation_copy1DRangeTo_Float3(RenderScript mRS) { 827 Random random = new Random(0x172d8ab9); 828 int width = random.nextInt(512); 829 int arr_len = width * 3; 830 831 float[] inArray = new float[arr_len]; 832 float[] outArray = new float[arr_len]; 833 834 for (int i = 0; i < arr_len; i++) { 835 inArray[i] = random.nextFloat(); 836 } 837 838 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F32_3(mRS)); 839 typeBuilder.setX(width); 840 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 841 alloc.setAutoPadding(true); 842 int offset = random.nextInt(width); 843 int count = width - offset; 844 alloc.copy1DRangeFrom(offset, count, inArray); 845 alloc.copy1DRangeTo(offset, count, outArray); 846 847 boolean result = true; 848 for (int i = 0; i < count * 3; i++) { 849 if (inArray[i] != outArray[i]) { 850 result = false; 851 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 852 break; 853 } 854 } 855 for (int i = count * 3; i < arr_len; i++) { 856 if (outArray[i] != 0f) { 857 result = false; 858 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 859 break; 860 } 861 } 862 if (result) { 863 android.util.Log.v("Alloc Padding Test", "copy1DRangeTo_Float TEST PASSED"); 864 } else { 865 failTest(); 866 } 867 } 868 869 public void testAllocation_copy1DRangeTo_Long3(RenderScript mRS) { 870 Random random = new Random(0x172d8ab9); 871 int width = random.nextInt(512); 872 int arr_len = width * 3; 873 874 long[] inArray = new long[arr_len]; 875 long[] outArray = new long[arr_len]; 876 877 for (int i = 0; i < arr_len; i++) { 878 inArray[i] = random.nextLong(); 879 } 880 881 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I64_3(mRS)); 882 typeBuilder.setX(width); 883 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 884 alloc.setAutoPadding(true); 885 int offset = random.nextInt(width); 886 int count = width - offset; 887 alloc.copy1DRangeFrom(offset, count, inArray); 888 alloc.copy1DRangeTo(offset, count, outArray); 889 890 boolean result = true; 891 for (int i = 0; i < count * 3; i++) { 892 if (inArray[i] != outArray[i]) { 893 result = false; 894 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 895 break; 896 } 897 } 898 for (int i = count * 3; i < arr_len; i++) { 899 if (outArray[i] != 0) { 900 result = false; 901 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 902 break; 903 } 904 } 905 if (result) { 906 android.util.Log.v("Alloc Padding Test", "copy1DRangeTo_Long TEST PASSED"); 907 } else { 908 failTest(); 909 } 910 } 911 912 public void testAllocation_copy2DRangeTo_Byte3(RenderScript mRS) { 913 Random random = new Random(0x172d8ab9); 914 int width = random.nextInt(128); 915 int height = random.nextInt(128); 916 int xoff = random.nextInt(width); 917 int yoff = random.nextInt(height); 918 int xcount = width - xoff; 919 int ycount = height - yoff; 920 int arr_len = xcount * ycount * 3; 921 922 byte[] inArray = new byte[arr_len]; 923 byte[] outArray = new byte[arr_len]; 924 random.nextBytes(inArray); 925 926 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I8_3(mRS)); 927 typeBuilder.setX(width).setY(height); 928 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 929 alloc.setAutoPadding(true); 930 alloc.copy2DRangeFrom(xoff, yoff, xcount, ycount, inArray); 931 alloc.copy2DRangeTo(xoff, yoff, xcount, ycount, outArray); 932 933 boolean result = true; 934 for (int i = 0; i < arr_len; i++) { 935 if (inArray[i] != outArray[i]) { 936 result = false; 937 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 938 break; 939 } 940 } 941 if (result) { 942 android.util.Log.v("Alloc Padding Test", "copy2DRangeTo_Byte TEST PASSED"); 943 } else { 944 failTest(); 945 } 946 } 947 948 public void testAllocation_copy2DRangeTo_Short3(RenderScript mRS) { 949 Random random = new Random(0x172d8ab9); 950 int width = random.nextInt(128); 951 int height = random.nextInt(128); 952 int xoff = random.nextInt(width); 953 int yoff = random.nextInt(height); 954 int xcount = width - xoff; 955 int ycount = height - yoff; 956 int arr_len = xcount * ycount * 3; 957 958 short[] inArray = new short[arr_len]; 959 short[] outArray = new short[arr_len]; 960 961 for (int i = 0; i < arr_len; i++) { 962 inArray[i] = (short)random.nextInt(); 963 } 964 965 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I16_3(mRS)); 966 typeBuilder.setX(width).setY(height); 967 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 968 alloc.setAutoPadding(true); 969 alloc.copy2DRangeFrom(xoff, yoff, xcount, ycount, inArray); 970 alloc.copy2DRangeTo(xoff, yoff, xcount, ycount, outArray); 971 972 boolean result = true; 973 for (int i = 0; i < arr_len; i++) { 974 if (inArray[i] != outArray[i]) { 975 result = false; 976 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 977 break; 978 } 979 } 980 if (result) { 981 android.util.Log.v("Alloc Padding Test", "copy2DRangeTo_Short TEST PASSED"); 982 } else { 983 failTest(); 984 } 985 } 986 987 public void testAllocation_copy2DRangeTo_Int3(RenderScript mRS) { 988 Random random = new Random(0x172d8ab9); 989 int width = random.nextInt(128); 990 int height = random.nextInt(128); 991 int xoff = random.nextInt(width); 992 int yoff = random.nextInt(height); 993 int xcount = width - xoff; 994 int ycount = height - yoff; 995 int arr_len = xcount * ycount * 3; 996 997 int[] inArray = new int[arr_len]; 998 int[] outArray = new int[arr_len]; 999 1000 for (int i = 0; i < arr_len; i++) { 1001 inArray[i] = random.nextInt(); 1002 } 1003 1004 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I32_3(mRS)); 1005 typeBuilder.setX(width).setY(height); 1006 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 1007 alloc.setAutoPadding(true); 1008 alloc.copy2DRangeFrom(xoff, yoff, xcount, ycount, inArray); 1009 alloc.copy2DRangeTo(xoff, yoff, xcount, ycount, outArray); 1010 1011 boolean result = true; 1012 for (int i = 0; i < arr_len; i++) { 1013 if (inArray[i] != outArray[i]) { 1014 result = false; 1015 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1016 break; 1017 } 1018 } 1019 if (result) { 1020 android.util.Log.v("Alloc Padding Test", "copy2DRangeTo_Int TEST PASSED"); 1021 } else { 1022 failTest(); 1023 } 1024 } 1025 1026 public void testAllocation_copy2DRangeTo_Float3(RenderScript mRS) { 1027 Random random = new Random(0x172d8ab9); 1028 int width = random.nextInt(128); 1029 int height = random.nextInt(128); 1030 int xoff = random.nextInt(width); 1031 int yoff = random.nextInt(height); 1032 int xcount = width - xoff; 1033 int ycount = height - yoff; 1034 int arr_len = xcount * ycount * 3; 1035 1036 float[] inArray = new float[arr_len]; 1037 float[] outArray = new float[arr_len]; 1038 1039 for (int i = 0; i < arr_len; i++) { 1040 inArray[i] = random.nextFloat(); 1041 } 1042 1043 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F32_3(mRS)); 1044 typeBuilder.setX(width).setY(height); 1045 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 1046 alloc.setAutoPadding(true); 1047 alloc.copy2DRangeFrom(xoff, yoff, xcount, ycount, inArray); 1048 alloc.copy2DRangeTo(xoff, yoff, xcount, ycount, outArray); 1049 1050 boolean result = true; 1051 for (int i = 0; i < arr_len; i++) { 1052 if (inArray[i] != outArray[i]) { 1053 result = false; 1054 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1055 break; 1056 } 1057 } 1058 if (result) { 1059 android.util.Log.v("Alloc Padding Test", "copy2DRangeTo_Float TEST PASSED"); 1060 } else { 1061 failTest(); 1062 } 1063 } 1064 1065 public void testAllocation_copy2DRangeTo_Long3(RenderScript mRS) { 1066 Random random = new Random(0x172d8ab9); 1067 int width = random.nextInt(128); 1068 int height = random.nextInt(128); 1069 int xoff = random.nextInt(width); 1070 int yoff = random.nextInt(height); 1071 int xcount = width - xoff; 1072 int ycount = height - yoff; 1073 int arr_len = xcount * ycount * 3; 1074 1075 long[] inArray = new long[arr_len]; 1076 long[] outArray = new long[arr_len]; 1077 1078 for (int i = 0; i < arr_len; i++) { 1079 inArray[i] = random.nextLong(); 1080 } 1081 1082 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I64_3(mRS)); 1083 typeBuilder.setX(width).setY(height); 1084 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 1085 alloc.setAutoPadding(true); 1086 alloc.copy2DRangeFrom(xoff, yoff, xcount, ycount, inArray); 1087 alloc.copy2DRangeTo(xoff, yoff, xcount, ycount, outArray); 1088 1089 boolean result = true; 1090 for (int i = 0; i < arr_len; i++) { 1091 if (inArray[i] != outArray[i]) { 1092 result = false; 1093 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1094 break; 1095 } 1096 } 1097 if (result) { 1098 android.util.Log.v("Alloc Padding Test", "copy2DRangeTo_Long TEST PASSED"); 1099 } else { 1100 failTest(); 1101 } 1102 } 1103 1104 1105 public void testAllocation_copy1DRangeToUnchecked_Byte3(RenderScript mRS) { 1106 Random random = new Random(0x172d8ab9); 1107 int width = random.nextInt(512); 1108 int arr_len = width * 3; 1109 1110 byte[] inArray = new byte[arr_len]; 1111 byte[] outArray = new byte[arr_len]; 1112 random.nextBytes(inArray); 1113 1114 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I8_3(mRS)); 1115 typeBuilder.setX(width); 1116 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 1117 alloc.setAutoPadding(true); 1118 int offset = random.nextInt(width); 1119 int count = width - offset; 1120 alloc.copy1DRangeFrom(offset, count, inArray); 1121 alloc.copy1DRangeToUnchecked(offset, count, outArray); 1122 1123 boolean result = true; 1124 for (int i = 0; i < count * 3; i++) { 1125 if (inArray[i] != outArray[i]) { 1126 result = false; 1127 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1128 break; 1129 } 1130 } 1131 for (int i = count * 3; i < arr_len; i++) { 1132 if (outArray[i] != 0) { 1133 result = false; 1134 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1135 break; 1136 } 1137 } 1138 if (result) { 1139 android.util.Log.v("Alloc Padding Test", "copy1DRangeToUnchecked_Byte TEST PASSED"); 1140 } else { 1141 failTest(); 1142 } 1143 } 1144 1145 public void testAllocation_copy1DRangeToUnchecked_Short3(RenderScript mRS) { 1146 Random random = new Random(0x172d8ab9); 1147 int width = random.nextInt(512); 1148 int arr_len = width * 3; 1149 1150 short[] inArray = new short[arr_len]; 1151 short[] outArray = new short[arr_len]; 1152 1153 for (int i = 0; i < arr_len; i++) { 1154 inArray[i] = (short)random.nextInt(); 1155 } 1156 1157 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I16_3(mRS)); 1158 typeBuilder.setX(width); 1159 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 1160 alloc.setAutoPadding(true); 1161 int offset = random.nextInt(width); 1162 int count = width - offset; 1163 alloc.copy1DRangeFrom(offset, count, inArray); 1164 alloc.copy1DRangeToUnchecked(offset, count, outArray); 1165 1166 boolean result = true; 1167 for (int i = 0; i < count * 3; i++) { 1168 if (inArray[i] != outArray[i]) { 1169 result = false; 1170 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1171 break; 1172 } 1173 } 1174 for (int i = count * 3; i < arr_len; i++) { 1175 if (outArray[i] != 0) { 1176 result = false; 1177 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1178 break; 1179 } 1180 } 1181 if (result) { 1182 android.util.Log.v("Alloc Padding Test", "copy1DRangeToUnchecked_Short TEST PASSED"); 1183 } else { 1184 failTest(); 1185 } 1186 } 1187 1188 public void testAllocation_copy1DRangeToUnchecked_Int3(RenderScript mRS) { 1189 Random random = new Random(0x172d8ab9); 1190 int width = random.nextInt(512); 1191 int arr_len = width * 3; 1192 1193 int[] inArray = new int[arr_len]; 1194 int[] outArray = new int[arr_len]; 1195 1196 for (int i = 0; i < arr_len; i++) { 1197 inArray[i] = random.nextInt(); 1198 } 1199 1200 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I32_3(mRS)); 1201 typeBuilder.setX(width); 1202 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 1203 alloc.setAutoPadding(true); 1204 int offset = random.nextInt(width); 1205 int count = width - offset; 1206 alloc.copy1DRangeFrom(offset, count, inArray); 1207 alloc.copy1DRangeToUnchecked(offset, count, outArray); 1208 1209 boolean result = true; 1210 for (int i = 0; i < count * 3; i++) { 1211 if (inArray[i] != outArray[i]) { 1212 result = false; 1213 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1214 break; 1215 } 1216 } 1217 for (int i = count * 3; i < arr_len; i++) { 1218 if (outArray[i] != 0) { 1219 result = false; 1220 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1221 break; 1222 } 1223 } 1224 if (result) { 1225 android.util.Log.v("Alloc Padding Test", "copy1DRangeToUnchecked_Int TEST PASSED"); 1226 } else { 1227 failTest(); 1228 } 1229 } 1230 1231 public void testAllocation_copy1DRangeToUnchecked_Float3(RenderScript mRS) { 1232 Random random = new Random(0x172d8ab9); 1233 int width = random.nextInt(512); 1234 int arr_len = width * 3; 1235 1236 float[] inArray = new float[arr_len]; 1237 float[] outArray = new float[arr_len]; 1238 1239 for (int i = 0; i < arr_len; i++) { 1240 inArray[i] = random.nextFloat(); 1241 } 1242 1243 Type.Builder typeBuilder = new Type.Builder(mRS, Element.F32_3(mRS)); 1244 typeBuilder.setX(width); 1245 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 1246 alloc.setAutoPadding(true); 1247 int offset = random.nextInt(width); 1248 int count = width - offset; 1249 alloc.copy1DRangeFrom(offset, count, inArray); 1250 alloc.copy1DRangeToUnchecked(offset, count, outArray); 1251 1252 boolean result = true; 1253 for (int i = 0; i < count * 3; i++) { 1254 if (inArray[i] != outArray[i]) { 1255 result = false; 1256 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1257 break; 1258 } 1259 } 1260 for (int i = count * 3; i < arr_len; i++) { 1261 if (outArray[i] != 0f) { 1262 result = false; 1263 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1264 break; 1265 } 1266 } 1267 if (result) { 1268 android.util.Log.v("Alloc Padding Test", "copy1DRangeToUnchecked_Float TEST PASSED"); 1269 } else { 1270 failTest(); 1271 } 1272 } 1273 1274 public void testAllocation_copy1DRangeToUnchecked_Long3(RenderScript mRS) { 1275 Random random = new Random(0x172d8ab9); 1276 int width = random.nextInt(512); 1277 int arr_len = width * 3; 1278 1279 long[] inArray = new long[arr_len]; 1280 long[] outArray = new long[arr_len]; 1281 1282 for (int i = 0; i < arr_len; i++) { 1283 inArray[i] = random.nextLong(); 1284 } 1285 1286 Type.Builder typeBuilder = new Type.Builder(mRS, Element.I64_3(mRS)); 1287 typeBuilder.setX(width); 1288 Allocation alloc = Allocation.createTyped(mRS, typeBuilder.create()); 1289 alloc.setAutoPadding(true); 1290 int offset = random.nextInt(width); 1291 int count = width - offset; 1292 alloc.copy1DRangeFrom(offset, count, inArray); 1293 alloc.copy1DRangeToUnchecked(offset, count, outArray); 1294 1295 boolean result = true; 1296 for (int i = 0; i < count * 3; i++) { 1297 if (inArray[i] != outArray[i]) { 1298 result = false; 1299 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1300 break; 1301 } 1302 } 1303 for (int i = count * 3; i < arr_len; i++) { 1304 if (outArray[i] != 0) { 1305 result = false; 1306 android.util.Log.v("Alloc Padding Test", "Failed: " + i + " " + inArray[i] + " " + outArray[i]); 1307 break; 1308 } 1309 } 1310 if (result) { 1311 android.util.Log.v("Alloc Padding Test", "copy1DRangeToUnchecked_Long TEST PASSED"); 1312 } else { 1313 failTest(); 1314 } 1315 } 1316} 1317