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
24
25 package org.graalvm.compiler.replacements.test;
26
27 import java.util.ArrayList;
28 import java.util.Collection;
29
30 import org.graalvm.compiler.core.test.GraalCompilerTest;
31 import org.junit.Test;
32 import org.junit.runner.RunWith;
33 import org.junit.runners.Parameterized;
34
35 @RunWith(value = Parameterized.class)
36 public abstract class StringIndexOfTestBase extends GraalCompilerTest {
37 @Parameterized.Parameter(value = 0) public String sourceString;
38 @Parameterized.Parameter(value = 1) public String constantString;
39
40 @Parameterized.Parameters(name = "{0},{1}")
41 public static Collection<Object[]> data() {
42 ArrayList<Object[]> tests = new ArrayList<>();
43 String[] targets = new String[]{"foobar", "foo", "bar"};
44 String[] utf16targets = new String[]{"grga " + ((char) 0x10D) + "varak", "grga", ((char) 0x10D) + "varak"};
45 addTargets(tests, targets);
46 addTargets(tests, utf16targets);
47 return tests;
48 }
49
50 private static void addTargets(ArrayList<Object[]> tests, String[] targets) {
51 for (String source : targets) {
52 for (String target : targets) {
53 tests.add(new Object[]{source, target});
|
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
24
25 package org.graalvm.compiler.replacements.test;
26
27 import org.graalvm.compiler.core.test.GraalCompilerTest;
28 import org.junit.Test;
29 import org.junit.runner.RunWith;
30 import org.junit.runners.Parameterized;
31
32 import java.util.ArrayList;
33 import java.util.Collection;
34
35 @RunWith(value = Parameterized.class)
36 public abstract class StringIndexOfTestBase extends GraalCompilerTest {
37 @Parameterized.Parameter(value = 0) public String sourceString;
38 @Parameterized.Parameter(value = 1) public String constantString;
39
40 @Parameterized.Parameters(name = "{0},{1}")
41 public static Collection<Object[]> data() {
42 ArrayList<Object[]> tests = new ArrayList<>();
43 String[] targets = new String[]{"foobar", "foo", "bar"};
44 String[] utf16targets = new String[]{"grga " + ((char) 0x10D) + "varak", "grga", ((char) 0x10D) + "varak"};
45 addTargets(tests, targets);
46 addTargets(tests, utf16targets);
47 return tests;
48 }
49
50 private static void addTargets(ArrayList<Object[]> tests, String[] targets) {
51 for (String source : targets) {
52 for (String target : targets) {
53 tests.add(new Object[]{source, target});
|