src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/StringIndexOfCharTest.java
changeset 58299 6df94ce3ab2f
parent 54601 c40b2a190173
equal deleted inserted replaced
58298:0152ad7b38b8 58299:6df94ce3ab2f
     1 /*
     1 /*
     2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    30 import org.graalvm.compiler.core.test.GraalCompilerTest;
    30 import org.graalvm.compiler.core.test.GraalCompilerTest;
    31 import org.junit.Test;
    31 import org.junit.Test;
    32 import org.junit.runner.RunWith;
    32 import org.junit.runner.RunWith;
    33 import org.junit.runners.Parameterized;
    33 import org.junit.runners.Parameterized;
    34 
    34 
    35 @RunWith(value = Parameterized.class)
    35 @RunWith(Parameterized.class)
    36 public class StringIndexOfCharTest extends GraalCompilerTest {
    36 public class StringIndexOfCharTest extends GraalCompilerTest {
    37     @Parameterized.Parameter(value = 0) public String sourceString;
       
    38     @Parameterized.Parameter(value = 1) public int constantChar;
       
    39     @Parameterized.Parameter(value = 2) public int fromIndex;
       
    40 
    37 
    41     @Parameterized.Parameters(name = "{0},{1},{2}")
    38     @Parameterized.Parameters(name = "{0},{1},{2}")
    42     public static Collection<Object[]> data() {
    39     public static Collection<Object[]> data() {
    43         ArrayList<Object[]> tests = new ArrayList<>();
    40         ArrayList<Object[]> tests = new ArrayList<>();
    44         String longString = "ab";
    41         String longString = "ab";
    66         }
    63         }
    67 
    64 
    68         return tests;
    65         return tests;
    69     }
    66     }
    70 
    67 
       
    68     private final String sourceString;
       
    69     private final int constantChar;
       
    70     private final int fromIndex;
       
    71 
       
    72     public StringIndexOfCharTest(String sourceString, int constantChar, int fromIndex) {
       
    73         this.sourceString = sourceString;
       
    74         this.constantChar = constantChar;
       
    75         this.fromIndex = fromIndex;
       
    76     }
       
    77 
    71     public int testStringIndexOf(String a, int b) {
    78     public int testStringIndexOf(String a, int b) {
    72         return a.indexOf(b);
    79         return a.indexOf(b);
    73     }
    80     }
    74 
    81 
    75     public int testStringIndexOfOffset(String a, int b, int offset) {
    82     public int testStringIndexOfOffset(String a, int b, int offset) {