mirror of
https://github.com/torvalds/linux.git
synced 2024-12-05 10:32:35 +00:00
selftests/nolibc: add EXPECT_PTRGE, EXPECT_PTRGT, EXPECT_PTRLE, EXPECT_PTRLT
4 new pointer compare macros are added, they are similar to the integer compare macros. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
This commit is contained in:
parent
c48d8af2fa
commit
fd3a9efde8
@ -410,6 +410,56 @@ static int expect_ptrne(const void *expr, int llen, const void *cmp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define EXPECT_PTRGE(cond, expr, cmp) \
|
||||
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrge(expr, llen, cmp); } while (0)
|
||||
|
||||
static int expect_ptrge(const void *expr, int llen, const void *cmp)
|
||||
{
|
||||
int ret = !(expr >= cmp);
|
||||
|
||||
llen += printf(" = <%p> ", expr);
|
||||
result(llen, ret ? FAIL : OK);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define EXPECT_PTRGT(cond, expr, cmp) \
|
||||
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrgt(expr, llen, cmp); } while (0)
|
||||
|
||||
static int expect_ptrgt(const void *expr, int llen, const void *cmp)
|
||||
{
|
||||
int ret = !(expr > cmp);
|
||||
|
||||
llen += printf(" = <%p> ", expr);
|
||||
result(llen, ret ? FAIL : OK);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#define EXPECT_PTRLE(cond, expr, cmp) \
|
||||
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrle(expr, llen, cmp); } while (0)
|
||||
|
||||
static int expect_ptrle(const void *expr, int llen, const void *cmp)
|
||||
{
|
||||
int ret = !(expr <= cmp);
|
||||
|
||||
llen += printf(" = <%p> ", expr);
|
||||
result(llen, ret ? FAIL : OK);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#define EXPECT_PTRLT(cond, expr, cmp) \
|
||||
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrlt(expr, llen, cmp); } while (0)
|
||||
|
||||
static int expect_ptrlt(const void *expr, int llen, const void *cmp)
|
||||
{
|
||||
int ret = !(expr < cmp);
|
||||
|
||||
llen += printf(" = <%p> ", expr);
|
||||
result(llen, ret ? FAIL : OK);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define EXPECT_PTRER2(cond, expr, expret, experr1, experr2) \
|
||||
do { if (!(cond)) result(llen, SKIPPED); else ret += expect_ptrerr2(expr, expret, experr1, experr2, llen); } while (0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user