* ASSERT_GE definition is backwards
@ 2020-11-02 16:05 Jann Horn
0 siblings, 0 replies; only message in thread
From: Jann Horn @ 2020-11-02 16:05 UTC (permalink / raw)
To: Shuah Khan, Shuah Khan, open list:KERNEL SELFTEST FRAMEWORK
Cc: Kees Cook, kernel list
ASSERT_GE() is defined as:
/**
* ASSERT_GE(expected, seen)
*
* @expected: expected value
* @seen: measured value
*
* ASSERT_GE(expected, measured): expected >= measured
*/
#define ASSERT_GE(expected, seen) \
__EXPECT(expected, #expected, seen, #seen, >=, 1)
but that means that logically, if you want to write "assert that the
measured PID X is >= the expected value 0", you actually have to use
ASSERT_LE(0, X). That's really awkward. Normally you'd be talking
about how the seen value compares to the expected one, not the other
way around.
At the moment I see tests that are instead written like ASSERT_GE(X,
0), but then that means that the expected and seen values are the
wrong way around.
It might be good if someone could refactor the definitions of
ASSERT_GE and such to swap around which number is the expected and
which is the seen one.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-11-02 16:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-02 16:05 ASSERT_GE definition is backwards Jann Horn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).