Home | History | Annotate | Download | only in if_lt
      1 package dot.junit.opcodes.if_lt;
      2 
      3 import dot.junit.DxTestCase;
      4 import dot.junit.DxUtil;
      5 import dot.junit.opcodes.if_lt.d.T_if_lt_1;
      6 import dot.junit.opcodes.if_lt.d.T_if_lt_11;
      7 
      8 public class Test_if_lt extends DxTestCase {
      9 
     10     /**
     11      * @title Case: 5 < 6
     12      */
     13     public void testN1() {
     14         T_if_lt_1 t = new T_if_lt_1();
     15         assertEquals(1, t.run(5, 6));
     16     }
     17 
     18     /**
     19      * @title Case: 0x0f0e0d0c = 0x0f0e0d0c
     20      */
     21     public void testN2() {
     22         T_if_lt_1 t = new T_if_lt_1();
     23         assertEquals(1234, t.run(0x0f0e0d0c, 0x0f0e0d0c));
     24     }
     25 
     26     /**
     27      * @title Case: 5 > -5
     28      */
     29     public void testN3() {
     30         T_if_lt_1 t = new T_if_lt_1();
     31         assertEquals(1234, t.run(5, -5));
     32     }
     33 
     34     /**
     35      * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE
     36      */
     37     public void testB1() {
     38         T_if_lt_1 t = new T_if_lt_1();
     39         assertEquals(1234, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE));
     40     }
     41 
     42     /**
     43      * @title Arguments = Integer.MIN_VALUE, Integer.MAX_VALUE
     44      */
     45     public void testB2() {
     46         T_if_lt_1 t = new T_if_lt_1();
     47         assertEquals(1, t.run(Integer.MIN_VALUE, Integer.MAX_VALUE));
     48     }
     49 
     50     /**
     51      * @title Arguments = Integer.MAX_VALUE, Integer.MIN_VALUE
     52      */
     53     public void testB3() {
     54         T_if_lt_1 t = new T_if_lt_1();
     55         assertEquals(1234, t.run(Integer.MAX_VALUE, Integer.MIN_VALUE));
     56     }
     57 
     58     /**
     59      * @title Arguments = 0, Integer.MIN_VALUE
     60      */
     61     public void testB4() {
     62         T_if_lt_1 t = new T_if_lt_1();
     63         assertEquals(1234, t.run(0, Integer.MIN_VALUE));
     64     }
     65 
     66     /**
     67      * @title Arguments = 0, 0
     68      */
     69     public void testB5() {
     70         T_if_lt_1 t = new T_if_lt_1();
     71         assertEquals(1234, t.run(0, 0));
     72     }
     73 
     74     /**
     75      * @constraint A23
     76      * @title number of registers
     77      */
     78     public void testVFE1() {
     79         try {
     80             Class.forName("dot.junit.opcodes.if_lt.d.T_if_lt_4");
     81             fail("expected a verification exception");
     82         } catch (Throwable t) {
     83             DxUtil.checkVerifyException(t);
     84         }
     85     }
     86 
     87 
     88     /**
     89      * @constraint B1
     90      * @title  types of arguments - int, double
     91      */
     92     public void testVFE2() {
     93         try {
     94             Class.forName("dot.junit.opcodes.if_lt.d.T_if_lt_5");
     95             fail("expected a verification exception");
     96         } catch (Throwable t) {
     97             DxUtil.checkVerifyException(t);
     98         }
     99     }
    100 
    101     /**
    102      * @constraint B1
    103      * @title  types of arguments - long, int
    104      */
    105     public void testVFE3() {
    106         try {
    107             Class.forName("dot.junit.opcodes.if_lt.d.T_if_lt_6");
    108             fail("expected a verification exception");
    109         } catch (Throwable t) {
    110             DxUtil.checkVerifyException(t);
    111         }
    112     }
    113 
    114     /**
    115      * @constraint B1
    116      * @title  types of arguments - int, reference
    117      */
    118     public void testVFE4() {
    119         try {
    120             Class.forName("dot.junit.opcodes.if_lt.d.T_if_lt_7");
    121             fail("expected a verification exception");
    122         } catch (Throwable t) {
    123             DxUtil.checkVerifyException(t);
    124         }
    125     }
    126 
    127     /**
    128      * @constraint A6
    129      * @title branch target shall be inside the method
    130      */
    131     public void testVFE5() {
    132         try {
    133             Class.forName("dot.junit.opcodes.if_lt.d.T_if_lt_9");
    134             fail("expected a verification exception");
    135         } catch (Throwable t) {
    136             DxUtil.checkVerifyException(t);
    137         }
    138     }
    139 
    140     /**
    141      * @constraint A6
    142      * @title branch target shall not be "inside" instruction
    143      */
    144     public void testVFE6() {
    145         try {
    146             Class.forName("dot.junit.opcodes.if_lt.d.T_if_lt_10");
    147             fail("expected a verification exception");
    148         } catch (Throwable t) {
    149             DxUtil.checkVerifyException(t);
    150         }
    151     }
    152 
    153     /**
    154      * @constraint n/a
    155      * @title branch target shall not be 0
    156      */
    157     public void testVFE7() {
    158         try {
    159             Class.forName("dot.junit.opcodes.if_lt.d.T_if_lt_12");
    160             fail("expected a verification exception");
    161         } catch (Throwable t) {
    162             DxUtil.checkVerifyException(t);
    163         }
    164     }
    165 
    166     /**
    167      * @constraint B1
    168      * @title Types of arguments - int, float. The verifier checks that ints
    169      * and floats are not used interchangeably.
    170      */
    171     public void testVFE8() {
    172         try {
    173             Class.forName("dot.junit.opcodes.if_lt.d.T_if_lt_11");
    174             fail("expected a verification exception");
    175         } catch (Throwable t) {
    176             DxUtil.checkVerifyException(t);
    177         }
    178     }
    179 
    180 }
    181