-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathExamCheckingTest.java
More file actions
63 lines (58 loc) · 1.92 KB
/
ExamCheckingTest.java
File metadata and controls
63 lines (58 loc) · 1.92 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
59
60
61
62
63
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author User
*/
public class ExamCheckingTest {
private ExamChecking testEx;
private char[] stdAnswer;
private char[] solAnswer;
public ExamCheckingTest() {
testEx=new ExamChecking();
}
@Test
public void allStudentAnswerIncorrect(){
stdAnswer = new char [] {'D', 'B', 'C', 'A', 'A'};
solAnswer = new char[] {'B', 'C', 'D', 'B', 'B'};
int expectResult=-5;
int result=ExamChecking.examChecking(stdAnswer, solAnswer);
assertEquals(expectResult, result);
}
@Test
public void allStudentAnswerCorrect(){
stdAnswer = new char [] {'C', 'D', 'A','E','D'};
solAnswer = new char[] {'C', 'D', 'A','E','D'};
int expectResult=10;
int result=ExamChecking.examChecking(stdAnswer, solAnswer);
assertEquals(expectResult, result);
}
@Test
public void someStudentAnswerCorrect(){
stdAnswer = new char [] {'B', 'B', 'C', 'D', 'A'};
solAnswer = new char[] {'B', 'C', 'D', 'A', 'A'};
int expectResult=1;
int result=ExamChecking.examChecking(stdAnswer, solAnswer);
assertEquals(expectResult, result);
}
@Test
public void notEquallyNumberOfExam1(){
stdAnswer = new char [] {'A', 'D', 'C'};
solAnswer = new char[] {'A', 'D', 'C', 'D', 'A'};
int expectResult=4;
int result=ExamChecking.examChecking(stdAnswer, solAnswer);
assertEquals(expectResult, result);
}
@Test
public void notEquallyNumberOfExam2(){
stdAnswer = new char [] {'B', 'D', 'A'};
solAnswer = new char[] {'B', 'D', 'C', 'D', 'A'};
int expectResult=1;
int result=ExamChecking.examChecking(stdAnswer, solAnswer);
assertEquals(expectResult, result);
}
}