-
Notifications
You must be signed in to change notification settings - Fork 3
/
routine_test.go
47 lines (41 loc) · 1011 Bytes
/
routine_test.go
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
package main
import "testing"
func TestProcessBytes(t *testing.T) {
dataTwoRows := []byte(`{
"tasks": [
{
"start": "2016-01-01",
"end": "2016-01-25",
"label": "A"
},
{
"start": "2016-02-01",
"end": "2016-03-01",
"label": "B"
}
]
}`)
dataOneRow := []byte(`{
"tasks": [
{
"start": "2016-01-01",
"end": "2016-01-25",
"label": "A"
}
]
}`)
resultTwoRows := processBytes(dataTwoRows);
resultOneRow := processBytes(dataOneRow);
if resultTwoRows.Context == nil || resultOneRow.Context == nil {
t.Errorf("drawScene() faulty\nTwo rows: %s\nOne row: %s", resultTwoRows.Message, resultOneRow.Message)
return
}
// check that drawScene has worked
ctxTwoRows := resultTwoRows.Context;
ctxOneRow := resultOneRow.Context;
heightTwoRows := ctxTwoRows.Height();
heightOneRow:= ctxOneRow.Height();
if heightOneRow >= heightTwoRows {
t.Errorf("processBytes() faulty: %d should be <= %d", heightTwoRows, heightOneRow)
}
}