MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestHumanCompact

Function TestHumanCompact

internal/app/stats_test.go:104–127  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func TestHumanCompact(t *testing.T) {
105 cases := []struct {
106 in int64
107 want string
108 }{
109 {0, "0"},
110 {766, "766"},
111 {999, "999"},
112 {1000, "1K"},
113 {1500, "1.5K"},
114 {320000, "320K"},
115 {999999, "1000.0K"},
116 {1000000, "1.00M"},
117 {1149208, "1.15M"},
118 {1000000000, "1.00B"},
119 {5188827405, "5.19B"},
120 }
121 for _, c := range cases {
122 got := humanCompact(c.in)
123 if got != c.want {
124 t.Errorf("humanCompact(%d) = %q, want %q", c.in, got, c.want)
125 }
126 }
127}
128
129func TestHumanInt(t *testing.T) {
130 cases := []struct {

Callers

nothing calls this directly

Calls 1

humanCompactFunction · 0.85

Tested by

no test coverage detected