Use a simple format for the big number on ui (#12822)
* Use a simple format for the big number on ui Signed-off-by: a1012112796 <1012112796@qq.com> * make fmt * Apply review suggestion @silverwind * Change name 2 * make fmt Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
d8b5235ded
commit
a9decf0dac
5 changed files with 48 additions and 15 deletions
|
@ -223,5 +223,13 @@ func TestIsTextFile(t *testing.T) {
|
|||
assert.True(t, IsTextFile([]byte("lorem ipsum")))
|
||||
}
|
||||
|
||||
func TestFormatNumberSI(t *testing.T) {
|
||||
assert.Equal(t, "125", FormatNumberSI(int(125)))
|
||||
assert.Equal(t, "1.3k", FormatNumberSI(int64(1317)))
|
||||
assert.Equal(t, "21.3M", FormatNumberSI(21317675))
|
||||
assert.Equal(t, "45.7G", FormatNumberSI(45721317675))
|
||||
assert.Equal(t, "", FormatNumberSI("test"))
|
||||
}
|
||||
|
||||
// TODO: IsImageFile(), currently no idea how to test
|
||||
// TODO: IsPDFFile(), currently no idea how to test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue