Use range based for loop #10844

pull ReneNyffenegger wants to merge 1 commits into bitcoin:master from ReneNyffenegger:dbwrapper_tests-for changing 1 files +5 −18
  1. ReneNyffenegger commented at 1:54 PM on July 16, 2017: contributor

    Instead of iterating over 0 .. 1 and then deciding on an actual desired value, use a range based for loop for the desired value.

  2. dcousens approved
  3. in src/test/dbwrapper_tests.cpp:27 in ab005dd40d outdated
      23 | @@ -24,8 +24,8 @@ BOOST_FIXTURE_TEST_SUITE(dbwrapper_tests, BasicTestingSetup)
      24 |  BOOST_AUTO_TEST_CASE(dbwrapper)
      25 |  {
      26 |      // Perform tests both obfuscated and non-obfuscated.
      27 | -    for (int i = 0; i < 2; i++) {
      28 | -        bool obfuscate = (bool)i;
      29 | +    for (bool obfuscate: { false, true } )
    


    practicalswift commented at 2:18 PM on July 16, 2017:

    Nit: Please use the form for (int x: {1, 2}) instead of for (int x: { 1, 2 } ).

    The former is the dominant form used in the repo:

    $ git grep -E "\{(true|false|0|1|2)" -- "*.cpp" | wc -l
    112
    $ git grep -E "\{ (true|false|0|1|2)" -- "*.cpp" | wc -l
    9
    
  4. practicalswift commented at 2:19 PM on July 16, 2017: contributor

    utACK ab005dd40dfc3e0e4ec126bbfc8144cd8a42e741

  5. MarcoFalke commented at 2:23 PM on July 16, 2017: member

    Make sure to adhere to the developer notes when touching code.

    https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#developer-notes

    There is even a link to a clang format script which should take care of white space and braces for you.

    On Sun, Jul 16, 2017 at 4:19 PM, practicalswift notifications@github.com wrote:

    utACK ab005dd https://github.com/bitcoin/bitcoin/commit/ab005dd40dfc3e0e4ec126bbfc8144cd8a42e741

    — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/pull/10844#issuecomment-315612207, or mute the thread https://github.com/notifications/unsubscribe-auth/AGGmv8DqLkFasoqXf5536iTb7Fn3OIgpks5sOhv-gaJpZM4OZTbC .

  6. Use range based for loop
    Instead of iterating over 0 .. 1 and then deciding on an actual desired
    value, use a range based for loop for the desired value.
    d0413c670b
  7. ReneNyffenegger force-pushed on Jul 16, 2017
  8. ReneNyffenegger commented at 3:07 PM on July 16, 2017: contributor

    I was unaware of the clang format script. Thaks for the pointer. I let it change the commit, and squashed and force-pushed it.

  9. TheBlueMatt commented at 4:48 PM on July 16, 2017: member

    utACK d0413c670b4e5dc79d5cc1bc35571fca745c9a24

  10. sipa commented at 7:01 PM on July 16, 2017: member

    utACK d0413c670b4e5dc79d5cc1bc35571fca745c9a24

  11. sipa merged this on Jul 16, 2017
  12. sipa closed this on Jul 16, 2017

  13. sipa referenced this in commit ad6fce67b9 on Jul 16, 2017
  14. MarcoFalke added the label Tests on Jul 16, 2017
  15. MarcoFalke added the label Refactoring on Jul 16, 2017
  16. MarcoFalke commented at 8:48 PM on July 16, 2017: member

    utACK d0413c6

  17. zkbot referenced this in commit 564a229927 on Apr 4, 2018
  18. zkbot referenced this in commit dc57d6a7bc on Apr 4, 2018
  19. PastaPastaPasta referenced this in commit eb383016a0 on Jul 6, 2019
  20. PastaPastaPasta referenced this in commit fedd45b808 on Jul 8, 2019
  21. PastaPastaPasta referenced this in commit f3980168ee on Jul 9, 2019
  22. PastaPastaPasta referenced this in commit d3d622e720 on Jul 11, 2019
  23. PastaPastaPasta referenced this in commit dbb5e5bff6 on Jul 13, 2019
  24. PastaPastaPasta referenced this in commit c6262f0f9b on Jul 13, 2019
  25. PastaPastaPasta referenced this in commit 35d5de45d3 on Jul 17, 2019
  26. PastaPastaPasta referenced this in commit ba74647db5 on Jul 23, 2019
  27. PastaPastaPasta referenced this in commit ab1120956e on Jul 24, 2019
  28. barrystyle referenced this in commit 6c8efedd9e on Jan 22, 2020
  29. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 06:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me