@@ -303,9 +303,8 @@ func TestMatchEnvelope(t *testing.T) {
303303 t .Fatalf ("failed generateMessageParams with seed %d: %s." , seed , err )
304304 }
305305
306- params .Topic [0 ] = 0xFF // ensure mismatch
306+ params .Topic [0 ] = 0xFF // topic mismatch
307307
308- // mismatch with pseudo-random data
309308 msg , err := NewSentMessage (params )
310309 if err != nil {
311310 t .Fatalf ("failed to create new message with seed %d: %s." , seed , err )
@@ -315,11 +314,13 @@ func TestMatchEnvelope(t *testing.T) {
315314 t .Fatalf ("failed Wrap with seed %d: %s." , seed , err )
316315 }
317316 match := fsym .MatchEnvelope (env )
318- if match {
317+ if ! match {
318+ // topic mismatch should have no affect, as topics are handled by topic matchers
319319 t .Fatalf ("failed MatchEnvelope symmetric with seed %d." , seed )
320320 }
321321 match = fasym .MatchEnvelope (env )
322- if match {
322+ if ! match {
323+ // topic mismatch should have no affect, as topics are handled by topic matchers
323324 t .Fatalf ("failed MatchEnvelope asymmetric with seed %d." , seed )
324325 }
325326
@@ -396,7 +397,7 @@ func TestMatchEnvelope(t *testing.T) {
396397 // asymmetric + matching topic: match
397398 fasym .Topics [i ] = fasym .Topics [i + 1 ]
398399 match = fasym .MatchEnvelope (env )
399- if match {
400+ if ! match {
400401 t .Fatalf ("failed MatchEnvelope(asymmetric + matching topic) with seed %d." , seed )
401402 }
402403
@@ -431,7 +432,8 @@ func TestMatchEnvelope(t *testing.T) {
431432 // filter with topic + envelope without topic: mismatch
432433 fasym .Topics = fsym .Topics
433434 match = fasym .MatchEnvelope (env )
434- if match {
435+ if ! match {
436+ // topic mismatch should have no affect, as topics are handled by topic matchers
435437 t .Fatalf ("failed MatchEnvelope(filter without topic + envelope without topic) with seed %d." , seed )
436438 }
437439}
@@ -487,7 +489,8 @@ func TestMatchMessageSym(t *testing.T) {
487489
488490 // topic mismatch
489491 f .Topics [index ][0 ]++
490- if f .MatchMessage (msg ) {
492+ if ! f .MatchMessage (msg ) {
493+ // topic mismatch should have no affect, as topics are handled by topic matchers
491494 t .Fatalf ("failed MatchEnvelope(topic mismatch) with seed %d." , seed )
492495 }
493496 f .Topics [index ][0 ]--
@@ -580,7 +583,8 @@ func TestMatchMessageAsym(t *testing.T) {
580583
581584 // topic mismatch
582585 f .Topics [index ][0 ]++
583- if f .MatchMessage (msg ) {
586+ if ! f .MatchMessage (msg ) {
587+ // topic mismatch should have no affect, as topics are handled by topic matchers
584588 t .Fatalf ("failed MatchEnvelope(topic mismatch) with seed %d." , seed )
585589 }
586590 f .Topics [index ][0 ]--
@@ -829,8 +833,9 @@ func TestVariableTopics(t *testing.T) {
829833
830834 f .Topics [i ][lastTopicByte ]++
831835 match = f .MatchEnvelope (env )
832- if match {
833- t .Fatalf ("MatchEnvelope symmetric with seed %d, step %d: false positive." , seed , i )
836+ if ! match {
837+ // topic mismatch should have no affect, as topics are handled by topic matchers
838+ t .Fatalf ("MatchEnvelope symmetric with seed %d, step %d." , seed , i )
834839 }
835840 }
836841}
0 commit comments