001/*
002 * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.
008 *
009 * This code is distributed in the hope that it will be useful, but WITHOUT
010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
011 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
012 * version 2 for more details (a copy is included in the LICENSE file that
013 * accompanied this code).
014 *
015 * You should have received a copy of the GNU General Public License version
016 * 2 along with this work; if not, write to the Free Software Foundation,
017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
018 *
019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
020 * or visit www.oracle.com if you need additional information or have any
021 * questions.
022 */
023package com.oracle.graal.jtt.micro;
024
025import org.junit.*;
026
027import com.oracle.graal.jtt.*;
028
029/*
030 */
031public class InvokeInterface_03 extends JTTTest {
032
033    interface I {
034
035        int plus(int a);
036    }
037
038    abstract static class A implements I {
039    }
040
041    static class C1 extends A {
042
043        @Override
044        public int plus(int a) {
045            return a;
046        }
047    }
048
049    static class C2 extends A {
050
051        @Override
052        public int plus(int a) {
053            return a;
054        }
055    }
056
057    static class C3 extends A {
058
059        @Override
060        public int plus(int a) {
061            return a;
062        }
063    }
064
065    static class C4 extends A {
066
067        @Override
068        public int plus(int a) {
069            return a;
070        }
071    }
072
073    static class C5 extends A {
074
075        @Override
076        public int plus(int a) {
077            return a;
078        }
079    }
080
081    static class C6 extends A {
082
083        @Override
084        public int plus(int a) {
085            return a;
086        }
087    }
088
089    static class C7 extends A {
090
091        @Override
092        public int plus(int a) {
093            return a;
094        }
095    }
096
097    static class C8 extends A {
098
099        @Override
100        public int plus(int a) {
101            return a;
102        }
103    }
104
105    static class C9 extends A {
106
107        @Override
108        public int plus(int a) {
109            return a;
110        }
111    }
112
113    static class C10 extends A {
114
115        @Override
116        public int plus(int a) {
117            return a;
118        }
119    }
120
121    static class C11 extends A {
122
123        @Override
124        public int plus(int a) {
125            return a;
126        }
127    }
128
129    static class C12 extends A {
130
131        @Override
132        public int plus(int a) {
133            return a;
134        }
135    }
136
137    static class C13 extends A {
138
139        @Override
140        public int plus(int a) {
141            return a;
142        }
143    }
144
145    static class C14 extends A {
146
147        @Override
148        public int plus(int a) {
149            return a;
150        }
151    }
152
153    static class C15 extends A {
154
155        @Override
156        public int plus(int a) {
157            return a;
158        }
159    }
160
161    public static int test(I i, int a) {
162        return i.plus(a);
163    }
164
165    @Before
166    public void setUp() {
167        I[] x = new I[]{new C1(), new C2(), new C3(), new C4(), new C5(), new C6(), new C7(), new C8(), new C9(), new C10(), new C11(), new C12(), new C13(), new C14(), new C15()};
168        int a = 0;
169        for (I i : x) {
170            i.plus(a++);
171        }
172    }
173
174    @Test
175    public void run0() throws Throwable {
176        runTest("test", new C1(), 0);
177    }
178
179    @Test
180    public void run1() throws Throwable {
181        runTest("test", new C2(), 1);
182    }
183
184}