-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean_test.go
52 lines (46 loc) · 894 Bytes
/
clean_test.go
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
52
/*
* Ali Ahmadi
* Dedicated to MHM
*/
package num2text
import (
"fmt"
"testing"
)
func TestCleanStr(t *testing.T) {
tests := [...]struct {
name string
inp string
exp string
}{
{
name: "",
inp: "\n\n\n",
exp: "",
},
}
for i, test := range tests {
t.Run(fmt.Sprintf("%s - test case %d", test.name, i), func(t *testing.T) {
r := cleanStr(test.inp)
if r != test.exp {
t.Errorf("cleanStr(%s) = '%s' - expected '%s'", test.inp, r, test.exp)
}
})
}
}
func TestCleanNumberFunction(t *testing.T) {
tests := [...]struct {
name string
dec bool
inp string
exp string
}{}
for i, test := range tests {
t.Run(fmt.Sprintf("%s - test case %d", test.name, i), func(t *testing.T) {
r := cleanNum(test.inp, test.dec)
if r != test.exp {
t.Errorf("cleanNum(%s, %v) = %v - expected %v", test.inp, test.dec, r, test.exp)
}
})
}
}