Page MenuHomePhabricator

Fix off by one errors in the difference fomatter serialize_tests
ClosedPublic

Authored by Fabien on Jun 3 2022, 18:58.

Details

Summary

One of the overflow test added in D11515 is not doing what is expected, due to a couple errors:

  • the MAX_SIZE value is a compact size difference value, so the indexes should increment by MAX_SIZE+1
  • the loop size if off by one
Test Plan
ninja check-bitcoin-serialize_tests

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested review of this revision.Jun 3 2022, 18:58
sdulfari requested changes to this revision.Jun 3 2022, 20:55
sdulfari added a subscriber: sdulfari.
sdulfari added inline comments.
src/test/serialize_tests.cpp
509 ↗(On Diff #33813)

Instead of trusting that this version of the test is correct, is it possible to write this in a way that you copy ss and check that remainder - 1 does not overflow? Basically do what your test plan does, but in the test itself.

This revision now requires changes to proceed.Jun 3 2022, 20:55
This revision is now accepted and ready to land.Jun 3 2022, 21:13