Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ue_test.go « eu - github.com/gohugoio/locales.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c431979224c25bd0f41fcde706e404ee1efdbe0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package eu

import "testing"

func TestPercent(t *testing.T) {

	tests := []struct {
		num      float64
		v        uint64
		expected string
	}{
		{
			num:      23,
			v:        0,
			expected: "%\u00a023",
		},
		{
			num:      23.45,
			v:        2,
			expected: "%\u00a023,45",
		},
		{
			num:      1023.45,
			v:        2,
			expected: "%\u00a01.023,45",
		},
		{
			num:      -1023.45,
			v:        2,
			expected: "%\u00a0-1.023,45",
		},
	}

	trans := New()

	for _, tt := range tests {
		s := string(trans.FmtPercent(tt.num, tt.v))
		if s != tt.expected {
			t.Errorf("Expected '%s' Got '%s'", tt.expected, s)
		}
	}
}