From: Tom de Vries Date: Fri, 22 Jul 2022 15:18:51 +0000 (+0200) Subject: [gdb] Add empty range unit test for gdb::parallel_for_each X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9083a323bc7f7bfbff754e2ce93a3940608e09a2;p=binutils-gdb.git [gdb] Add empty range unit test for gdb::parallel_for_each Add a unit test that verifies that we can call gdb::parallel_for_each with an empty range. Tested on x86_64-linux. --- diff --git a/gdb/unittests/parallel-for-selftests.c b/gdb/unittests/parallel-for-selftests.c index e0c07e55e03..8a86b435fd3 100644 --- a/gdb/unittests/parallel-for-selftests.c +++ b/gdb/unittests/parallel-for-selftests.c @@ -60,6 +60,14 @@ test (int n_threads) SELF_CHECK (counter == NUMBER); + counter = 0; + gdb::parallel_for_each (1, 0, 0, + [&] (int start, int end) + { + counter += end - start; + }); + SELF_CHECK (counter == 0); + #undef NUMBER }