File: format_test.go

package info (click to toggle)
moor 2.10.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,960 kB
  • sloc: sh: 229; ansic: 12; xml: 6; makefile: 5
file content (21 lines) | stat: -rw-r--r-- 542 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package util

import (
	"testing"

	"gotest.tools/v3/assert"
)

func TestFormatInt(t *testing.T) {
	assert.Equal(t, "1", FormatInt(1))
	assert.Equal(t, "10", FormatInt(10))
	assert.Equal(t, "100", FormatInt(100))

	// Ref: // https://en.wikipedia.org/wiki/Decimal_separator#Exceptions_to_digit_grouping
	assert.Equal(t, "1000", FormatInt(1000))

	assert.Equal(t, "10_000", FormatInt(10000))
	assert.Equal(t, "100_000", FormatInt(100000))
	assert.Equal(t, "1_000_000", FormatInt(1000000))
	assert.Equal(t, "10_000_000", FormatInt(10000000))
}