lkml.org 
[lkml]   [2019]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: What is the best way to compare an unsigned and a constant?
From
Date
Hi all!

On 27/12/2019 13:39, SeongJae Park wrote:
[...]
> I have a function returning 'unsigned long', and would like to write a kunit
> test for the function, as below.
>
> unsigned long foo(void)
> {
> return 42;
> }
>
> static void foo_test(struct kunit *test)
> {
> KUNIT_EXPECT_EQ(test, 42, foo());
> }

For this case: shouldn't
---- snip ----
static void foo_test(struct kunit *test)
{
KUNIT_EXPECT_EQ(test, 42ul, foo());
}
---- snip ----
do the trick?

MfG,
Bernd
--
"I dislike type abstraction if it has no real reason. And saving
on typing is not a good reason - if your typing speed is the main
issue when you're coding, you're doing something seriously wrong."
- Linus Torvalds
[unhandled content-type:application/pgp-keys]
\
 
 \ /
  Last update: 2019-12-27 14:37    [W:0.045 / U:1.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site