| 46 | } |
| 47 | |
| 48 | func TestMatchHash(t *testing.T) { |
| 49 | absPath := func(path string) string { |
| 50 | abs, err := filepath.Abs(path) |
| 51 | if err != nil { |
| 52 | t.Fatal(err) |
| 53 | } |
| 54 | return abs |
| 55 | } |
| 56 | |
| 57 | var tests = []struct { |
| 58 | driverPath string |
| 59 | wantsName string |
| 60 | ok bool |
| 61 | }{ |
| 62 | { |
| 63 | absPath("_fixtures/d.sys"), |
| 64 | "d.sys", |
| 65 | true, |
| 66 | }, |
| 67 | { |
| 68 | absPath("_fixtures/iomem.sys"), |
| 69 | "iomem64.sys", |
| 70 | true, |
| 71 | }, |
| 72 | } |
| 73 | |
| 74 | for _, tt := range tests { |
| 75 | t.Run(tt.driverPath, func(t *testing.T) { |
| 76 | ok, d := GetClient().MatchHash(tt.driverPath) |
| 77 | assert.True(t, ok == tt.ok) |
| 78 | assert.Equal(t, tt.wantsName, d.Filename) |
| 79 | }) |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | func TestRefresh(t *testing.T) { |
| 84 | c = nil |