-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearchInRotatedSortedArrayWithDupsTest.java
More file actions
executable file
·33 lines (28 loc) · 1.4 KB
/
Copy pathSearchInRotatedSortedArrayWithDupsTest.java
File metadata and controls
executable file
·33 lines (28 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.junit.jupiter:junit-jupiter-engine:5.10.1
//DEPS org.junit.platform:junit-platform-console:1.9.3
//SOURCES SearchInRotatedSortedArrayWithDups.java
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.platform.console.tasks.ConsoleTestExecutor;
import org.junit.platform.engine.discovery.DiscoverySelectors;
import org.junit.platform.console.options.CommandLineOptions;
import java.io.PrintWriter;
import java.util.List;
public class SearchInRotatedSortedArrayWithDupsTest {
@Test
public void testExecuter() {
var executer = new SearchInRotatedSortedArrayWithDups();
assertEquals(4, executer.execute(new int[]{4,5,6,7,0,1,2},0));
assertEquals(-1, executer.execute(new int[]{4,5,6,7,0,1,2},3));
assertEquals(1, executer.execute(new int[]{2,9,2,2,2,2},9));
assertEquals(0, executer.execute(new int[]{9,2,2,2,2},9));
assertEquals(4, executer.execute(new int[]{2,2,2,2,9},9));
assertEquals(-1, executer.execute(new int[]{1},0));
}
public static void main(String... args) throws Exception {
CommandLineOptions options = new CommandLineOptions();
options.setSelectedClasses(List.of(DiscoverySelectors.selectClass(SearchInRotatedSortedArrayWithDupsTest.class)));
new ConsoleTestExecutor(options).execute(new PrintWriter(System.out));
}
}