From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 7A2003857C5D for ; Fri, 22 Jul 2022 15:19:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7A2003857C5D Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B6CCB1FFAB for ; Fri, 22 Jul 2022 15:19:21 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A552313AB3 for ; Fri, 22 Jul 2022 15:19:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EWtJJ/m/2mK7BgAAMHmgww (envelope-from ) for ; Fri, 22 Jul 2022 15:19:21 +0000 Date: Fri, 22 Jul 2022 17:19:20 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb] Add empty range unit test for gdb::parallel_for_each Message-ID: <20220722151918.GA7272@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2022 15:19:24 -0000 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 }