forked from holman/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spark-test.sh
78 lines (55 loc) · 1.26 KB
/
spark-test.sh
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
78
#!/usr/bin/env roundup
describe "spark: Generates sparklines for a set of data."
spark="./spark"
it_shows_help_with_no_argv() {
$spark | grep USAGE
}
it_graphs_argv_data() {
graph="$($spark 1,5,22,13,5)"
test $graph = '▁▂█▅▂'
}
it_charts_pipe_data() {
data="0,30,55,80,33,150"
graph="$(echo $data | $spark)"
test $graph = '▁▂▃▄▂█'
}
it_charts_spaced_data() {
data="0 30 55 80 33 150"
graph="$($spark $data)"
test $graph = '▁▂▃▄▂█'
}
it_charts_way_spaced_data() {
data="0 30 55 80 33 150"
graph="$($spark $data)"
test $graph = '▁▂▃▄▂█'
}
it_handles_decimals() {
data="5.5,20"
graph="$($spark $data)"
test $graph = '▁█'
}
it_charts_100_lt_300() {
data="1,2,3,4,100,5,10,20,50,300"
graph="$($spark $data)"
test $graph = '▁▁▁▁▃▁▁▁▂█'
}
it_charts_50_lt_100() {
data="1,50,100"
graph="$($spark $data)"
test $graph = '▁▄█'
}
it_charts_4_lt_8() {
data="2,4,8"
graph="$($spark $data)"
test $graph = '▁▃█'
}
it_charts_no_tier_0() {
data="1,2,3,4,5"
graph="$($spark $data)"
test $graph = '▁▂▄▆█'
}
it_equalizes_at_midtier_on_same_data() {
data="1,1,1,1"
graph="$($spark $data)"
test $graph = '▅▅▅▅'
}