• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.dup;
18 
19 import dxc.junit.DxTestCase;
20 import dxc.junit.DxUtil;
21 import dxc.junit.opcodes.dup.jm.T_dup_1;
22 import dxc.junit.opcodes.dup.jm.T_dup_6;
23 import dxc.junit.opcodes.dup.jm.T_dup_7;
24 
25 
26 public class Test_dup extends DxTestCase {
27 
28     /**
29      * @title  type of argument - int
30      */
testN1()31     public void testN1() {
32         T_dup_1 t = new T_dup_1();
33         assertTrue(t.run());
34     }
35 
36     /**
37      * @title  type of argument - float
38      */
testN2()39     public void testN2() {
40         T_dup_6 t = new T_dup_6();
41         assertTrue(t.run());
42     }
43 
44     /**
45      * @title  type of argument - reference
46      */
testN3()47     public void testN3() {
48         T_dup_7 t = new T_dup_7();
49         assertTrue(t.run());
50     }
51 
52     /**
53      * @constraint 4.8.2.1
54      * @title number of arguments
55      */
testVFE1()56     public void testVFE1() {
57         try
58         {
59             Class.forName("dxc.junit.opcodes.dup.jm.T_dup_2");
60             fail("expected a verification exception");
61         } catch (Throwable t) {
62             DxUtil.checkVerifyException(t);
63         }
64     }
65 
66     /**
67      * @constraint 4.8.2.1
68      * @title type of argument - double
69      */
testVFE2()70     public void testVFE2() {
71         try
72         {
73             Class.forName("dxc.junit.opcodes.dup.jm.T_dup_3");
74             fail("expected a verification exception");
75         } catch (Throwable t) {
76             DxUtil.checkVerifyException(t);
77         }
78     }
79 
80     /**
81      * @constraint 4.8.2.1
82      * @title type of argument - long
83      */
testVFE3()84     public void testVFE3() {
85         try
86         {
87             Class.forName("dxc.junit.opcodes.dup.jm.T_dup_4");
88             fail("expected a verification exception");
89         } catch (Throwable t) {
90             DxUtil.checkVerifyException(t);
91         }
92     }
93 
94     /**
95      * @constraint 4.8.2.5
96      * @title stack size
97      */
testVFE4()98     public void testVFE4() {
99         try
100         {
101             Class.forName("dxc.junit.opcodes.dup.jm.T_dup_5");
102             fail("expected a verification exception");
103         } catch (Throwable t) {
104             DxUtil.checkVerifyException(t);
105         }
106     }
107 
108 }
109