mirror of
https://github.com/radareorg/radare2.git
synced 2025-04-01 17:11:51 +00:00
add test for esil dfg lemon const folder
This commit is contained in:
parent
87dd695d2b
commit
25636ce0be
@ -50,7 +50,25 @@ bool test_filter_regs(void) {
|
||||
mu_end;
|
||||
}
|
||||
|
||||
bool test_lemon_const_folder(void) {
|
||||
RAnal *anal = r_anal_new ();
|
||||
r_anal_use (anal, "x86");
|
||||
r_anal_set_bits (anal, 32);
|
||||
r_anal_set_reg_profile (anal);
|
||||
|
||||
RAnalEsilDFG *dfg = r_anal_esil_dfg_expr (anal, NULL, "4,!,3,ebx,:=,!,1,+,eax,:=");
|
||||
r_anal_esil_dfg_fold_const (anal, dfg);
|
||||
RStrBuf *filtered = r_anal_esil_dfg_filter (dfg, "eax");
|
||||
const bool cmp_result = !strcmp(r_strbuf_get(filtered), "0x2,eax,:=");
|
||||
r_strbuf_free (filtered);
|
||||
r_anal_free (anal);
|
||||
|
||||
mu_assert_true (cmp_result, "esil dfg const folding is broken");
|
||||
mu_end;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
mu_run_test (test_filter_regs);
|
||||
mu_run_test (test_lemon_const_folder);
|
||||
return tests_passed != tests_run;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user