Home | History | Annotate | Download | only in xor_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.xor_int_lit16;
     18 
     19 import dot.junit.DxTestCase;
     20 import dot.junit.DxUtil;
     21 import dot.junit.opcodes.xor_int_lit16.d.T_xor_int_lit16_1;
     22 import dot.junit.opcodes.xor_int_lit16.d.T_xor_int_lit16_2;
     23 import dot.junit.opcodes.xor_int_lit16.d.T_xor_int_lit16_3;
     24 import dot.junit.opcodes.xor_int_lit16.d.T_xor_int_lit16_4;
     25 import dot.junit.opcodes.xor_int_lit16.d.T_xor_int_lit16_7;
     26 
     27 public class Test_xor_int_lit16 extends DxTestCase {
     28     /**
     29      * @title Arguments = 15, 8
     30      */
     31     public void testN1() {
     32          T_xor_int_lit16_1 t = new T_xor_int_lit16_1();
     33          assertEquals(7, t.run());
     34      }
     35 
     36     /**
     37      * @title Arguments = 0xfffffff8, 0xfff1
     38      */
     39     public void testN2() {
     40          T_xor_int_lit16_2 t = new T_xor_int_lit16_2();
     41          assertEquals(9, t.run());
     42      }
     43 
     44     /**
     45      * @title Arguments = 0, -1
     46      */
     47     public void testB1() {
     48         T_xor_int_lit16_3 t = new T_xor_int_lit16_3();
     49             assertEquals(-1, t.run());
     50     }
     51 
     52     /**
     53      * @title Arguments = Integer.MAX_VALUE, Short.MIN_VALUE
     54      */
     55     public void testB2() {
     56         T_xor_int_lit16_4 t = new T_xor_int_lit16_4();
     57             assertEquals(-2147450881, t.run());
     58     }
     59 
     60 
     61 
     62 
     63     /**
     64      * @constraint B1
     65      * @title types of arguments - long & int
     66      */
     67     public void testVFE1() {
     68         try {
     69             Class.forName("dot.junit.opcodes.xor_int_lit16.d.T_xor_int_lit16_5");
     70             fail("expected a verification exception");
     71         } catch (Throwable t) {
     72             DxUtil.checkVerifyException(t);
     73         }
     74     }
     75 
     76     /**
     77      * @constraint B1
     78      * @title  types of arguments - reference & int
     79      */
     80     public void testVFE2() {
     81         try {
     82             Class.forName("dot.junit.opcodes.xor_int_lit16.d.T_xor_int_lit16_6");
     83             fail("expected a verification exception");
     84         } catch (Throwable t) {
     85             DxUtil.checkVerifyException(t);
     86         }
     87     }
     88 
     89     /**
     90      * @constraint A23
     91      * @title  number of registers
     92      */
     93     public void testVFE3() {
     94         try {
     95             Class.forName("dot.junit.opcodes.xor_int_lit16.d.T_xor_int_lit16_8");
     96             fail("expected a verification exception");
     97         } catch (Throwable t) {
     98             DxUtil.checkVerifyException(t);
     99         }
    100     }
    101 
    102     /**
    103      * @constraint B1
    104      * @title Type of argument - float. The verifier checks that ints
    105      * and floats are not used interchangeably.
    106      */
    107     public void testVFE4() {
    108         try {
    109             Class.forName("dot.junit.opcodes.xor_int_lit16.d.T_xor_int_lit16_7");
    110             fail("expected a verification exception");
    111         } catch (Throwable t) {
    112             DxUtil.checkVerifyException(t);
    113         }
    114     }
    115 }
    116