github.com/alexdevranger/node-1.8.27@v0.0.0-20221128213301-aa5841e41d2d/swarm/storage/feed/id_test.go (about)

     1  package feed
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/alexdevranger/node-1.8.27/swarm/storage/feed/lookup"
     7  )
     8  
     9  func getTestID() *ID {
    10  	return &ID{
    11  		Feed:  *getTestFeed(),
    12  		Epoch: lookup.GetFirstEpoch(1000),
    13  	}
    14  }
    15  
    16  func TestIDAddr(t *testing.T) {
    17  	id := getTestID()
    18  	updateAddr := id.Addr()
    19  	compareByteSliceToExpectedHex(t, "updateAddr", updateAddr, "0x8b24583ec293e085f4c78aaee66d1bc5abfb8b4233304d14a349afa57af2a783")
    20  }
    21  
    22  func TestIDSerializer(t *testing.T) {
    23  	testBinarySerializerRecovery(t, getTestID(), "0x776f726c64206e657773207265706f72742c20657665727920686f7572000000876a8936a7cd0b79ef0735ad0896c1afe278781ce803000000000019")
    24  }
    25  
    26  func TestIDLengthCheck(t *testing.T) {
    27  	testBinarySerializerLengthCheck(t, getTestID())
    28  }