1 /*
   2  * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.graalvm.compiler.jtt.bytecode;
  24 
  25 import org.junit.Test;
  26 
  27 import org.graalvm.compiler.jtt.JTTTest;
  28 
  29 /*
  30  */
  31 public class BC_lookupswitch04 extends JTTTest {
  32 
  33     public static int test(int a) {
  34         final int b = a + 8;
  35         final int c = b + 2;
  36         switch (c) {
  37             case 77:
  38                 return 0;
  39             case 107:
  40                 return 1;
  41             case 117:
  42                 return 2;
  43             case 143:
  44                 return 3;
  45             case 222:
  46                 return 4;
  47             case -112:
  48                 return 5;
  49         }
  50         return 42;
  51     }
  52 
  53     @Test
  54     public void run0() throws Throwable {
  55         runTest("test", 0);
  56     }
  57 
  58     @Test
  59     public void run1() throws Throwable {
  60         runTest("test", 1);
  61     }
  62 
  63     @Test
  64     public void run2() throws Throwable {
  65         runTest("test", 66);
  66     }
  67 
  68     @Test
  69     public void run3() throws Throwable {
  70         runTest("test", 67);
  71     }
  72 
  73     @Test
  74     public void run4() throws Throwable {
  75         runTest("test", 68);
  76     }
  77 
  78     @Test
  79     public void run5() throws Throwable {
  80         runTest("test", 96);
  81     }
  82 
  83     @Test
  84     public void run6() throws Throwable {
  85         runTest("test", 97);
  86     }
  87 
  88     @Test
  89     public void run7() throws Throwable {
  90         runTest("test", 98);
  91     }
  92 
  93     @Test
  94     public void run8() throws Throwable {
  95         runTest("test", 106);
  96     }
  97 
  98     @Test
  99     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 }