aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5/topic_test.go
diff options
context:
space:
mode:
authorBas van Kervel <basvankervel@gmail.com>2017-06-13 17:49:07 +0800
committerBas van Kervel <basvankervel@gmail.com>2017-06-15 17:53:15 +0800
commitb58a5016738b92db19e08ec87ef34ce3250fae6b (patch)
treefa9485b3f711204b14edae5dcbc812e624490c68 /whisper/whisperv5/topic_test.go
parent80f7c6c2996ad47f70a5070c400b1fd87a20c59c (diff)
downloadgo-tangerine-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar
go-tangerine-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.gz
go-tangerine-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.bz2
go-tangerine-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.lz
go-tangerine-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.xz
go-tangerine-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.zst
go-tangerine-b58a5016738b92db19e08ec87ef34ce3250fae6b.zip
whisperv5: integrate whisper and add whisper RPC simulator
Diffstat (limited to 'whisper/whisperv5/topic_test.go')
-rw-r--r--whisper/whisperv5/topic_test.go35
1 files changed, 15 insertions, 20 deletions
diff --git a/whisper/whisperv5/topic_test.go b/whisper/whisperv5/topic_test.go
index df566da36..63593963b 100644
--- a/whisper/whisperv5/topic_test.go
+++ b/whisper/whisperv5/topic_test.go
@@ -66,37 +66,32 @@ var unmarshalTestsGood = []struct {
topic TopicType
data []byte
}{
- {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte("0x00000000")},
- {topic: TopicType{0x00, 0x7f, 0x80, 0xff}, data: []byte("0x007f80ff")},
- {topic: TopicType{0xff, 0x80, 0x7f, 0x00}, data: []byte("0xff807f00")},
- {topic: TopicType{0xf2, 0x6e, 0x77, 0x79}, data: []byte("0xf26e7779")},
- {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte("00000000")},
- {topic: TopicType{0x00, 0x80, 0x01, 0x00}, data: []byte("00800100")},
- {topic: TopicType{0x00, 0x7f, 0x80, 0xff}, data: []byte("007f80ff")},
- {topic: TopicType{0xff, 0x80, 0x7f, 0x00}, data: []byte("ff807f00")},
- {topic: TopicType{0xf2, 0x6e, 0x77, 0x79}, data: []byte("f26e7779")},
+ {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte(`"0x00000000"`)},
+ {topic: TopicType{0x00, 0x7f, 0x80, 0xff}, data: []byte(`"0x007f80ff"`)},
+ {topic: TopicType{0xff, 0x80, 0x7f, 0x00}, data: []byte(`"0xff807f00"`)},
+ {topic: TopicType{0xf2, 0x6e, 0x77, 0x79}, data: []byte(`"0xf26e7779"`)},
}
var unmarshalTestsBad = []struct {
topic TopicType
data []byte
}{
- {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte("0x000000")},
- {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte("0x0000000")},
- {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte("0x000000000")},
- {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte("0x0000000000")},
- {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte("000000")},
- {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte("0000000")},
- {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte("000000000")},
- {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte("0000000000")},
- {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte("abcdefg0")},
+ {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte(`"0x000000"`)},
+ {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte(`"0x0000000"`)},
+ {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte(`"0x000000000"`)},
+ {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte(`"0x0000000000"`)},
+ {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte(`"000000"`)},
+ {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte(`"0000000"`)},
+ {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte(`"000000000"`)},
+ {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte(`"0000000000"`)},
+ {topic: TopicType{0x00, 0x00, 0x00, 0x00}, data: []byte(`"abcdefg0"`)},
}
var unmarshalTestsUgly = []struct {
topic TopicType
data []byte
}{
- {topic: TopicType{0x01, 0x00, 0x00, 0x00}, data: []byte("00000001")},
+ {topic: TopicType{0x01, 0x00, 0x00, 0x00}, data: []byte(`"0x00000001"`)},
}
func TestUnmarshalTestsGood(t *testing.T) {
@@ -104,7 +99,7 @@ func TestUnmarshalTestsGood(t *testing.T) {
var top TopicType
err := top.UnmarshalJSON(tst.data)
if err != nil {
- t.Fatalf("failed test %d. input: %v.", i, tst.data)
+ t.Fatalf("failed test %d. input: %v. err: %v", i, tst.data, err)
} else if top != tst.topic {
t.Fatalf("failed test %d: have %v, want %v.", i, t, tst.topic)
}