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
59 lines (54 loc) · 1.49 KB
/
ArrayTests.java
File metadata and controls
59 lines (54 loc) · 1.49 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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 testReverseInPlaceEven() {
int[] input1 = { 5, 6 , 7, 8 };
ArrayExamples.reverseInPlace(input1);
assertArrayEquals(new int[]{ 8,7,6,5 }, input1);
}
/*
@Test
public void testReverseInPlaceOdd() {
int[] input1 = { 3 , 4, 5 };
ArrayExamples.reverseInPlace(input1);
assertArrayEquals(new int[]{ 5,4,3 }, input1);
}
@Test
public void testReverseInPlaceEmpty() {
int[] input1 = { };
ArrayExamples.reverseInPlace(input1);
assertArrayEquals(new int[]{ }, input1);
}
@Test
public void testReversed() {
int[] input1 = { };
assertArrayEquals(new int[]{ }, ArrayExamples.reversed(input1));
}
@Test
public void testReversedOdd() {
int[] input1 = {5,6,7 };
assertArrayEquals(new int[]{7,6,5 }, ArrayExamples.reversed(input1));
}
@Test
public void testReversedEven() {
int[] input1 = {5,6,7,8 };
assertArrayEquals(new int[]{ 8,7,6,5}, ArrayExamples.reversed(input1));
}
@Test
public void testReversedSingle() {
int[] input1 = {8 };
assertArrayEquals(new int[]{8 }, ArrayExamples.reversed(input1));
}
@Test
public void testAverageWithoutLowest(){
double[] input1 = {50,50,100};
assertEquals(75.0,ArrayExamples.averageWithoutLowest(input1),0.1);
}*/
}