Commit fd3a9efd authored by Zhangjin Wu's avatar Zhangjin Wu Committed by Willy Tarreau

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: default avatarZhangjin Wu <falcon@tinylab.org>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent c48d8af2
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment