1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

fix bar graph test

This commit is contained in:
Nicholas Eden 2018-11-12 19:07:40 -08:00
parent cab27c62ab
commit 4738b5ccd7

View File

@ -8,17 +8,21 @@ import (
) )
// MakeData - Create sample data // MakeData - Create sample data
func makeData() [][2]int64 { func makeData() []Bar {
//this could come from config //this could come from config
const lineCount = 2 const lineCount = 2
var stats [lineCount][2]int64 var stats [lineCount]Bar
stats[0][1] = 1530122942000 stats[0] = Bar{
stats[0][0] = 100 Label: "Jun 27, 2018",
Percent: 20,
}
stats[1][1] = 1531142942000 stats[1] = Bar{
stats[1][0] = 210 Label: "Jul 09, 2018",
Percent: 80,
}
return stats[:] return stats[:]
@ -29,5 +33,8 @@ func TestOutput(t *testing.T) {
result := BuildStars(makeData(), 20, "*") result := BuildStars(makeData(), 20, "*")
Equal(t, "Jun 27, 2018 -\t [red]*[white] - (100)\nJul 09, 2018 -\t [red]********************[white] - (210)\n", result) Equal(t,
"Jun 27, 2018[[red]****[white] ] 20\nJul 09, 2018[[red]****************[white] ] 80\n",
result,
)
} }