From patchwork Mon May 29 13:51:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 20621 Received: (qmail 21194 invoked by alias); 29 May 2017 13:51:26 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 21169 invoked by uid 89); 29 May 2017 13:51:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f174.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=8gv5oN6sbmfbi9snKT3+Rc39JKEEQ9y+458pUGGheOc=; b=jcFtFRZM5zsdvis4vQxIKVneM0fEIgWvmWD11wjbW71ZicRaft0jOPuv//CFWyv0mf u8t/QT8smQCuMiCOCqRXYh+Kw4HIm3fTeaMdhQawkINjUNGQqt0DE3B8/7gDd16f0nf5 ljZNqiEy/Nn1sLeFilICAQ9grefi/puTO52qNkAZDSkWxV8HyN3DavtqIcuTaeBUPTSM MnVfP73DCrIHjVPZIViXOLTpumtEkwOtS7mIaxWrzCpDYl01fAPrDOOSH9kMaIEKXrdt VWeXKcw1ipBqLumVgBCwn5n52Iy/b6gh+0DeFoYUGCy6TVTyEUgC4pRi0uMMcJcaxVvB YKxA== X-Gm-Message-State: AODbwcCO7OGWyl5AmQAsX6Qo7aUDzlpyq96W9YXq87w76i89pbGRBiGG 1gt3QzMG1UfFovi6juLEK5WXsTlPcg== X-Received: by 10.200.44.98 with SMTP id e31mr19574836qta.123.1496065886174; Mon, 29 May 2017 06:51:26 -0700 (PDT) MIME-Version: 1.0 From: "H.J. Lu" Date: Mon, 29 May 2017 06:51:25 -0700 Message-ID: Subject: [PATCH] Add more tests for memrchr To: Rafal Luzynski Cc: GNU C Library , "H.J. Lu" On Mon, May 29, 2017 at 1:36 AM, Rafal Luzynski wrote: > If the subject line of this message is an actual commit comment > then shouldn't it say "memrchr" instead of "memchr"? > > Otherwise I think I'm unable to tell for sure if the patch is > correct or not. Oops. Fixed: This patch adds some memrchr tests for len == 0 and for positions close to the beginning, which are equivalent to positions close to the end for memchr. * string/test-memrchr.c (test_main): Add tests for len == 0 and for positions close to the beginning, which are equivalent to positions close to the end for memchr. From 1a458dd772f021067a3def3ce0d85301cccc6688 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 24 May 2017 08:41:23 -0700 Subject: [PATCH] Add more tests for memrchr This patch adds some memrchr tests for len == 0 and for positions close to the beginning, which are equivalent to positions close to the end for memchr. * string/test-memrchr.c (test_main): Add tests for len == 0 and for positions close to the beginning, which are equivalent to positions close to the end for memchr. --- string/test-memrchr.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/string/test-memrchr.c b/string/test-memrchr.c index bfc9920..15483f5 100644 --- a/string/test-memrchr.c +++ b/string/test-memrchr.c @@ -151,15 +151,32 @@ test_main (void) for (i = 1; i < 8; ++i) { + /* Test len == 0. */ + do_test (i, i, 0, 0); + do_test (i, i, 0, 23); + do_test (0, 16 << i, 2048, 23); do_test (i, 64, 256, 23); do_test (0, 16 << i, 2048, 0); do_test (i, 64, 256, 0); + + do_test (0, i, 256, 23); + do_test (0, i, 256, 0); + do_test (i, i, 256, 23); + do_test (i, i, 256, 0); + } for (i = 1; i < 32; ++i) { do_test (0, i, i + 1, 23); do_test (0, i, i + 1, 0); + do_test (i, i, i + 1, 23); + do_test (i, i, i + 1, 0); + + do_test (0, 1, i + 1, 23); + do_test (0, 2, i + 1, 0); + do_test (i, 1, i + 1, 23); + do_test (i, 2, i + 1, 0); } do_random_tests (); -- 2.9.4