Home | History | Annotate | Download | only in xor_int_lit8
      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_lit8;
     18 
     19 import dot.junit.DxTestCase;
     20 import dot.junit.DxUtil;
     21 import dot.junit.opcodes.xor_int_lit8.d.T_xor_int_lit8_1;
     22 import dot.junit.opcodes.xor_int_lit8.d.T_xor_int_lit8_2;
     23 import dot.junit.opcodes.xor_int_lit8.d.T_xor_int_lit8_3;
     24 import dot.junit.opcodes.xor_int_lit8.d.T_xor_int_lit8_4;
     25 import dot.junit.opcodes.xor_int_lit8.d.T_xor_int_lit8_7;
     26 
     27 public class Test_xor_int_lit8 extends DxTestCase {
     28     /**
     29      * @title Arguments = 15, 8
     30      */
     31     public void testN1() {
     32          T_xor_int_lit8_1 t = new T_xor_int_lit8_1();
     33          assertEquals(7, t.run());
     34      }
     35 
     36     /**
     37      * @title Arguments = 0xfffffff8, 0xf1
     38      */
     39     public void testN2() {
     40          T_xor_int_lit8_2 t = new T_xor_int_lit8_2();
     41          assertEquals(9, t.run());
     42      }
     43 
     44     /**
     45      * @title Type of argument - float. Dalvik doens't distinguish 32-bits types internally,
     46      * so this (float ^ int) makes no sense but shall not crash the VM.
     47      */
     48     public void testN3() {
     49         T_xor_int_lit8_7 t = new T_xor_int_lit8_7();
     50         try {
     51             t.run(3.14f);
     52         } catch (Throwable e) {
     53         }
     54     }
     55 
     56     /**
     57      * @title Arguments = 0, -1
     58      */
     59     public void testB1() {
     60         T_xor_int_lit8_3 t = new T_xor_int_lit8_3();
     61             assertEquals(-1, t.run());
     62     }
     63 
     64     /**
     65      * @title Arguments = Integer.MAX_VALUE, Byte.MIN_VALUE
     66      */
     67     public void testB2() {
     68         T_xor_int_lit8_4 t = new T_xor_int_lit8_4();
     69             assertEquals(-2147483521, t.run());
     70     }
     71 
     72 
     73 
     74     /**
     75      * @constraint B1
     76      * @title types of arguments - long, int
     77      */
     78     public void testVFE1() {
     79         try {
     80             Class.forName("dot.junit.opcodes.xor_int_lit8.d.T_xor_int_lit8_5");
     81             fail("expected a verification exception");
     82         } catch (Throwable t) {
     83             DxUtil.checkVerifyException(t);
     84         }
     85     }
     86 
     87     /**
     88      * @constraint B1
     89      * @title  types of arguments - reference, int
     90      */
     91     public void testVFE2() {
     92         try {
     93             Class.forName("dot.junit.opcodes.xor_int_lit8.d.T_xor_int_lit8_6");
     94             fail("expected a verification exception");
     95         } catch (Throwable t) {
     96             DxUtil.checkVerifyException(t);
     97         }
     98     }
     99 
    100     /**
    101      * @constraint A23
    102      * @title  number of registers
    103      */
    104     public void testVFE3() {
    105         try {
    106             Class.forName("dot.junit.opcodes.xor_int_lit8.d.T_xor_int_lit8_8");
    107             fail("expected a verification exception");
    108         } catch (Throwable t) {
    109             DxUtil.checkVerifyException(t);
    110         }
    111     }
    112 }
    113