-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreports.dart
36 lines (27 loc) · 979 Bytes
/
reports.dart
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
class Reporter {
final bool verbose;
Reporter(this.verbose);
void testStart(Property<Object> p) =>
print("Testing property: '${p.name}'");
void testSuccess(Property<Object> p, Results rs) {
// print("SUCCESS: '${p.name}' after ${rs.count()} checks.\n");
}
void testFail(Property<Object> p, Results rs) =>
print("FAIL: '${p.name}' after ${rs.count()} check(s).\n");
void singleCheck(Result<Object> r) =>
r.result ? _success(r) : _fail(r);
void summary(List<bool> rs) {
var failed = rs.filter((r) => !r);
int numFailed = failed.length;
if (numFailed > 0) {
print ("\nFAILURE: ${numFailed} test(s) failed!");
} else {
print ("\nSUCCESS: tested ${rs.length} properties.");
}
}
void _fail(Result<Object> r) =>
print("\tFAILED for '${r.input.toString()}'");
void _success(Result<Object> r) =>
verbose ? print ("\tSUCCESS for '${r.input.toString()}'") : _skip();
}
_skip() {}