Skip to content
Snippets Groups Projects
Select Git revision
  • 7db8e8e11d8b06866895d857963ecd0096f3741b
  • develop default protected
  • congestioncontrol
  • merge-v-data-collection-spammer-0.8.2
  • WIP-merge-v-data-collection-spammer-0.8.2
  • merge-v-data-collection-spammer-0.7.7
  • tmp
  • test-masterpow-fixing
  • test-masterpow
  • test-echo
  • v-data-collection
  • v-data-collection-spammer
  • tmp-dump-spam-info
  • dump-msg-info-0.3.1
  • test-dump-message-info
  • spammer-exprandom
  • extra/tutorial
  • without_tipselection
  • hacking-docker-network
  • hacking-docker-network-0.2.3
  • master
  • v0.2.3
22 results

balance_test.go

Blame
  • user avatar
    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
    18dba17c
    History
    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())
    }