[committed][gdb] Add empty range unit test for gdb::parallel_for_each

Tom de Vries tdevries@suse.de
Fri Jul 22 15:19:20 GMT 2022


Hi,

Add a unit test that verifies that we can call gdb::parallel_for_each with an
empty range.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb] Add empty range unit test for gdb::parallel_for_each

---
 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
 }
 


More information about the Gdb-patches mailing list