Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrufky committed Feb 14, 2020
1 parent 62d53b9 commit 6b3414b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions verification/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ func TestVerify(t *testing.T) {
assert.Equal(ErrPixelsAbsent, err)
assert.Equal("mno", string(res.ManifestID)) // Still return best result

// Bug: higher score but wrong pixels still returns results

This comment has been minimized.

Copy link
@j0sh

j0sh Feb 14, 2020

Contributor

Technically not a bug anymore after this PR :) A more up-to-date message would be something like, "A high score should still fail if pixel checking fails"

verifier.results = &Results{Score: 20.0, Pixels: []int64{-1, -2}}
res, err = sv.Verify(&Params{ManifestID: "vws", Results: data})
assert.Equal(ErrPixelMismatch, err)
assert.Equal("mno", string(res.ManifestID))

// Check *not* retryable; should never get a result
sv = NewSegmentVerifier(&Policy{Verifier: verifier, Retries: 1}) // reset
verifier.err = errors.New("Stub Verifier Non-Retryable Error")
Expand Down

1 comment on commit 6b3414b

@mkrufky
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, I think the vws score should be even higher than the mno score, to make sure the test is testing the right thing. done in c28822c

Please sign in to comment.