Select Git revision
balance_test.go
Hans Moog
authored and
GitHub
committed
* Fix: fixed some error must be last param * Refactor: continued refactoring according to golint * Refactor: addresses more golint warnings * Refactor: refactored error last * Fix: fixed hive.go * Refactor: refactored alot according to golang-ci-list * Refactor: intermediary commit * Refactor: refactored additional code according to golint-ci * Refactor: continued to refactor according to golint * Refactor: refactored according to golint * Fix: fixed last golinter reports
balance_test.go 590 B
package balance
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestMarshalUnmarshal(t *testing.T) {
balance := New(ColorIOTA, 1337)
assert.Equal(t, int64(1337), balance.Value())
assert.Equal(t, ColorIOTA, balance.Color())
marshaledBalance := balance.Bytes()
assert.Equal(t, Length, len(marshaledBalance))
restoredBalance, consumedBytes, err := FromBytes(marshaledBalance)
if err != nil {
panic(err)
}
assert.Equal(t, Length, consumedBytes)
assert.Equal(t, balance.value, restoredBalance.Value())
assert.Equal(t, balance.color, restoredBalance.Color())
}