Skip to content

Commit

Permalink
added PrefixBytesTest
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnya97 committed Apr 7, 2018
1 parent 4bcfcd5 commit 9b40cf1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions types/store_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package types

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestPrefixEndBytes(t *testing.T) {
assert := assert.New(t)

var testCases = []struct {
prefix []byte
expected []byte
}{
{[]byte{byte(55), byte(255), byte(255), byte(0)}, []byte{byte(55), byte(255), byte(255), byte(1)}},
{[]byte{byte(55), byte(255), byte(255), byte(15)}, []byte{byte(55), byte(255), byte(255), byte(16)}},
{[]byte{byte(55), byte(200), byte(255)}, []byte{byte(55), byte(201)}},
{[]byte{byte(55), byte(255), byte(255)}, []byte{byte(56)}},
{[]byte{byte(255), byte(255), byte(255)}, nil},
{nil, nil},
}

for _, test := range testCases {
end := PrefixEndBytes(test.prefix)
assert.Equal(test.expected, end)
}
}

0 comments on commit 9b40cf1

Please sign in to comment.