| 32 | ) |
| 33 | |
| 34 | func TestAllFunction(t *testing.T) { |
| 35 | assert.Equal(t, true, scan.IsDir("/")) |
| 36 | assert.Equal(t, true, scan.IsFile("scanner_test.go")) |
| 37 | |
| 38 | files, err := scan.Files("./") |
| 39 | if err != nil { |
| 40 | t.Fatal(err) |
| 41 | } |
| 42 | assert.Equal(t, []string{"matcher.go", "scanner.go", "scanner_test.go"}, files) |
| 43 | |
| 44 | assert.Equal(t, func() string { |
| 45 | md5, _ := scan.Md5("scanner_test.go") |
| 46 | return md5 |
| 47 | }(), func() string { |
| 48 | md5, _ := scan.Md5("scanner_test.go") |
| 49 | return md5 |
| 50 | }()) |
| 51 | |
| 52 | assert.Equal(t, scan.HexDecode("scanner_test.go"), scan.HexDecode("scanner_test.go")) |
| 53 | assert.Equal(t, scan.HexEncode("scanner_test.go"), scan.HexEncode("scanner_test.go")) |
| 54 | |
| 55 | assert.Equal(t, func() string { |
| 56 | strHex, _ := scan.HexDump("scanner_test.go") |
| 57 | return strHex |
| 58 | }(), func() string { |
| 59 | strHex, _ := scan.HexDump("scanner_test.go") |
| 60 | return strHex |
| 61 | }()) |
| 62 | } |
| 63 | |
| 64 | func TestBlackMd5(t *testing.T) { |
| 65 | file, err := os.Open("scanner_test.go") |