This repository has been archived by the owner on Aug 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
/
j2mejsTestHarness.java
77 lines (64 loc) · 1.89 KB
/
j2mejsTestHarness.java
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* vim: set filetype=java shiftwidth=4 tabstop=4 autoindent cindent expandtab : */
import gnu.testlet.*;
import com.sun.cldchi.jvm.JVM;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.*;
import java.lang.Exception;
import java.util.Vector;
public class j2mejsTestHarness extends TestHarness {
private String testName;
private int testNumber = 0;
private String testNote = null;
private int pass = 0;
private int fail = 0;
private int knownFail = 0;
private int unknownPass = 0;
public j2mejsTestHarness(String note, Display d) {
super(d);
this.testName = note;
}
public void setNote(String note) {
testNote = note;
}
public void debug(String msg) {
System.out.println(testName + "-" + testNumber + ": " + msg + ((testNote != null) ? (" [" + testNote + "]") : ""));
}
public void check(boolean ok) {
if (ok) {
++pass;
}
else {
++fail;
debug("fail");
}
++testNumber;
setNote(null);
}
public void todo(boolean ok) {
if (ok) {
++unknownPass;
debug("unknown pass");
}
else
++knownFail;
++testNumber;
setNote(null);
}
public void report() {
System.out.println(testName + ": " + pass + " pass, " + fail + " fail, " + knownFail + " known fail, " +
unknownPass + " unknown pass");
}
public int passed() {
return pass;
}
public int failed() {
return fail;
}
public int knownFailed() {
return knownFail;
}
public int unknownPassed() {
return unknownPass;
}
}