(t *testing.T)
| 102 | } |
| 103 | |
| 104 | func 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 | |
| 129 | func TestHumanInt(t *testing.T) { |
| 130 | cases := []struct { |
nothing calls this directly
no test coverage detected