30 ret =
test(&ctx,
"1+1", 2);
31 ret |=
test(&ctx,
"FOO+BAR", 3);
32 ret |=
test(&ctx,
"(BAR/2)%2", 1);
33 ret |=
test(&ctx,
"1 - -4", 5);
34 ret |=
test(&ctx,
"(FOO-1)*2 + (BAR/2)%2 - -4", 5);
35 ret |=
test(&ctx,
"1-1 | 1", 1);
36 ret |=
test(&ctx,
"1-1 & 1", 0);
37 ret |=
test(&ctx,
"min(1,2) + 1", 2);
38 ret |=
test(&ctx,
"max(1,2) + 1", 3);
39 ret |=
test(&ctx,
"1+1 if 3*4 else 0", 2);
#define TEST_ASSERT_VAL(text, cond)
int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused)
void expr__ctx_init(struct parse_ctx *ctx)
static int test(struct parse_ctx *ctx, const char *e, double val2)
int expr__parse(double *final_val, struct parse_ctx *ctx, const char **pp)
void expr__add_id(struct parse_ctx *ctx, const char *name, double val)
int expr__find_other(const char *p, const char *one, const char ***other, int *num_otherp)