Instead of iterating over 0 .. 1 and then deciding on an actual desired value, use a range based for loop for the desired value.
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-
ReneNyffenegger commented at 1:54 PM on July 16, 2017: contributor
- dcousens approved
-
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 offor (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 9practicalswift commented at 2:19 PM on July 16, 2017: contributorutACK ab005dd40dfc3e0e4ec126bbfc8144cd8a42e741
MarcoFalke commented at 2:23 PM on July 16, 2017: memberMake 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 .
d0413c670bUse 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.
ReneNyffenegger force-pushed on Jul 16, 2017ReneNyffenegger commented at 3:07 PM on July 16, 2017: contributorI was unaware of the clang format script. Thaks for the pointer. I let it change the commit, and squashed and force-pushed it.
TheBlueMatt commented at 4:48 PM on July 16, 2017: memberutACK d0413c670b4e5dc79d5cc1bc35571fca745c9a24
sipa commented at 7:01 PM on July 16, 2017: memberutACK d0413c670b4e5dc79d5cc1bc35571fca745c9a24
sipa merged this on Jul 16, 2017sipa closed this on Jul 16, 2017sipa referenced this in commit ad6fce67b9 on Jul 16, 2017MarcoFalke added the label Tests on Jul 16, 2017MarcoFalke added the label Refactoring on Jul 16, 2017MarcoFalke commented at 8:48 PM on July 16, 2017: memberutACK d0413c6
zkbot referenced this in commit 564a229927 on Apr 4, 2018zkbot referenced this in commit dc57d6a7bc on Apr 4, 2018PastaPastaPasta referenced this in commit eb383016a0 on Jul 6, 2019PastaPastaPasta referenced this in commit fedd45b808 on Jul 8, 2019PastaPastaPasta referenced this in commit f3980168ee on Jul 9, 2019PastaPastaPasta referenced this in commit d3d622e720 on Jul 11, 2019PastaPastaPasta referenced this in commit dbb5e5bff6 on Jul 13, 2019PastaPastaPasta referenced this in commit c6262f0f9b on Jul 13, 2019PastaPastaPasta referenced this in commit 35d5de45d3 on Jul 17, 2019PastaPastaPasta referenced this in commit ba74647db5 on Jul 23, 2019PastaPastaPasta referenced this in commit ab1120956e on Jul 24, 2019barrystyle referenced this in commit 6c8efedd9e on Jan 22, 2020DrahtBot locked this on Sep 8, 2021
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
More mirrored repositories can be found on mirror.b10c.me