aboutsummaryrefslogtreecommitdiffstats
path: root/modules/templates/util_format_test.go
blob: 8d466faff0c5266ecd6a69e92a718b921853e11e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2024 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package templates

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestCountFmt(t *testing.T) {
	assert.Equal(t, "125", countFmt(125))
	assert.Equal(t, "1.3k", countFmt(int64(1317)))
	assert.Equal(t, "21.3M", countFmt(21317675))
	assert.Equal(t, "45.7G", countFmt(45721317675))
	assert.Equal(t, "", countFmt("test"))
}