|
|
|
@ -3,6 +3,7 @@ package whisper |
|
|
|
|
import ( |
|
|
|
|
"bytes" |
|
|
|
|
"testing" |
|
|
|
|
"time" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func TestEnvelopeOpen(t *testing.T) { |
|
|
|
@ -26,9 +27,12 @@ func TestEnvelopeOpen(t *testing.T) { |
|
|
|
|
if bytes.Compare(opened.Payload, message.Payload) != 0 { |
|
|
|
|
t.Fatalf("payload mismatch: have 0x%x, want 0x%x", opened.Payload, message.Payload) |
|
|
|
|
} |
|
|
|
|
if opened.Sent != message.Sent { |
|
|
|
|
if opened.Sent.Unix() != message.Sent.Unix() { |
|
|
|
|
t.Fatalf("send time mismatch: have %d, want %d", opened.Sent, message.Sent) |
|
|
|
|
} |
|
|
|
|
if opened.TTL/time.Second != DefaultTTL/time.Second { |
|
|
|
|
t.Fatalf("message TTL mismatch: have %v, want %v", opened.TTL, DefaultTTL) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if opened.Hash != envelope.Hash() { |
|
|
|
|
t.Fatalf("message hash mismatch: have 0x%x, want 0x%x", opened.Hash, envelope.Hash()) |
|
|
|
|