Skip to content
Snippets Groups Projects
Select Git revision
  • 9258f54adceb28664a6a47ec573b4a60b76b65b0
  • without_tipselection default
  • develop protected
  • fix/grafana-local-dashboard
  • wasp
  • fix/dashboard-explorer-freeze
  • master
  • feat/timerqueue
  • test/sync_debug_and_650
  • feat/sync_revamp_inv
  • wip/sync
  • tool/db-recovery
  • portcheck/fix
  • fix/synchronization
  • feat/new-dashboard-analysis
  • feat/refactored-analysis-dashboard
  • feat/new-analysis-dashboard
  • test/demo-prometheus-fpc
  • prometheus_metrics
  • wip/analysis-server
  • merge/fpc-test-value-transfer
  • v0.2.2
  • v0.2.1
  • v0.2.0
  • v0.1.3
  • v0.1.2
  • v0.1.1
  • v0.1.0
28 results

protocol_v1.go

Blame
  • fpc_livefeed_test.go NaN GiB
    package dashboard
    
    import (
    	"crypto/sha256"
    	"testing"
    	"time"
    
    	"github.com/iotaledger/goshimmer/packages/vote"
    	"github.com/iotaledger/goshimmer/plugins/analysis/packet"
    	"github.com/mr-tron/base58/base58"
    	"github.com/stretchr/testify/require"
    )
    
    // TestCreateFPCUpdate checks that given a FPC heartbeat, the returned FPCUpdate is ok.
    func TestCreateFPCUpdate(t *testing.T) {
    	ownID := sha256.Sum256([]byte{'A'})
    	base58OwnID := base58.Encode(ownID[:])
    
    	// create a FPCHeartbeat
    	hbTest := &packet.FPCHeartbeat{
    		OwnID: ownID[:],
    		RoundStats: vote.RoundStats{
    			Duration: time.Second,
    			RandUsed: 0.5,
    			ActiveVoteContexts: map[string]*vote.Context{
    				"one": {
    					ID:       "one",
    					Liked:    1.,
    					Rounds:   3,
    					Opinions: []vote.Opinion{vote.Dislike, vote.Like, vote.Dislike},
    				}},
    		},
    	}
    
    	// create a matching FPCUpdate
    	want := &FPCUpdate{
    		Conflicts: conflictSet{
    			"one": {
    				NodesView: map[string]voteContext{
    					base58OwnID: {
    						NodeID:   base58OwnID,
    						Rounds:   3,
    						Opinions: []int32{disliked, liked, disliked},
    					},
    				},
    			},
    		},
    	}
    
    	// check that createFPCUpdate returns a matching FPCMsg
    	require.Equal(t, want, createFPCUpdate(hbTest))
    
    }