[Decompiler] Add offline tests (#303)

* add offline test for gcommon as an example.

* fix test

* unused var
This commit is contained in:
water111
2021-03-03 15:42:55 -05:00
committed by GitHub
parent 2eca9ab801
commit 413c1f5c74
17 changed files with 1743 additions and 43 deletions
@@ -2572,4 +2572,25 @@ TEST_F(FormRegressionTest, ExprTerminal2) {
" (- f0-4 (+ arg1 (* arg2 (* f0-4 f0-4))))\n"
" )";
test_with_expr(func, type, expected, false, "", {{"L17", "A ~A"}});
}
TEST_F(FormRegressionTest, MoveFalse) {
std::string func =
"sll r0, r0, 0\n"
"L29:\n"
" daddiu sp, sp, -16\n"
" sd fp, 8(sp)\n"
" or fp, t9, r0\n"
" daddiu v1, s7, 8\n"
" daddiu a0, a0, 12\n"
" andi a0, a0, 1\n"
" movz v1, s7, a0\n"
" or v0, v1, r0\n"
" ld fp, 8(sp)\n"
" jr ra\n"
" daddiu sp, sp, 16\n";
std::string type = "(function int symbol)";
std::string expected = "(nonzero? (logand (+ arg0 12) 1))";
test_with_expr(func, type, expected, false, "", {{"L17", "A ~A"}});
}