MCPcopy Create free account
hub / github.com/CPChain/chain / TestBloom

Function TestBloom

types/bloom9_test.go:24–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func TestBloom(t *testing.T) {
25 positive := []string{
26 "testtest",
27 "test",
28 "hallo",
29 "other",
30 }
31 negative := []string{
32 "tes",
33 "lo",
34 }
35
36 var bloom Bloom
37 for _, data := range positive {
38 bloom.Add(new(big.Int).SetBytes([]byte(data)))
39 }
40
41 for _, data := range positive {
42 if !bloom.TestBytes([]byte(data)) {
43 t.Error("expected", data, "to test true")
44 }
45 }
46 for _, data := range negative {
47 if bloom.TestBytes([]byte(data)) {
48 t.Error("did not expect", data, "to test true")
49 }
50 }
51}
52
53/*
54import (

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
TestBytesMethod · 0.95
SetBytesMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected