-
Notifications
You must be signed in to change notification settings - Fork 101
/
api_test.go
67 lines (60 loc) · 920 Bytes
/
api_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
package m3u8d
import (
"fmt"
"strconv"
"testing"
)
func TestFindUrlInStr(t *testing.T) {
urlStr := FindUrlInStr(" https://www.baidu.com/url1.jsp?sxjs=1&s=2&io=%%112 xs")
if urlStr != "https://www.baidu.com/url1.jsp?sxjs=1&s=2&io=%%112" {
fmt.Println(strconv.Quote(urlStr))
t.Fail()
}
}
func TestSkip(t *testing.T) {
skip := isSkipByTsTime(10, 20, []SkipTsUnit{
{
Start: 0,
End: 6,
},
})
if skip {
t.Fatal()
}
skip = isSkipByTsTime(10, 20, []SkipTsUnit{
{
Start: 6,
End: 11,
},
})
if skip == false {
t.Fatal()
}
skip = isSkipByTsTime(10, 20, []SkipTsUnit{
{
Start: 12,
End: 17,
},
})
if skip == false {
t.Fatal()
}
skip = isSkipByTsTime(10, 20, []SkipTsUnit{
{
Start: 18,
End: 28,
},
})
if skip == false {
t.Fatal()
}
skip = isSkipByTsTime(10, 20, []SkipTsUnit{
{
Start: 21,
End: 28,
},
})
if skip {
t.Fatal()
}
}