diff options
author | Vlad <gluk256@gmail.com> | 2018-03-01 23:04:09 +0800 |
---|---|---|
committer | Vlad <gluk256@gmail.com> | 2018-03-01 23:04:09 +0800 |
commit | ee75a90ab41fd9a2e5676a2371e529ac2908befa (patch) | |
tree | 4545344b40b16757115b081b6bedd610ceb591e1 /whisper/whisperv6/whisper_test.go | |
parent | 5a150e1b7724c91009a237ab0879cd64844b390d (diff) | |
download | dexon-ee75a90ab41fd9a2e5676a2371e529ac2908befa.tar dexon-ee75a90ab41fd9a2e5676a2371e529ac2908befa.tar.gz dexon-ee75a90ab41fd9a2e5676a2371e529ac2908befa.tar.bz2 dexon-ee75a90ab41fd9a2e5676a2371e529ac2908befa.tar.lz dexon-ee75a90ab41fd9a2e5676a2371e529ac2908befa.tar.xz dexon-ee75a90ab41fd9a2e5676a2371e529ac2908befa.tar.zst dexon-ee75a90ab41fd9a2e5676a2371e529ac2908befa.zip |
whisper: topics replaced by bloom filters
Diffstat (limited to 'whisper/whisperv6/whisper_test.go')
-rw-r--r-- | whisper/whisperv6/whisper_test.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/whisper/whisperv6/whisper_test.go b/whisper/whisperv6/whisper_test.go index 3a219cd13..7fe256309 100644 --- a/whisper/whisperv6/whisper_test.go +++ b/whisper/whisperv6/whisper_test.go @@ -826,11 +826,11 @@ func TestSymmetricSendKeyMismatch(t *testing.T) { func TestBloom(t *testing.T) { topic := TopicType{0, 0, 255, 6} b := TopicToBloom(topic) - x := make([]byte, bloomFilterSize) + x := make([]byte, BloomFilterSize) x[0] = byte(1) x[32] = byte(1) - x[bloomFilterSize-1] = byte(128) - if !bloomFilterMatch(x, b) || !bloomFilterMatch(b, x) { + x[BloomFilterSize-1] = byte(128) + if !BloomFilterMatch(x, b) || !BloomFilterMatch(b, x) { t.Fatalf("bloom filter does not match the mask") } @@ -842,11 +842,11 @@ func TestBloom(t *testing.T) { if err != nil { t.Fatalf("math rand error") } - if !bloomFilterMatch(b, b) { + if !BloomFilterMatch(b, b) { t.Fatalf("bloom filter does not match self") } x = addBloom(x, b) - if !bloomFilterMatch(x, b) { + if !BloomFilterMatch(x, b) { t.Fatalf("bloom filter does not match combined bloom") } if !isFullNode(nil) { @@ -856,16 +856,16 @@ func TestBloom(t *testing.T) { if isFullNode(x) { t.Fatalf("isFullNode false positive") } - for i := 0; i < bloomFilterSize; i++ { + for i := 0; i < BloomFilterSize; i++ { b[i] = byte(255) } if !isFullNode(b) { t.Fatalf("isFullNode false negative") } - if bloomFilterMatch(x, b) { + if BloomFilterMatch(x, b) { t.Fatalf("bloomFilterMatch false positive") } - if !bloomFilterMatch(b, x) { + if !BloomFilterMatch(b, x) { t.Fatalf("bloomFilterMatch false negative") } @@ -879,7 +879,7 @@ func TestBloom(t *testing.T) { t.Fatalf("failed to set bloom filter: %s", err) } f = w.BloomFilter() - if !bloomFilterMatch(f, x) || !bloomFilterMatch(x, f) { + if !BloomFilterMatch(f, x) || !BloomFilterMatch(x, f) { t.Fatalf("retireved wrong bloom filter") } } |