|
|
@ -303,9 +303,8 @@ func TestMatchEnvelope(t *testing.T) { |
|
|
|
t.Fatalf("failed generateMessageParams with seed %d: %s.", seed, err) |
|
|
|
t.Fatalf("failed generateMessageParams with seed %d: %s.", seed, err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
params.Topic[0] = 0xFF // ensure mismatch
|
|
|
|
params.Topic[0] = 0xFF // topic mismatch
|
|
|
|
|
|
|
|
|
|
|
|
// mismatch with pseudo-random data
|
|
|
|
|
|
|
|
msg, err := NewSentMessage(params) |
|
|
|
msg, err := NewSentMessage(params) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("failed to create new message with seed %d: %s.", seed, err) |
|
|
|
t.Fatalf("failed to create new message with seed %d: %s.", seed, err) |
|
|
@ -315,11 +314,13 @@ func TestMatchEnvelope(t *testing.T) { |
|
|
|
t.Fatalf("failed Wrap with seed %d: %s.", seed, err) |
|
|
|
t.Fatalf("failed Wrap with seed %d: %s.", seed, err) |
|
|
|
} |
|
|
|
} |
|
|
|
match := fsym.MatchEnvelope(env) |
|
|
|
match := fsym.MatchEnvelope(env) |
|
|
|
if match { |
|
|
|
if !match { |
|
|
|
|
|
|
|
// topic mismatch should have no affect, as topics are handled by topic matchers
|
|
|
|
t.Fatalf("failed MatchEnvelope symmetric with seed %d.", seed) |
|
|
|
t.Fatalf("failed MatchEnvelope symmetric with seed %d.", seed) |
|
|
|
} |
|
|
|
} |
|
|
|
match = fasym.MatchEnvelope(env) |
|
|
|
match = fasym.MatchEnvelope(env) |
|
|
|
if match { |
|
|
|
if !match { |
|
|
|
|
|
|
|
// topic mismatch should have no affect, as topics are handled by topic matchers
|
|
|
|
t.Fatalf("failed MatchEnvelope asymmetric with seed %d.", seed) |
|
|
|
t.Fatalf("failed MatchEnvelope asymmetric with seed %d.", seed) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -396,7 +397,7 @@ func TestMatchEnvelope(t *testing.T) { |
|
|
|
// asymmetric + matching topic: match
|
|
|
|
// asymmetric + matching topic: match
|
|
|
|
fasym.Topics[i] = fasym.Topics[i+1] |
|
|
|
fasym.Topics[i] = fasym.Topics[i+1] |
|
|
|
match = fasym.MatchEnvelope(env) |
|
|
|
match = fasym.MatchEnvelope(env) |
|
|
|
if match { |
|
|
|
if !match { |
|
|
|
t.Fatalf("failed MatchEnvelope(asymmetric + matching topic) with seed %d.", seed) |
|
|
|
t.Fatalf("failed MatchEnvelope(asymmetric + matching topic) with seed %d.", seed) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -431,7 +432,8 @@ func TestMatchEnvelope(t *testing.T) { |
|
|
|
// filter with topic + envelope without topic: mismatch
|
|
|
|
// filter with topic + envelope without topic: mismatch
|
|
|
|
fasym.Topics = fsym.Topics |
|
|
|
fasym.Topics = fsym.Topics |
|
|
|
match = fasym.MatchEnvelope(env) |
|
|
|
match = fasym.MatchEnvelope(env) |
|
|
|
if match { |
|
|
|
if !match { |
|
|
|
|
|
|
|
// topic mismatch should have no affect, as topics are handled by topic matchers
|
|
|
|
t.Fatalf("failed MatchEnvelope(filter without topic + envelope without topic) with seed %d.", seed) |
|
|
|
t.Fatalf("failed MatchEnvelope(filter without topic + envelope without topic) with seed %d.", seed) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -487,7 +489,8 @@ func TestMatchMessageSym(t *testing.T) { |
|
|
|
|
|
|
|
|
|
|
|
// topic mismatch
|
|
|
|
// topic mismatch
|
|
|
|
f.Topics[index][0]++ |
|
|
|
f.Topics[index][0]++ |
|
|
|
if f.MatchMessage(msg) { |
|
|
|
if !f.MatchMessage(msg) { |
|
|
|
|
|
|
|
// topic mismatch should have no affect, as topics are handled by topic matchers
|
|
|
|
t.Fatalf("failed MatchEnvelope(topic mismatch) with seed %d.", seed) |
|
|
|
t.Fatalf("failed MatchEnvelope(topic mismatch) with seed %d.", seed) |
|
|
|
} |
|
|
|
} |
|
|
|
f.Topics[index][0]-- |
|
|
|
f.Topics[index][0]-- |
|
|
@ -580,7 +583,8 @@ func TestMatchMessageAsym(t *testing.T) { |
|
|
|
|
|
|
|
|
|
|
|
// topic mismatch
|
|
|
|
// topic mismatch
|
|
|
|
f.Topics[index][0]++ |
|
|
|
f.Topics[index][0]++ |
|
|
|
if f.MatchMessage(msg) { |
|
|
|
if !f.MatchMessage(msg) { |
|
|
|
|
|
|
|
// topic mismatch should have no affect, as topics are handled by topic matchers
|
|
|
|
t.Fatalf("failed MatchEnvelope(topic mismatch) with seed %d.", seed) |
|
|
|
t.Fatalf("failed MatchEnvelope(topic mismatch) with seed %d.", seed) |
|
|
|
} |
|
|
|
} |
|
|
|
f.Topics[index][0]-- |
|
|
|
f.Topics[index][0]-- |
|
|
@ -829,8 +833,9 @@ func TestVariableTopics(t *testing.T) { |
|
|
|
|
|
|
|
|
|
|
|
f.Topics[i][lastTopicByte]++ |
|
|
|
f.Topics[i][lastTopicByte]++ |
|
|
|
match = f.MatchEnvelope(env) |
|
|
|
match = f.MatchEnvelope(env) |
|
|
|
if match { |
|
|
|
if !match { |
|
|
|
t.Fatalf("MatchEnvelope symmetric with seed %d, step %d: false positive.", seed, i) |
|
|
|
// topic mismatch should have no affect, as topics are handled by topic matchers
|
|
|
|
|
|
|
|
t.Fatalf("MatchEnvelope symmetric with seed %d, step %d.", seed, i) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|