1
0
Fork 0
mirror of https://github.com/Luzifer/badge-gen.git synced 2024-11-08 13:20:02 +00:00
badge-gen/metric_test.go

21 lines
374 B
Go
Raw Normal View History

2016-07-06 23:25:09 +00:00
package main
import "testing"
func TestMetricFormat(t *testing.T) {
cases := map[int64]string{
1000: "1k",
1234: "1k",
10023: "10k",
100000: "100k",
1000000: "1M",
1023555: "1M",
6012355: "6M",
}
for v, r := range cases {
if cr := metricFormat(v); cr != r {
t.Errorf("Metric format of number %d did not match '%s': '%s'", v, r, cr)
}
}
}