mirror of
https://github.com/Luzifer/badge-gen.git
synced 2024-11-09 22:00:05 +00:00
20 lines
374 B
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)
|
|
}
|
|
}
|
|
}
|