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
|
package main
import (
"fmt"
"testing"
)
func TestFullyIncludes(t *testing.T) {
cases := []struct {
LeftTime string
RightTime string
Want bool
Description string
}{
{
LeftTime: "06:12.240",
RightTime: "06:16.040",
Want: true,
Description: "right time is bigger",
},
{
LeftTime: "06:18.240",
RightTime: "06:16.040",
Want: false,
Description: "left time is bigger: inadequate",
},
{
LeftTime: "06:18.240",
RightTime: "06:18.240",
Want: false,
Description: "left == right: inadequate",
},
{
LeftTime: "01:00:08.000",
RightTime: "59:37.800",
Want: false,
Description: "with hours: left time is bigger: inadequate",
},
{
LeftTime: "59:37.800",
RightTime: "01:00:08.000",
Want: true,
Description: "with hours: right time is bigger",
},
{
LeftTime: "01:00:04.900",
RightTime: "01:02:08.000",
Want: true,
Description: "with hours: right time is bigger",
},
{
LeftTime: "01:02:08.000",
RightTime: "01:00:04.900",
Want: false,
Description: "with hours: left time is bigger",
},
}
for i, tc := range cases {
t.Run(fmt.Sprintf("run: #%d; %q", i, tc.Description), func(t *testing.T) {
got := adequateTimes(tc.LeftTime, tc.RightTime)
if got != tc.Want {
t.Errorf("want: %v; got: %v", tc.Want, got)
}
})
}
}
func TestHashStr(t *testing.T) {
cases := []struct {
Input string
Want string
Description string
}{
{
Input: "Let's Play Reļ¼Kinder [Rpg Maker Horror] #5 - Im Meer der traurigen Erinnerungen [iU9Un035p3A].opus",
Want: "b047af2cb102a2a6b15007108f99cfef",
Description: "sum of filename example",
},
{
Input: "",
Want: "d41d8cd98f00b204e9800998ecf8427e",
Description: "sum of empty string",
},
}
for i, tc := range cases {
t.Run(fmt.Sprintf("run: #%d; %q", i, tc.Description), func(t *testing.T) {
got := hashStr(tc.Input)
if got != tc.Want {
t.Errorf("want: %v; got: %v", tc.Want, got)
}
})
}
}
|