Add more tests for memrchr
Commit Message
On Mon, May 29, 2017 at 1:36 AM, Rafal Luzynski
<digitalfreak@lingonborough.com> 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.
Comments
On Mon, May 29, 2017 at 6:51 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, May 29, 2017 at 1:36 AM, Rafal Luzynski
> <digitalfreak@lingonborough.com> 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.
>
Any comments?
The patch is at
https://sourceware.org/ml/libc-alpha/2017-05/msg00833.html
On 04/06/2017 13:51, H.J. Lu wrote:
> On Mon, May 29, 2017 at 6:51 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Mon, May 29, 2017 at 1:36 AM, Rafal Luzynski
>> <digitalfreak@lingonborough.com> 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.
>>
>
> Any comments?
>
> The patch is at
>
> https://sourceware.org/ml/libc-alpha/2017-05/msg00833.html
>
>
LGTM, thanks.
From 1a458dd772f021067a3def3ce0d85301cccc6688 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
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(+)
@@ -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