Home | History | Annotate | Download | only in if_icmpge
      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 dxc.junit.opcodes.if_icmpge;
     18 
     19 import dxc.junit.DxTestCase;
     20 import dxc.junit.DxUtil;
     21 import dxc.junit.opcodes.if_icmpge.jm.T_if_icmpge_1;
     22 
     23 public class Test_if_icmpge extends DxTestCase {
     24 
     25     /**
     26      * @title  Arguments = 5, 6
     27      */
     28     public void testN1() {
     29         T_if_icmpge_1 t = new T_if_icmpge_1();
     30         /*
     31          * Compare with 1234 to check that in case of failed comparison
     32          * execution proceeds at the address following if_acmpeq instruction
     33          */
     34         assertEquals(1234, t.run(5, 6));
     35     }
     36 
     37     /**
     38      * @title  Arguments = 0x0f0e0d0c, 0x0f0e0d0c
     39      */
     40     public void testN2() {
     41         T_if_icmpge_1 t = new T_if_icmpge_1();
     42         assertEquals(1, t.run(0x0f0e0d0c, 0x0f0e0d0c));
     43     }
     44 
     45     /**
     46      * @title  Arguments = 5, -5
     47      */
     48     public void testN3() {
     49         T_if_icmpge_1 t = new T_if_icmpge_1();
     50         assertEquals(1, t.run(5, -5));
     51     }
     52 
     53     /**
     54      * @title  Arguments = 0x0f0e0d0d, 0x0f0e0d0c
     55      */
     56     public void testN4() {
     57         T_if_icmpge_1 t = new T_if_icmpge_1();
     58         assertEquals(1, t.run(0x0f0e0d0d, 0x0f0e0d0c));
     59     }
     60 
     61     /**
     62      * @title  Arguments = 0x1234, 0x01001234
     63      */
     64     public void testN5() {
     65         T_if_icmpge_1 t = new T_if_icmpge_1();
     66         assertEquals(1234, t.run(0x1234, 0x01001234));
     67     }
     68 
     69     /**
     70      * @title  Arguments = -5, 5
     71      */
     72     public void testN6() {
     73         T_if_icmpge_1 t = new T_if_icmpge_1();
     74         assertEquals(1234, t.run(-5, 5));
     75     }
     76 
     77     /**
     78      * @title  Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE
     79      */
     80     public void testB1() {
     81         T_if_icmpge_1 t = new T_if_icmpge_1();
     82         assertEquals(1, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE));
     83     }
     84 
     85     /**
     86      * @title  Arguments = Integer.MIN_VALUE, Integer.MIN_VALUE
     87      */
     88     public void testB2() {
     89         T_if_icmpge_1 t = new T_if_icmpge_1();
     90         assertEquals(1, t.run(Integer.MIN_VALUE, Integer.MIN_VALUE));
     91     }
     92 
     93     /**
     94      * @title  Arguments = 1234567, 0
     95      */
     96     public void testB3() {
     97         T_if_icmpge_1 t = new T_if_icmpge_1();
     98         assertEquals(1, t.run(1234567, 0));
     99     }
    100 
    101     /**
    102      * @title  Arguments = 0, 1234567
    103      */
    104     public void testB4() {
    105         T_if_icmpge_1 t = new T_if_icmpge_1();
    106         assertEquals(1234, t.run(0, 1234567));
    107     }
    108 
    109     /**
    110      * @title  Arguments = 0, 0
    111      */
    112     public void testB5() {
    113         T_if_icmpge_1 t = new T_if_icmpge_1();
    114         assertEquals(1, t.run(0, 0));
    115     }
    116 
    117     /**
    118      * @constraint 4.8.2.1
    119      * @title number of arguments
    120      */
    121     public void testVFE1() {
    122         try {
    123             Class.forName("dxc.junit.opcodes.if_icmpge.jm.T_if_icmpge_2");
    124             fail("expected a verification exception");
    125         } catch (Throwable t) {
    126             DxUtil.checkVerifyException(t);
    127         }
    128     }
    129 
    130     /**
    131      * @constraint 4.8.2.1
    132      * @title types of arguments - int, double
    133      */
    134     public void testVFE2() {
    135         try {
    136             Class.forName("dxc.junit.opcodes.if_icmpge.jm.T_if_icmpge_3");
    137             fail("expected a verification exception");
    138         } catch (Throwable t) {
    139             DxUtil.checkVerifyException(t);
    140         }
    141     }
    142 
    143     /**
    144      * @constraint 4.8.2.1
    145      * @title types of arguments - long, int
    146      */
    147     public void testVFE3() {
    148         try {
    149             Class.forName("dxc.junit.opcodes.if_icmpge.jm.T_if_icmpge_4");
    150             fail("expected a verification exception");
    151         } catch (Throwable t) {
    152             DxUtil.checkVerifyException(t);
    153         }
    154     }
    155 
    156     /**
    157      * @constraint 4.8.1.7
    158      * @title branch target shall be inside the
    159      * method
    160      */
    161     public void testVFE4() {
    162         try {
    163             Class.forName("dxc.junit.opcodes.if_icmpge.jm.T_if_icmpge_5");
    164             fail("expected a verification exception");
    165         } catch (Throwable t) {
    166             DxUtil.checkVerifyException(t);
    167         }
    168     }
    169 
    170     /**
    171      * @constraint 4.8.1.7
    172      * @title branch target shall not be "inside" wide
    173      * instruction
    174      */
    175     public void testVFE5() {
    176         try {
    177             Class.forName("dxc.junit.opcodes.if_icmpge.jm.T_if_icmpge_6");
    178             fail("expected a verification exception");
    179         } catch (Throwable t) {
    180             DxUtil.checkVerifyException(t);
    181         }
    182     }
    183 
    184     /**
    185      * @constraint 4.8.2.1
    186      * @title types of arguments - reference, int
    187      */
    188     public void testVFE6() {
    189         try {
    190             Class.forName("dxc.junit.opcodes.if_icmpge.jm.T_if_icmpge_7");
    191             fail("expected a verification exception");
    192         } catch (Throwable t) {
    193             DxUtil.checkVerifyException(t);
    194         }
    195     }
    196 
    197 }
    198