aboutsummaryrefslogtreecommitdiff
path: root/gdb/unittests
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2022-07-22 17:18:51 +0200
committerTom de Vries <tdevries@suse.de>2022-07-22 17:18:51 +0200
commit9083a323bc7f7bfbff754e2ce93a3940608e09a2 (patch)
treed6c76f73c39c927ed1833d8240bc025721f84f3d /gdb/unittests
parent6577f365ebdee7dda71cb996efa29d3714cbccd0 (diff)
downloadfsf-binutils-gdb-9083a323bc7f7bfbff754e2ce93a3940608e09a2.zip
fsf-binutils-gdb-9083a323bc7f7bfbff754e2ce93a3940608e09a2.tar.gz
fsf-binutils-gdb-9083a323bc7f7bfbff754e2ce93a3940608e09a2.tar.bz2
[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.
Diffstat (limited to 'gdb/unittests')
-rw-r--r--gdb/unittests/parallel-for-selftests.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/unittests/parallel-for-selftests.c b/gdb/unittests/parallel-for-selftests.c
index e0c07e5..8a86b43 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
}