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

20 lines
374 B
Go

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)
}
}
}