mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
26 lines
634 B
Go
26 lines
634 B
Go
package feed
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
"github.com/ethereum/go-ethereum/swarm/testutil"
|
|
)
|
|
|
|
func TestTopic(tx *testing.T) {
|
|
t := testutil.BeginTest(tx, false) // set to true to generate results
|
|
defer t.FinishTest()
|
|
|
|
related, _ := hexutil.Decode("0xabcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789")
|
|
topicName := "test-topic"
|
|
topic, _ := NewTopic(topicName, related)
|
|
hex := topic.Hex()
|
|
t.EqualsKey("hex", hex)
|
|
|
|
var topic2 Topic
|
|
topic2.FromHex(hex)
|
|
t.Equals(topic, topic2)
|
|
t.Equals(topicName, topic2.Name(related))
|
|
|
|
t.TestJSONMarshaller("topic.json", &topic2)
|
|
}
|