From 9083a323bc7f7bfbff754e2ce93a3940608e09a2 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 22 Jul 2022 17:18:51 +0200 Subject: [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. --- gdb/unittests/parallel-for-selftests.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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 } -- cgit v1.2.1