-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils_test.go
109 lines (87 loc) · 1.9 KB
/
utils_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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package xlripper
import (
"fmt"
"testing"
)
func TestUnitMini(t *testing.T) {
tn := "TestMini"
a := -1
b := 2
e := a
got := itos(mini(a, b))
want := itos(e)
if got != want {
t.Error(tfail(tn, fmt.Sprintf("mini(%d, %d)", a, b), got, want))
}
a = 100
b = 99
e = b
got = itos(mini(a, b))
want = itos(e)
if got != want {
t.Error(tfail(tn, fmt.Sprintf("mini(%d, %d)", a, b), got, want))
}
}
func TestUnitMaxi(t *testing.T) {
tn := "TestMaxi"
a := -1
b := 2
e := b
got := itos(maxi(a, b))
want := itos(e)
if got != want {
t.Error(tfail(tn, fmt.Sprintf("maxi(%d, %d)", a, b), got, want))
}
a = 100
b = 99
e = a
got = itos(maxi(a, b))
want = itos(e)
if got != want {
t.Error(tfail(tn, fmt.Sprintf("maxi(%d, %d)", a, b), got, want))
}
}
func TestUnitRemoveLeadingSlashZeroLen(t *testing.T) {
tn := "TestRemoveLeadingSlashZeroLen"
input := ""
want := ""
got := removeLeadingSlash(input)
stmt := fmt.Sprintf("removeLeadingSlash(\"%s\")", input)
if got != want {
t.Error(tfail(tn, stmt, got, want))
}
}
func TestUnitRemoveLeadingSlashOnlySlash(t *testing.T) {
tn := "TestRemoveLeadingSlashZeroLen"
input := "/"
want := ""
got := removeLeadingSlash(input)
stmt := fmt.Sprintf("removeLeadingSlash(\"%s\")", input)
if got != want {
t.Error(tfail(tn, stmt, got, want))
}
}
func TestUnitRemoveLeadingSlashOneChar(t *testing.T) {
tn := "TestRemoveLeadingSlashZeroLen"
input := "x"
want := "x"
got := removeLeadingSlash(input)
stmt := fmt.Sprintf("removeLeadingSlash(\"%s\")", input)
if got != want {
t.Error(tfail(tn, stmt, got, want))
}
}
func TestUnitRemoveLeadingSlashRemove(t *testing.T) {
tn := "TestRemoveLeadingSlashZeroLen"
input := "/x"
want := "x"
got := removeLeadingSlash(input)
stmt := fmt.Sprintf("removeLeadingSlash(\"%s\")", input)
if got != want {
t.Error(tfail(tn, stmt, got, want))
}
}
func TestUnitUseFunction(t *testing.T) {
x := 1
use(x)
}