Home | History | Annotate | Download | only in add_int
      1 /*
      2  * Copyright (C) 2008 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 package android.vm.cts.opcodes.add_int;
     17 
     18 import junit.framework.TestCase;
     19 
     20 public class AddIntTest extends TestCase {
     21     /**
     22      * @title Arguments = 8, 4
     23      */
     24     public void testN1() {
     25         AddInt_1 t = new AddInt_1();
     26         assertEquals(12, t.run(8, 4));
     27     }
     28 
     29     /**
     30      * @title Arguments = 0, 255
     31      */
     32     public void testN2() {
     33         AddInt_1 t = new AddInt_1();
     34         assertEquals(255, t.run(0, 255));
     35     }
     36 
     37     /**
     38      * @title Arguments = 0, -65536
     39      */
     40     public void testN3() {
     41         AddInt_1 t = new AddInt_1();
     42         assertEquals(-65536, t.run(0, -65536));
     43     }
     44 
     45     /**
     46      * @title Arguments = 0, -2147483647
     47      */
     48     public void testN4() {
     49         AddInt_1 t = new AddInt_1();
     50         assertEquals(-2147483647, t.run(0, -2147483647));
     51     }
     52 
     53     /**
     54      * @title Arguments = 0x7ffffffe, 2
     55      */
     56     public void testN5() {
     57         AddInt_1 t = new AddInt_1();
     58         assertEquals(-2147483648, t.run(0x7ffffffe, 2));
     59     }
     60 
     61     /**
     62      * @title Arguments = -1, 1
     63      */
     64     public void testN6() {
     65         AddInt_1 t = new AddInt_1();
     66         assertEquals(0, t.run(-1, 1));
     67     }
     68 
     69 
     70     /**
     71      * @title Arguments = 0, Integer.MAX_VALUE
     72      */
     73     public void testB1() {
     74         AddInt_1 t = new AddInt_1();
     75         assertEquals(Integer.MAX_VALUE, t.run(0, Integer.MAX_VALUE));
     76     }
     77 
     78     /**
     79      * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE
     80      */
     81     public void testB2() {
     82         AddInt_1 t = new AddInt_1();
     83         assertEquals(-2, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE));
     84     }
     85 
     86     /**
     87      * @title Arguments = Integer.MAX_VALUE, 1
     88      */
     89     public void testB3() {
     90         AddInt_1 t = new AddInt_1();
     91         assertEquals(Integer.MIN_VALUE, t.run(Integer.MAX_VALUE, 1));
     92     }
     93 
     94     /**
     95      * @title Arguments = Integer.MIN_VALUE, 1
     96      */
     97     public void testB4() {
     98         AddInt_1 t = new AddInt_1();
     99         assertEquals(-2147483647, t.run(Integer.MIN_VALUE, 1));
    100     }
    101 
    102     /**
    103      * @title Arguments = 0, 0
    104      */
    105     public void testB5() {
    106         AddInt_1 t = new AddInt_1();
    107         assertEquals(0, t.run(0, 0));
    108     }
    109 
    110     /**
    111      * @title Arguments = Integer.MIN_VALUE, Integer.MIN_VALUE
    112      */
    113     public void testB6() {
    114         AddInt_1 t = new AddInt_1();
    115         assertEquals(0, t.run(Integer.MIN_VALUE, Integer.MIN_VALUE));
    116     }
    117 
    118 }
    119