[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfafpEBccivDRC2AVVJbZL2Kdq2KeR0yf_nwTtDTxvDkg@mail.gmail.com>
Date: Tue, 2 Nov 2021 10:11:16 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Andriy Tryshnivskyy <andriy.tryshnivskyy@...nsynergy.com>
Cc: Vasyl.Vavrychuk@...nsynergy.com, jbhayana@...gle.com,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
linux-iio <linux-iio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v7 3/3] iio: test: Add test for IIO_VAL_INT_64.
On Tue, Nov 2, 2021 at 9:33 AM Andriy Tryshnivskyy
<andriy.tryshnivskyy@...nsynergy.com> wrote:
>
Now it's good with format, but you have missed the commit message.
> Signed-off-by: Andriy Tryshnivskyy <andriy.tryshnivskyy@...nsynergy.com>
...
> +static void iio_test_iio_format_value_integer_64(struct kunit *test)
> +{
> + char *buf = kunit_kmalloc(test, PAGE_SIZE, GFP_KERNEL);
Shouldn't this be checked against NULL?
> + s64 value;
> + int values[2];
> + int ret;
Reversed xmas tree ordering?
> + value = 24;
> + values[0] = lower_32_bits(value);
> + values[1] = upper_32_bits(value);
> + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values);
ARRAY_SIZE()?
> + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "24\n");
> +
> + value = -24;
> + values[0] = lower_32_bits(value);
> + values[1] = upper_32_bits(value);
> + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values);
> + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "-24\n");
> +
> + value = 0;
> + values[0] = lower_32_bits(value);
> + values[1] = upper_32_bits(value);
> + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values);
> + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "0\n");
> +
> + value = 4294967295;
Is this UINT_MAX?
> + values[0] = lower_32_bits(value);
> + values[1] = upper_32_bits(value);
> + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values);
> + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "4294967295\n");
> + value = -4294967295;
Is this -UINT_MAX?
> + values[0] = lower_32_bits(value);
> + values[1] = upper_32_bits(value);
> + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values);
> + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "-4294967295\n");
> +
> + value = LLONG_MAX;
> + values[0] = lower_32_bits(value);
> + values[1] = upper_32_bits(value);
> + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values);
> + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "9223372036854775807\n");
> +
> + value = LLONG_MIN;
> + values[0] = lower_32_bits(value);
> + values[1] = upper_32_bits(value);
> + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values);
> + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "-9223372036854775808\n");
> +}
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists