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