Home | History | Annotate | Download | only in add_int_lit16
      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 
     17 package dot.junit.opcodes.add_int_lit16;
     18 
     19 import dot.junit.DxTestCase;
     20 import dot.junit.DxUtil;
     21 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_16;
     22 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_5;
     23 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_1;
     24 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_10;
     25 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_11;
     26 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_12;
     27 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_2;
     28 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_3;
     29 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_4;
     30 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_6;
     31 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_7;
     32 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_8;
     33 import dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_9;
     34 
     35 public class Test_add_int_lit16 extends DxTestCase {
     36     /**
     37      * @title Arguments = 8 + 4
     38      */
     39     public void testN1() {
     40         T_add_int_lit16_1 t = new T_add_int_lit16_1();
     41         assertEquals(12, t.run());
     42     }
     43 
     44     /**
     45      * @title Arguments = 0 + 255
     46      */
     47     public void testN2() {
     48         T_add_int_lit16_2 t = new T_add_int_lit16_2();
     49         assertEquals(255, t.run());
     50     }
     51 
     52     /**
     53      * @title Arguments = 0 + (-32768)
     54      */
     55     public void testN3() {
     56         T_add_int_lit16_3 t = new T_add_int_lit16_3();
     57         assertEquals(-32768, t.run());
     58     }
     59 
     60     /**
     61      * @title Arguments = (-2147483647) + 0
     62      */
     63     public void testN4() {
     64         T_add_int_lit16_4 t = new T_add_int_lit16_4();
     65         assertEquals(-2147483647, t.run());
     66     }
     67 
     68     /**
     69      * @title Arguments = 0x7ffffffe + 2
     70      */
     71     public void testN5() {
     72         T_add_int_lit16_5 t = new T_add_int_lit16_5();
     73         assertEquals(-2147483648, t.run());
     74     }
     75 
     76     /**
     77      * @title Arguments = -1 + 1
     78      */
     79     public void testN6() {
     80         T_add_int_lit16_6 t = new T_add_int_lit16_6();
     81         assertEquals(0, t.run());
     82     }
     83 
     84     /**
     85      * @title Arguments = 0 + Short.MAX_VALUE
     86      */
     87     public void testB1() {
     88         T_add_int_lit16_7 t = new T_add_int_lit16_7();
     89         assertEquals(Short.MAX_VALUE, t.run());
     90     }
     91 
     92     /**
     93      * @title Arguments = Integer.MAX_VALUE + Short.MAX_VALUE
     94      */
     95     public void testB2() {
     96         T_add_int_lit16_8 t = new T_add_int_lit16_8();
     97         assertEquals(-2147450882, t.run());
     98     }
     99 
    100     /**
    101      * @title Arguments = Integer.MAX_VALUE + 1
    102      */
    103     public void testB3() {
    104         T_add_int_lit16_9 t = new T_add_int_lit16_9();
    105         assertEquals(Integer.MIN_VALUE, t.run());
    106     }
    107 
    108     /**
    109      * @title Arguments = Integer.MIN_VALUE + 1
    110      */
    111     public void testB4() {
    112         T_add_int_lit16_10 t = new T_add_int_lit16_10();
    113         assertEquals(-2147483647, t.run());
    114     }
    115 
    116     /**
    117      * @title Arguments = 0 + 0
    118      */
    119     public void testB5() {
    120         T_add_int_lit16_11 t = new T_add_int_lit16_11();
    121         assertEquals(0, t.run());
    122     }
    123 
    124     /**
    125      * @title Arguments = Short.MIN_VALUE + Short.MIN_VALUE
    126      */
    127     public void testB6() {
    128         T_add_int_lit16_12 t = new T_add_int_lit16_12();
    129         assertEquals(-65536, t.run());
    130     }
    131 
    132 
    133 
    134 
    135     /**
    136      * @constraint B1
    137      * @title types of arguments - int, double
    138      */
    139     public void testVFE1() {
    140         load("dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_13", VerifyError.class);
    141     }
    142 
    143     /**
    144      * @constraint B1
    145      * @title types of arguments - long, int
    146      */
    147     public void testVFE2() {
    148         load("dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_14", VerifyError.class);
    149     }
    150 
    151     /**
    152      * @constraint B1
    153      * @title types of arguments - reference, int
    154      */
    155     public void testVFE3() {
    156         load("dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_15", VerifyError.class);
    157     }
    158 
    159     /**
    160      * @constraint A23
    161      * @title  number of registers
    162      */
    163     public void testVFE4() {
    164         load("dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_17", VerifyError.class);
    165     }
    166 
    167     /**
    168      * @constraint B1
    169      * @title Types of arguments - int, float. The verifier checks that ints
    170      * and floats are not used interchangeably.
    171      */
    172     public void testVFE5() {
    173         load("dot.junit.opcodes.add_int_lit16.d.T_add_int_lit16_16", VerifyError.class);
    174     }
    175 }
    176