-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathduplicate_file_test.go
42 lines (39 loc) · 1.05 KB
/
duplicate_file_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
package duplicate_file
import (
"fmt"
"reflect"
"testing"
)
var (
testDir = "/home/vagrant/temp_dir"
)
func TestDuplicateFileContent(t *testing.T) {
rv := SameContentFiles(testDir)
expectedMap := make(map[string][]string)
expectedMap["322d8361849d9f0de2bdffac9f4050b2"] = []string{
"/home/vagrant/temp_dir/b.txt",
"/home/vagrant/temp_dir/d.txt",
"/home/vagrant/temp_dir/d1/b_dup.txt",
}
expectedMap["fc78c7e108a64f944ff2ee8f51c23c55"] = []string{
"/home/vagrant/temp_dir/f.txt",
"/home/vagrant/temp_dir/f1.txt",
}
expectedMap["7f0f3cf2d246125248a6a74c261ec89e"] = []string{
"/home/vagrant/temp_dir/a.txt",
"/home/vagrant/temp_dir/c.txt",
"/home/vagrant/temp_dir/d1/a_dup.txt",
"/home/vagrant/temp_dir/e.txt",
}
if !reflect.DeepEqual(rv, expectedMap) {
fmt.Println("")
fmt.Println("===============RETURN INFORMATION=============")
fmt.Println("")
printDuplicateFileContent(rv)
fmt.Println("")
fmt.Println("===============EXPECTED INFORMATION===========")
fmt.Println("")
printDuplicateFileContent(expectedMap)
t.Error()
}
}