(t *testing.T)
| 95 | } |
| 96 | |
| 97 | func TestCommon_FindHash(t *testing.T) { |
| 98 | type Case struct { |
| 99 | name string |
| 100 | expected hash.Hash |
| 101 | } |
| 102 | |
| 103 | cases := []Case{ |
| 104 | {name: "SHA1", expected: sha1.New()}, |
| 105 | {name: "FOO", expected: nil}, |
| 106 | } |
| 107 | |
| 108 | for _, c := range cases { |
| 109 | actual := FindHash(c.name) |
| 110 | if actual == nil { |
| 111 | if c.expected != nil { |
| 112 | t.Fatalf("\nExpected: %s\n Got: nil", c.expected) |
| 113 | } |
| 114 | } else if h := actual(); !reflect.DeepEqual(c.expected, h) { |
| 115 | t.Fatalf("\nExpected: %s\n Got: %s", c.expected, h) |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | func TestCommon_ComputeHash(t *testing.T) { |
| 121 | type Case struct { |
nothing calls this directly
no test coverage detected