Ejemplo n.º 1
0
func TestHashStreamTypes(t *testing.T) {
	h := fs.HashSHA1
	for _, test := range hashTestSet {
		sums, err := fs.HashStreamTypes(bytes.NewBuffer(test.input), fs.NewHashSet(h))
		require.NoError(t, err)
		assert.Len(t, sums, 1)
		assert.Equal(t, sums[h], test.output[h])
	}
}
Ejemplo n.º 2
0
func TestHashStreamTypes(t *testing.T) {
	h := fs.HashSHA1
	for _, test := range hashTestSet {
		sums, err := fs.HashStreamTypes(bytes.NewBuffer(test.input), fs.NewHashSet(h))
		if err != nil {
			t.Fatal(err)
		}
		if len(sums) != 1 {
			t.Fatalf("expected 1 sum, got %d", len(sums))
		}
		expect := test.output[h]
		if expect != sums[h] {
			t.Errorf("hash %d mismatch %q != %q", h, sums[h], expect)
		}
	}
}