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 */ 023/* 024 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 025 */ 026package com.oracle.graal.jtt.micro; 027 028import org.junit.*; 029 030import com.oracle.graal.jtt.*; 031 032/* 033 */ 034public class BigMixedParams01 extends JTTTest { 035 036 public static double test(int num) { 037 double sum = 0; 038 if (num == 0) { 039 sum += testA(0, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); 040 sum += testA(1, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); 041 sum += testA(2, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); 042 sum += testA(3, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); 043 sum += testA(4, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); 044 sum += testA(5, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); 045 sum += testA(6, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); 046 sum += testA(7, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); 047 sum += testA(8, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); 048 } else if (num == 1) { 049 sum += testB(0, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); 050 sum += testB(1, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); 051 sum += testB(2, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); 052 sum += testB(3, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); 053 sum += testB(4, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); 054 sum += testB(5, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); 055 sum += testB(6, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); 056 sum += testB(7, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); 057 sum += testB(8, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); 058 } else if (num == 2) { 059 for (int i = 0; i < 9; i++) { 060 sum += testA(i, -1, -1, -1, -1, 1f, 2f, 3f, 4f, -1, -1, 5f, 6f, 7f, 8f, 9f); 061 } 062 } else if (num == 3) { 063 for (int i = 0; i < 9; i++) { 064 sum += testB(i, -1, -1, -1, 1d, 2d, 3d, 4d, -1, -1, 5d, 6d, 7d, 8d, 9d); 065 } 066 } 067 return sum; 068 } 069 070 @SuppressWarnings("unused") 071 private static float testA(int choice, int i0, int i1, int i2, int i3, float p0, float p1, float p2, float p3, int i4, int i5, float p4, float p5, float p6, float p7, float p8) { 072 switch (choice) { 073 case 0: 074 return p0; 075 case 1: 076 return p1; 077 case 2: 078 return p2; 079 case 3: 080 return p3; 081 case 4: 082 return p4; 083 case 5: 084 return p5; 085 case 6: 086 return p6; 087 case 7: 088 return p7; 089 case 8: 090 return p8; 091 } 092 return 42; 093 } 094 095 @SuppressWarnings("unused") 096 private static double testB(int choice, int i0, int i1, int i2, double p0, double p1, double p2, double p3, int i3, int i4, double p4, double p5, double p6, double p7, double p8) { 097 switch (choice) { 098 case 0: 099 return p0; 100 case 1: 101 return p1; 102 case 2: 103 return p2; 104 case 3: 105 return p3; 106 case 4: 107 return p4; 108 case 5: 109 return p5; 110 case 6: 111 return p6; 112 case 7: 113 return p7; 114 case 8: 115 return p8; 116 } 117 return 42; 118 } 119 120 @Test 121 public void run0() throws Throwable { 122 runTest("test", 0); 123 } 124 125 @Test 126 public void run1() throws Throwable { 127 runTest("test", 1); 128 } 129 130 @Test 131 public void run2() throws Throwable { 132 runTest("test", 2); 133 } 134 135 @Test 136 public void run3() throws Throwable { 137 runTest("test", 3); 138 } 139 140 @Test 141 public void run4() throws Throwable { 142 runTest("test", 4); 143 } 144 145}