1// SPDX-License-Identifier: ISC 2// Copyright (c) 2014-2020 Bitmark Inc. 3// Use of this source code is governed by an ISC 4// license that can be found in the LICENSE file. 5 6package fingerprint_test 7 8import ( 9 "encoding/hex" 10 "testing" 11 12 "github.com/stretchr/testify/assert" 13 14 "github.com/bitmark-inc/bitmarkd/announce/fingerprint" 15) 16 17func TestMarshalText(t *testing.T) { 18 f := fingerprint.Fingerprint{1, 2, 3, 4, 5} 19 20 size := hex.EncodedLen(len(f)) 21 expected := make([]byte, size) 22 hex.Encode(expected, f[:]) 23 24 marshaled, _ := f.MarshalText() 25 26 assert.Equal(t, expected, marshaled, "wrong MarshalText") 27} 28