Lines Matching defs:test
59 static int test(struct expr_parse_ctx *ctx, const char *e, double val2)
64 TEST_ASSERT_VAL("parse test failed", 0);
89 ret = test(ctx, "1+1", 2);
90 ret |= test(ctx, "FOO+BAR", 3);
91 ret |= test(ctx, "(BAR/2)%2", 1);
92 ret |= test(ctx, "1 - -4", 5);
93 ret |= test(ctx, "(FOO-1)*2 + (BAR/2)%2 - -4", 5);
94 ret |= test(ctx, "1-1 | 1", 1);
95 ret |= test(ctx, "1-1 & 1", 0);
96 ret |= test(ctx, "min(1,2) + 1", 2);
97 ret |= test(ctx, "max(1,2) + 1", 3);
98 ret |= test(ctx, "1+1 if 3*4 else 0", 2);
99 ret |= test(ctx, "100 if 1 else 200 if 1 else 300", 100);
100 ret |= test(ctx, "100 if 0 else 200 if 1 else 300", 200);
101 ret |= test(ctx, "100 if 1 else 200 if 0 else 300", 100);
102 ret |= test(ctx, "100 if 0 else 200 if 0 else 300", 300);
103 ret |= test(ctx, "1.1 + 2.1", 3.2);
104 ret |= test(ctx, ".1 + 2.", 2.1);
105 ret |= test(ctx, "d_ratio(1, 2)", 0.5);
106 ret |= test(ctx, "d_ratio(2.5, 0)", 0);
107 ret |= test(ctx, "1.1 < 2.2", 1);
108 ret |= test(ctx, "2.2 > 1.1", 1);
109 ret |= test(ctx, "1.1 < 1.1", 0);
110 ret |= test(ctx, "2.2 > 2.2", 0);
111 ret |= test(ctx, "2.2 < 1.1", 0);
112 ret |= test(ctx, "1.1 > 2.2", 0);
113 ret |= test(ctx, "1.1e10 < 1.1e100", 1);
114 ret |= test(ctx, "1.1e2 > 1.1e-2", 1);
262 ret = test(ctx, "has_event(cycles)", 1);