-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUtilsTest.dart
39 lines (33 loc) · 981 Bytes
/
UtilsTest.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
37
38
39
#source("Utils.dart");
class UtilsTest {
static void run() {
[testFormataDDMMYYYYComZero,
testFormataDDMMYYYYSemZero,
testGeraDados].forEach(beforeEach);
}
static void beforeEach(var test){
test();
}
static void testFormataDDMMYYYYComZero() {
Date now = new Date(2012, 4, 1, 0, 0, 0, 0);
Expect.equals("01/04/2012", Utils.formatDate(now));
}
static void testFormataDDMMYYYYSemZero() {
Date now = new Date(2012, 10, 12, 0, 0, 0, 0);
Expect.equals("12/10/2012", Utils.formatDate(now));
}
static void testGeraDados(){
LinkedHashMap map = new LinkedHashMap();
map["01/01/2012"] = 2.0;
map["02/01/2012"] = 1.0;
var result = Utils.geraDados(map);
// [["01/01/2012",1],["02/01/2012",1]]
Expect.equals("01/01/2012", result[1][0]);
Expect.equals(2.0, result[1][1]);
Expect.equals("02/01/2012", result[2][0]);
Expect.equals(1.0, result[2][1]);
}
}
void main() {
UtilsTest.run();
}