good morning!!!!

Skip to content
Snippets Groups Projects
Select Git revision
  • 1c88d0e79cf62ff07e581d7439c627be9ff76124
  • master default protected
  • add-tests
  • extensions
  • gateway
  • codec-bundle
  • renovate/github.com-gfx-labs-sse-digest
  • renovate/golang.org-x-net-0.x
  • renovate/golang-1.x
  • jsonv2
  • garet
  • check
  • http-curse
  • whatthefuck
  • pool
  • envelope
  • mod
  • simplify
  • new-interface
  • v2
  • master-old
  • v0.8.1
  • v0.8.0
  • v0.7.0
  • v0.6.1
  • v0.6.0
  • v0.5.4
  • v0.5.3
  • v0.5.2
  • v0.5.1
  • v0.5.0
  • v0.4.19
  • v0.4.18
  • v0.4.17
  • v0.4.16
  • v0.4.15
  • v0.4.14
  • v0.4.13
  • v0.4.12
  • v0.4.11
  • v0.4.10
41 results

service.go

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    topic_test.go 902 B
    package whisper
    
    import (
    	"bytes"
    	"testing"
    )
    
    var topicCreationTests = []struct {
    	data []byte
    	hash [4]byte
    }{
    	{hash: [4]byte{0xc5, 0xd2, 0x46, 0x01}, data: nil},
    	{hash: [4]byte{0xc5, 0xd2, 0x46, 0x01}, data: []byte{}},
    	{hash: [4]byte{0x8f, 0x9a, 0x2b, 0x7d}, data: []byte("test name")},
    }
    
    func TestTopicCreation(t *testing.T) {
    	for i, tt := range topicCreationTests {
    		topic := NewTopic(tt.data)
    		if bytes.Compare(topic[:], tt.hash[:]) != 0 {
    			t.Errorf("test %d: hash mismatch: have %v, want %v.", i, topic, tt.hash)
    		}
    	}
    }
    
    func TestTopicSetCreation(t *testing.T) {
    	topics := make([]Topic, len(topicCreationTests))
    	for i, tt := range topicCreationTests {
    		topics[i] = NewTopic(tt.data)
    	}
    	set := NewTopicSet(topics)
    	for i, tt := range topicCreationTests {
    		topic := NewTopic(tt.data)
    		if _, ok := set[topic.String()]; !ok {
    			t.Errorf("topic %d: not found in set", i)
    		}
    	}
    }