forked from ucsd-cse15l-f22/lab3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListTests.java
More file actions
35 lines (31 loc) · 981 Bytes
/
ListTests.java
File metadata and controls
35 lines (31 loc) · 981 Bytes
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
import static org.junit.Assert.*;
import java.lang.reflect.Array;
import org.junit.*;
import java.util.ArrayList;
import java.util.List;
public class ListTests{
@Test
public void testForFilter(){
List<String> input1 = new ArrayList<>();
input1.add("a");
input1.add("b");
input1.add("c");
// false output should be c,b,a
assertEquals(input1, ListExamples.filter(input1, new AlwaysCorrectChecker()));
}
@Test
public void testForMerge(){
List<String> input1 = new ArrayList<>();
input1.add("a");
input1.add("c");
input1.add("e");
List<String> input2 = new ArrayList<>();
input2.add("b");
input2.add("d");
input2.add("f");
List<String> correct = new ArrayList<>();
String[] sl = new String[]{"a","b","c","d","e","f"};
for(String s:sl){correct.add(s);}
assertEquals(correct, ListExamples.merge(input1,input2));
}
}