-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathutils_test.go
More file actions
40 lines (35 loc) · 732 Bytes
/
utils_test.go
File metadata and controls
40 lines (35 loc) · 732 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
package whatlanggo
import "testing"
func TestIsStopChar(t *testing.T) {
tests := map[rune]bool{
//Space
'\t': true, '\n': true, '\v': true, '\r': true, '\f': true, 0x85: true, 0xA0: true,
//Digits
'0': true, '1': true, '2': true, '3': true, '5': true, '6': true, '9': true,
//Punct
';': true, '!': true, '"': true,
//Symbol
'`': true,
}
for r, want := range tests {
got := isStopChar(r)
if got != want {
t.Fatalf("%v want %t got %t", r, want, got)
}
}
}
func TestAbs(t *testing.T) {
tests := map[int]int{
1: 1,
-0: 0,
69: 69,
-65535: 65535,
65535: 65535,
}
for x, want := range tests {
got := abs(x)
if got != want {
t.Fatalf("want %d got %d", want, got)
}
}
}