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