mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-05 11:21:58 -05:00
4e54c44d56
fix misspellings; fix code that was not gofmt'd - plus take advantage of gofmt -s too; couple of unreachable golint reported fixes; reference go report card results and tests
31 lines
883 B
Go
31 lines
883 B
Go
// Copyright 2016 Attic Labs, Inc. All rights reserved.
|
|
// Licensed under the Apache License, version 2.0:
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
package datas
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/attic-labs/noms/go/hash"
|
|
"github.com/attic-labs/testify/assert"
|
|
)
|
|
|
|
func TestHintRoundTrip(t *testing.T) {
|
|
b := &bytes.Buffer{}
|
|
input := map[hash.Hash]struct{}{
|
|
hash.Parse("00000000000000000000000000000000"): {},
|
|
hash.Parse("00000000000000000000000000000001"): {},
|
|
hash.Parse("00000000000000000000000000000002"): {},
|
|
hash.Parse("00000000000000000000000000000003"): {},
|
|
}
|
|
serializeHints(b, input)
|
|
output := deserializeHints(b)
|
|
assert.Len(t, output, len(input), "Output has different number of elements than input: %v, %v", output, input)
|
|
for h := range output {
|
|
_, present := input[h]
|
|
assert.True(t, present, "%s is in output but not in input", h)
|
|
}
|
|
}
|