github.com/annchain/OG@v0.0.9/og/syncer/cache_test.go (about)

     1  package syncer
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/annchain/OG/arefactor/og/types"
     6  	"testing"
     7  )
     8  
     9  func TestSequencerCache_Add(t *testing.T) {
    10  	p := NewSequencerCache(7)
    11  	fmt.Println(p)
    12  	var hashes types.Hashes
    13  	for i := 0; i < 10; i++ {
    14  		hash := types.RandomHash()
    15  		hashes = append(hashes, hash)
    16  		p.Add(hash, fmt.Sprintf("%d", i))
    17  	}
    18  	fmt.Println(hashes)
    19  	fmt.Println(p)
    20  	for _, hash := range hashes {
    21  		fmt.Println(p.GetPeer(hash), hash)
    22  	}
    23  }