MCPcopy
hub / github.com/kashav/fsql / TestCommon_FindHash

Function TestCommon_FindHash

transform/common_test.go:97–118  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func 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
120func TestCommon_ComputeHash(t *testing.T) {
121 type Case struct {

Callers

nothing calls this directly

Calls 1

FindHashFunction · 0.85

Tested by

no test coverage detected