-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMoneyConvert_test.go
More file actions
51 lines (48 loc) · 838 Bytes
/
Copy pathMoneyConvert_test.go
File metadata and controls
51 lines (48 loc) · 838 Bytes
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
43
44
45
46
47
48
49
50
51
package tools
import "testing"
func TestFen2Yuan(t *testing.T) {
type args struct {
fen int64
}
tests := []struct {
name string
args args
want float64
}{
{
name: "100分转1元",
args: args{fen: 100},
want: 1.00,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := Fen2Yuan(tt.args.fen); got != tt.want {
t.Errorf("Fen2Yuan() = %v, want %v", got, tt.want)
}
})
}
}
func TestYuan2Fen(t *testing.T) {
type args struct {
yuan float64
}
tests := []struct {
name string
args args
want int64
}{
{
name: "1元转100分",
args: args{yuan: 1},
want: 100,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := Yuan2Fen(tt.args.yuan); got != tt.want {
t.Errorf("Yuan2Fen() = %v, want %v", got, tt.want)
}
})
}
}