001/* 002 * Copyright (c) 2007, 2012, 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.bytecode; 024 025import org.junit.*; 026 027import com.oracle.graal.jtt.*; 028 029/* 030 */ 031public class BC_lookupswitch04 extends JTTTest { 032 033 public static int test(int a) { 034 final int b = a + 8; 035 final int c = b + 2; 036 switch (c) { 037 case 77: 038 return 0; 039 case 107: 040 return 1; 041 case 117: 042 return 2; 043 case 143: 044 return 3; 045 case 222: 046 return 4; 047 case -112: 048 return 5; 049 } 050 return 42; 051 } 052 053 @Test 054 public void run0() throws Throwable { 055 runTest("test", 0); 056 } 057 058 @Test 059 public void run1() throws Throwable { 060 runTest("test", 1); 061 } 062 063 @Test 064 public void run2() throws Throwable { 065 runTest("test", 66); 066 } 067 068 @Test 069 public void run3() throws Throwable { 070 runTest("test", 67); 071 } 072 073 @Test 074 public void run4() throws Throwable { 075 runTest("test", 68); 076 } 077 078 @Test 079 public void run5() throws Throwable { 080 runTest("test", 96); 081 } 082 083 @Test 084 public void run6() throws Throwable { 085 runTest("test", 97); 086 } 087 088 @Test 089 public void run7() throws Throwable { 090 runTest("test", 98); 091 } 092 093 @Test 094 public void run8() throws Throwable { 095 runTest("test", 106); 096 } 097 098 @Test 099 public void run9() throws Throwable { 100 runTest("test", 107); 101 } 102 103 @Test 104 public void run10() throws Throwable { 105 runTest("test", 108); 106 } 107 108 @Test 109 public void run11() throws Throwable { 110 runTest("test", 132); 111 } 112 113 @Test 114 public void run12() throws Throwable { 115 runTest("test", 133); 116 } 117 118 @Test 119 public void run13() throws Throwable { 120 runTest("test", 134); 121 } 122 123 @Test 124 public void run14() throws Throwable { 125 runTest("test", 211); 126 } 127 128 @Test 129 public void run15() throws Throwable { 130 runTest("test", 212); 131 } 132 133 @Test 134 public void run16() throws Throwable { 135 runTest("test", 213); 136 } 137 138 @Test 139 public void run17() throws Throwable { 140 runTest("test", -121); 141 } 142 143 @Test 144 public void run18() throws Throwable { 145 runTest("test", -122); 146 } 147 148 @Test 149 public void run19() throws Throwable { 150 runTest("test", -123); 151 } 152 153}