aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/message_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-04-13 16:31:51 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-04-13 16:31:51 +0800
commit7b501906db5b4bed0cf9972a1b103cc343d7f2d2 (patch)
tree9336342ec2ee9e090323f6b8f01ea968e8e12b39 /whisper/message_test.go
parent5467e7b312a29f492ce3063686711ea0bea6dbc3 (diff)
downloadgo-tangerine-7b501906db5b4bed0cf9972a1b103cc343d7f2d2.tar.gz
go-tangerine-7b501906db5b4bed0cf9972a1b103cc343d7f2d2.tar.zst
go-tangerine-7b501906db5b4bed0cf9972a1b103cc343d7f2d2.zip
whisper: separate out magic number from the code
Diffstat (limited to 'whisper/message_test.go')
-rw-r--r--whisper/message_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/whisper/message_test.go b/whisper/message_test.go
index 8d4c5e990..319bc6025 100644
--- a/whisper/message_test.go
+++ b/whisper/message_test.go
@@ -16,8 +16,8 @@ func TestMessageSimpleWrap(t *testing.T) {
if _, err := msg.Wrap(DefaultProofOfWork, Options{}); err != nil {
t.Fatalf("failed to wrap message: %v", err)
}
- if msg.Flags&128 != 0 {
- t.Fatalf("signature flag mismatch: have %d, want %d", (msg.Flags&128)>>7, 0)
+ if msg.Flags&signatureFlag != 0 {
+ t.Fatalf("signature flag mismatch: have %d, want %d", msg.Flags&signatureFlag, 0)
}
if len(msg.Signature) != 0 {
t.Fatalf("signature found for simple wrapping: 0x%x", msg.Signature)
@@ -41,8 +41,8 @@ func TestMessageCleartextSignRecover(t *testing.T) {
}); err != nil {
t.Fatalf("failed to sign message: %v", err)
}
- if msg.Flags&128 != 128 {
- t.Fatalf("signature flag mismatch: have %d, want %d", (msg.Flags&128)>>7, 1)
+ if msg.Flags&signatureFlag != signatureFlag {
+ t.Fatalf("signature flag mismatch: have %d, want %d", msg.Flags&signatureFlag, signatureFlag)
}
if bytes.Compare(msg.Payload, payload) != 0 {
t.Fatalf("payload mismatch after signing: have 0x%x, want 0x%x", msg.Payload, payload)
@@ -75,8 +75,8 @@ func TestMessageAnonymousEncryptDecrypt(t *testing.T) {
if err != nil {
t.Fatalf("failed to encrypt message: %v", err)
}
- if msg.Flags&128 != 0 {
- t.Fatalf("signature flag mismatch: have %d, want %d", (msg.Flags&128)>>7, 0)
+ if msg.Flags&signatureFlag != 0 {
+ t.Fatalf("signature flag mismatch: have %d, want %d", msg.Flags&signatureFlag, 0)
}
if len(msg.Signature) != 0 {
t.Fatalf("signature found for anonymous message: 0x%x", msg.Signature)
@@ -111,8 +111,8 @@ func TestMessageFullCrypto(t *testing.T) {
if err != nil {
t.Fatalf("failed to encrypt message: %v", err)
}
- if msg.Flags&128 != 128 {
- t.Fatalf("signature flag mismatch: have %d, want %d", (msg.Flags&128)>>7, 1)
+ if msg.Flags&signatureFlag != signatureFlag {
+ t.Fatalf("signature flag mismatch: have %d, want %d", msg.Flags&signatureFlag, signatureFlag)
}
if len(msg.Signature) == 0 {
t.Fatalf("no signature found for signed message")