Merge #20828: fuzz: Introduce CallOneOf helper to replace switch-case

Merge #20828: fuzz: Introduce CallOneOf helper to replace switch-case

fa75d40ef866ef9ff8dc115e239ca6763aa23b06 fuzz: Introduce CallOneOf helper to replace switch-case (MarcoFalke)

Pull request description:

  The current `switch (fuzzed_data_provider.ConsumeIntegralInRange<int>(0, nn)) { case 0: ... case 1: ... case nn: ...` has several problems:

  * It makes it hard to review newly added targets, because it requires manual counting of cases
  * It makes it hard to update a target, because updating all case labels is trivial, but tedious to review and causes merge conflicts
  * ~~Updating the target raises the question whether the case labels should be preserved to not invalidate the existing fuzz inputs format. Fuzz input format might already change implicitly on every commit, so this isn't something worthwhile to pursue.~~ Edit: This pull doesn't fix this problem.

  Fix all issues by adding a new `CallOneOf` helper

ACKs for top commit:
  ajtowns:
    ACK fa75d40ef866ef9ff8dc115e239ca6763aa23b06 - code review only
  jnewbery:
    utACK fa75d40ef866ef9ff8dc115e239ca6763aa23b06

Tree-SHA512: 2daa602b240b86c8e85a024e008f03a57ba60349377eed771f4d21a97a9dba9b66e93fff16ff1992018d4330be7a1a276944c3dfdf698748ce135626c380e563

情報元 - Merge #20828: fuzz: Introduce CallOneOf helper to replace switch-case · bitcoin/[email protected] · GitHub

Merge #20828: fuzz: Introduce CallOneOf helper to replace switch-case · bitcoin/bitcoin@29d2aeb · GitHub
スポンサーリンク

シェアする

フォローする

スポンサーリンク

トップへ戻る