Home | History | Annotate | Download | only in neg_long
      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.neg_long;
     18 
     19 import dot.junit.DxTestCase;
     20 import dot.junit.DxUtil;
     21 import dot.junit.opcodes.neg_long.d.T_neg_long_1;
     22 import dot.junit.opcodes.neg_long.d.T_neg_long_2;
     23 import dot.junit.opcodes.neg_long.d.T_neg_long_4;
     24 
     25 public class Test_neg_long extends DxTestCase {
     26 
     27     /**
     28      * @title Argument = 123123123272432432l
     29      */
     30     public void testN1() {
     31         T_neg_long_1 t = new T_neg_long_1();
     32         assertEquals(-123123123272432432l, t.run(123123123272432432l));
     33     }
     34 
     35     /**
     36      * @title Argument = 1
     37      */
     38     public void testN2() {
     39         T_neg_long_1 t = new T_neg_long_1();
     40         assertEquals(-1l, t.run(1l));
     41     }
     42 
     43     /**
     44      * @title Argument = -1
     45      */
     46     public void testN3() {
     47         T_neg_long_1 t = new T_neg_long_1();
     48         assertEquals(1l, t.run(-1l));
     49     }
     50 
     51     /**
     52      * @title Check that -x == (~x + 1)
     53      */
     54     public void testN4() {
     55         T_neg_long_2 t = new T_neg_long_2();
     56         assertTrue(t.run(15l));
     57     }
     58 
     59 
     60     /**
     61      * @title Argument = 0
     62      */
     63     public void testB1() {
     64         T_neg_long_1 t = new T_neg_long_1();
     65         assertEquals(0, t.run(0));
     66     }
     67 
     68     /**
     69      * @title Argument = Long.MAX_VALUE
     70      */
     71     public void testB2() {
     72         T_neg_long_1 t = new T_neg_long_1();
     73         assertEquals(-9223372036854775807L, t.run(Long.MAX_VALUE));
     74     }
     75 
     76     /**
     77      * @title Argument = Long.MIN_VALUE
     78      */
     79     public void testB3() {
     80         T_neg_long_1 t = new T_neg_long_1();
     81         assertEquals(-9223372036854775808L, t.run(Long.MIN_VALUE));
     82     }
     83 
     84     /**
     85      * @constraint A24
     86      * @title  number of registers
     87      */
     88     public void testVFE1() {
     89         load("dot.junit.opcodes.neg_long.d.T_neg_long_3", VerifyError.class);
     90     }
     91 
     92 
     93     /**
     94      *
     95      * @constraint B1
     96      * @title type of argument - int
     97      */
     98     public void testVFE2() {
     99         load("dot.junit.opcodes.neg_long.d.T_neg_long_5", VerifyError.class);
    100     }
    101 
    102     /**
    103      *
    104      * @constraint B1
    105      * @title type of argument - float
    106      */
    107     public void testVFE3() {
    108         load("dot.junit.opcodes.neg_long.d.T_neg_long_6", VerifyError.class);
    109     }
    110 
    111     /**
    112      *
    113      * @constraint B1
    114      * @title type of argument - reference
    115      */
    116     public void testVFE4() {
    117         load("dot.junit.opcodes.neg_long.d.T_neg_long_7", VerifyError.class);
    118     }
    119 
    120     /**
    121      * @constraint B1
    122      * @title Types of arguments - long, double. The verifier checks that longs
    123      * and doubles are not used interchangeably.
    124      */
    125     public void testVFE5() {
    126         load("dot.junit.opcodes.neg_long.d.T_neg_long_4", VerifyError.class);
    127     }
    128 }
    129