forked from ucsd-cse15l-f23/lab3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayTests.java
More file actions
40 lines (37 loc) · 1.03 KB
/
ArrayTests.java
File metadata and controls
40 lines (37 loc) · 1.03 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
34
35
36
37
38
39
40
import static org.junit.Assert.*;
import org.junit.*;
public class ArrayTests {
@Test
public void testReverseInPlace() {
int[] input1 = { 3 };
ArrayExamples.reverseInPlace(input1);
assertArrayEquals(new int[]{ 3 }, input1);
}
@Test
public void testReverseInPlace2() {
int[] input1 = { 3,5,1 };
ArrayExamples.reverseInPlace(input1);
assertArrayEquals(new int[]{ 1,5,3 }, input1);
}
@Test
public void testReverseInPlace3() {
int[] input1 = { 3124,3,9,1234 };
ArrayExamples.reverseInPlace(input1);
assertArrayEquals(new int[]{ 1234,9,3,3124 }, input1);
}
@Test
public void testReversed() {
int[] input1 = { };
assertArrayEquals(new int[]{ }, ArrayExamples.reversed(input1));
}
@Test
public void testReversed2() {
int[] input1 = {3,6,1 };
assertArrayEquals(new int[]{1, 6, 3 }, ArrayExamples.reversed(input1));
}
@Test
public void testReversed3() {
int[] input1 = {7,123 ,3 ,9 };
assertArrayEquals(new int[]{ 9, 3, 123, 7}, ArrayExamples.reversed(input1));
}
}