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