summaryrefslogtreecommitdiff
path: root/auto_tests/tox_many_tcp_test.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-08-25 12:16:54 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-08-25 15:25:33 +0000
commit94b06818fbd7a93387ff4c155b6eff711651aea9 (patch)
tree63365adeb88705c5c2f0cdb4d2afd00a4bd8b43c /auto_tests/tox_many_tcp_test.c
parent0935aab92760a7c9c547faa86c29dcd0d1e03f24 (diff)
Use do-while instead of while in tests.
This forces all the loop bodies to be executed at least once, which is harmless since it just means one more tox event loop iteration. This reduces the jitter we see in coverage measurements, which is partially caused by loops sometimes being entered and sometimes not (because their condition happens to randomly already be true).
Diffstat (limited to 'auto_tests/tox_many_tcp_test.c')
-rw-r--r--auto_tests/tox_many_tcp_test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/auto_tests/tox_many_tcp_test.c b/auto_tests/tox_many_tcp_test.c
index b8343f74..e09ed8fb 100644
--- a/auto_tests/tox_many_tcp_test.c
+++ b/auto_tests/tox_many_tcp_test.c
@@ -101,7 +101,7 @@ loop_top:
101 ck_assert_msg(num != UINT32_MAX && test == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend error code: %i", test); 101 ck_assert_msg(num != UINT32_MAX && test == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend error code: %i", test);
102 } 102 }
103 103
104 while (1) { 104 while (true) {
105 uint16_t counter = 0; 105 uint16_t counter = 0;
106 106
107 for (i = 0; i < NUM_TOXES_TCP; ++i) { 107 for (i = 0; i < NUM_TOXES_TCP; ++i) {
@@ -197,7 +197,7 @@ loop_top:
197 197
198 uint16_t last_count = 0; 198 uint16_t last_count = 0;
199 199
200 while (1) { 200 while (true) {
201 uint16_t counter = 0; 201 uint16_t counter = 0;
202 202
203 for (i = 0; i < NUM_TOXES_TCP; ++i) { 203 for (i = 0; i < NUM_TOXES_TCP; ++i) {