From 8651179aa345d4014d7012aa563a46aa475435c4 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Fri, 5 Aug 2022 12:12:33 -0400 Subject: [PATCH] tests: Cleanup decompiler test fixtures and try to improve the test output / add a readable report (#1724) * tests: add a Jak2 `FormRegressionTest` fixture * tests/ci: minimize test log output and produce a readable report * improve naming of report due to underlying GitHub issue * hopefully fix windows handling of this argument * test... * final test * test linux coverage --- .github/workflows/linux-build-clang.yaml | 10 + .github/workflows/linux-build-gcc.yaml | 10 + .github/workflows/windows-build-clang.yaml | 12 +- .github/workflows/windows-build-msvc.yaml | 13 +- test.sh | 2 +- test/CMakeLists.txt | 4 +- test/decompiler/FormRegressionTest.cpp | 24 +- test/decompiler/FormRegressionTest.h | 78 +++-- test/decompiler/test_DisasmVifDecompile.cpp | 30 +- .../decompiler/test_FormBeforeExpressions.cpp | 74 ++-- test/decompiler/test_FormExpressionBuild.cpp | 330 +++++++++--------- test/decompiler/test_FormExpressionBuild2.cpp | 167 +++++---- test/decompiler/test_FormExpressionBuild3.cpp | 14 +- .../test_FormExpressionBuildLong.cpp | 126 +++---- ...ecomp.cpp => test_gkernel_jak1_decomp.cpp} | 184 +++++----- test/decompiler/test_math_decomp.cpp | 18 +- 16 files changed, 576 insertions(+), 520 deletions(-) rename test/decompiler/{test_gkernel_decomp.cpp => test_gkernel_jak1_decomp.cpp} (93%) diff --git a/.github/workflows/linux-build-clang.yaml b/.github/workflows/linux-build-clang.yaml index 9a3ec6e577..f9ce3983f8 100644 --- a/.github/workflows/linux-build-clang.yaml +++ b/.github/workflows/linux-build-clang.yaml @@ -52,8 +52,18 @@ jobs: run: cmake --build build -j$((`nproc`+1)) - name: Run Tests + env: + GTEST_OUTPUT: "xml:opengoal-test-report.xml" run: ./test.sh + - name: Generate Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() # run this step even if previous step failed + with: + name: Linux Clang - Test Report + path: ${{ github.workspace }}/**/opengoal-test-report.xml + reporter: jest-junit + - name: Upload artifact uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/linux-build-gcc.yaml b/.github/workflows/linux-build-gcc.yaml index f9e07b654e..00d6462efe 100644 --- a/.github/workflows/linux-build-gcc.yaml +++ b/.github/workflows/linux-build-gcc.yaml @@ -54,8 +54,18 @@ jobs: - name: Run Tests - With Coverage working-directory: ./build + env: + GTEST_OUTPUT: "xml:opengoal-test-report.xml" run: ninja goalc-test_coverage -w dupbuild=warn + - name: Generate Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() # run this step even if previous step failed + with: + name: Linux GCC - Test Report + path: ${{ github.workspace }}/**/opengoal-test-report.xml + reporter: jest-junit + - name: Submit Coverage Report to Codacy uses: codacy/codacy-coverage-reporter-action@v1 continue-on-error: true diff --git a/.github/workflows/windows-build-clang.yaml b/.github/workflows/windows-build-clang.yaml index 79cdd40831..afd3bfb65b 100644 --- a/.github/workflows/windows-build-clang.yaml +++ b/.github/workflows/windows-build-clang.yaml @@ -48,7 +48,17 @@ jobs: - name: Run Tests timeout-minutes: 10 - run: ./build/bin/goalc-test.exe --gtest_color=yes --gtest_filter="-*MANUAL_TEST*" + env: + GTEST_OUTPUT: "xml:opengoal-test-report.xml" + run: ./build/bin/goalc-test.exe --gtest_color=yes --gtest_brief=1 --gtest_filter="-*MANUAL_TEST*" + + - name: Generate Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() # run this step even if previous step failed + with: + name: Windows Clang - Test Report + path: ./opengoal-test-report.xml + reporter: jest-junit - name: Upload artifact uses: actions/upload-artifact@v3 diff --git a/.github/workflows/windows-build-msvc.yaml b/.github/workflows/windows-build-msvc.yaml index a26f7a4b9b..a5bc946ec4 100644 --- a/.github/workflows/windows-build-msvc.yaml +++ b/.github/workflows/windows-build-msvc.yaml @@ -49,4 +49,15 @@ jobs: - name: Run Tests timeout-minutes: 10 - run: ./build/bin/goalc-test.exe --gtest_color=yes --gtest_filter="-*MANUAL_TEST*" + env: + GTEST_OUTPUT: "xml:opengoal-test-report.xml" + run: | + ./build/bin/goalc-test.exe --gtest_color=yes --gtest_brief=1 --gtest_filter="-*MANUAL_TEST*" + + - name: Generate Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() # run this step even if previous step failed + with: + name: Windows MSVC - Test Report + path: ./opengoal-test-report.xml + reporter: jest-junit diff --git a/test.sh b/test.sh index c52aa0d52b..32eb344025 100755 --- a/test.sh +++ b/test.sh @@ -3,4 +3,4 @@ # Directory of this script DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -$DIR/build/goalc-test --gtest_color=yes "$@" --gtest_filter="-*MANUAL_TEST*" +$DIR/build/goalc-test --gtest_brief=1 --gtest_color=yes "$@" --gtest_filter="-*MANUAL_TEST*" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 84a4fb4095..1e76c35927 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -29,7 +29,7 @@ add_executable(goalc-test ${CMAKE_CURRENT_LIST_DIR}/decompiler/test_FormExpressionBuildLong.cpp ${CMAKE_CURRENT_LIST_DIR}/decompiler/test_InstructionDecode.cpp ${CMAKE_CURRENT_LIST_DIR}/decompiler/test_InstructionParser.cpp - ${CMAKE_CURRENT_LIST_DIR}/decompiler/test_gkernel_decomp.cpp + ${CMAKE_CURRENT_LIST_DIR}/decompiler/test_gkernel_jak1_decomp.cpp ${CMAKE_CURRENT_LIST_DIR}/decompiler/test_math_decomp.cpp ${CMAKE_CURRENT_LIST_DIR}/decompiler/test_DataParser.cpp ${CMAKE_CURRENT_LIST_DIR}/decompiler/test_DisasmVifDecompile.cpp @@ -50,7 +50,7 @@ if(UNIX AND CMAKE_COMPILER_IS_GNUCXX AND CODE_COVERAGE) include(CodeCoverage) append_coverage_compiler_flags() setup_target_for_coverage_lcov(NAME goalc-test_coverage - EXECUTABLE goalc-test --gtest_color=yes + EXECUTABLE goalc-test --gtest_color=yes --gtest_brief=1 DEPENDENCIES goalc-test EXCLUDE "third-party/*" "/usr/include/*") endif() diff --git a/test/decompiler/FormRegressionTest.cpp b/test/decompiler/FormRegressionTest.cpp index b736799b52..4b5c17d424 100644 --- a/test/decompiler/FormRegressionTest.cpp +++ b/test/decompiler/FormRegressionTest.cpp @@ -19,12 +19,18 @@ using namespace decompiler; -void FormRegressionTest::SetUpTestCase() { +void FormRegressionTestJak1::SetUpTestCase() { parser = std::make_unique(); - dts = std::make_unique(GameVersion::Jak1); + dts = std::make_unique(game_version); dts->parse_type_defs({"decompiler", "config", "all-types.gc"}); } +void FormRegressionTestJak2::SetUpTestCase() { + parser = std::make_unique(); + dts = std::make_unique(game_version); + dts->parse_type_defs({"decompiler", "config", "jak2", "all-types.gc"}); +} + void FormRegressionTest::TearDownTestCase() { parser.reset(); dts.reset(); @@ -280,7 +286,7 @@ void FormRegressionTest::test(const std::string& code, EXPECT_TRUE(expected_form == actual_form); } -void FormRegressionTest::test_final_function_jak1( +void FormRegressionTest::test_final_function( const std::string& code, const std::string& type, const std::string& expected, @@ -311,12 +317,12 @@ void FormRegressionTest::test_final_function_jak1( EXPECT_TRUE(expected_form == actual_form); } -void FormRegressionTest::test_with_stack_structures_jak1(const std::string& code, - const std::string& type, - const std::string& expected, - const std::string& stack_map_json, - const std::string& cast_json, - const std::string& var_map_json) { +void FormRegressionTest::test_with_stack_structures(const std::string& code, + const std::string& type, + const std::string& expected, + const std::string& stack_map_json, + const std::string& cast_json, + const std::string& var_map_json) { TestSettings settings; settings.do_expressions = true; settings.stack_structure_json = stack_map_json; diff --git a/test/decompiler/FormRegressionTest.h b/test/decompiler/FormRegressionTest.h index 28f07a79c0..974b8a4081 100644 --- a/test/decompiler/FormRegressionTest.h +++ b/test/decompiler/FormRegressionTest.h @@ -23,12 +23,11 @@ struct TestSettings { GameVersion version = GameVersion::Jak1; }; -class FormRegressionTest : public ::testing::Test { +class FormRegressionTest : public ::testing::TestWithParam { protected: static std::unique_ptr parser; static std::unique_ptr dts; - static void SetUpTestCase(); static void TearDownTestCase(); struct TestData { @@ -47,23 +46,22 @@ class FormRegressionTest : public ::testing::Test { const std::string& expected, const TestSettings& settings); - void test_final_function_jak1( - const std::string& code, - const std::string& type, - const std::string& expected, - bool allow_pairs = false, - const std::vector>& strings = {}, - const std::string& cast_json = "", - const std::string& var_map_json = ""); + void test_final_function(const std::string& code, + const std::string& type, + const std::string& expected, + bool allow_pairs = false, + const std::vector>& strings = {}, + const std::string& cast_json = "", + const std::string& var_map_json = ""); - void test_no_expr_jak1(const std::string& code, - const std::string& type, - const std::string& expected, - bool allow_pairs = false, - const std::string& method_name = "", - const std::vector>& strings = {}, - const std::string& cast_json = "", - const std::string& var_map_json = "") { + void test_no_expr(const std::string& code, + const std::string& type, + const std::string& expected, + bool allow_pairs = false, + const std::string& method_name = "", + const std::vector>& strings = {}, + const std::string& cast_json = "", + const std::string& var_map_json = "") { TestSettings settings; settings.allow_pairs = allow_pairs; settings.method_name = method_name; @@ -74,14 +72,14 @@ class FormRegressionTest : public ::testing::Test { test(code, type, expected, settings); } - void test_with_expr_jak1(const std::string& code, - const std::string& type, - const std::string& expected, - bool allow_pairs = false, - const std::string& method_name = "", - const std::vector>& strings = {}, - const std::string& cast_json = "", - const std::string& var_map_json = "") { + void test_with_expr(const std::string& code, + const std::string& type, + const std::string& expected, + bool allow_pairs = false, + const std::string& method_name = "", + const std::vector>& strings = {}, + const std::string& cast_json = "", + const std::string& var_map_json = "") { TestSettings settings; settings.allow_pairs = allow_pairs; settings.method_name = method_name; @@ -92,10 +90,24 @@ class FormRegressionTest : public ::testing::Test { test(code, type, expected, settings); } - void test_with_stack_structures_jak1(const std::string& code, - const std::string& type, - const std::string& expected, - const std::string& stack_map_json, - const std::string& cast_json = "", - const std::string& var_map_json = ""); -}; \ No newline at end of file + void test_with_stack_structures(const std::string& code, + const std::string& type, + const std::string& expected, + const std::string& stack_map_json, + const std::string& cast_json = "", + const std::string& var_map_json = ""); +}; + +class FormRegressionTestJak1 : public FormRegressionTest { + protected: + static const GameVersion game_version = GameVersion::Jak1; + + static void SetUpTestCase(); +}; + +class FormRegressionTestJak2 : public FormRegressionTest { + protected: + static const GameVersion game_version = GameVersion::Jak2; + + static void SetUpTestCase(); +}; diff --git a/test/decompiler/test_DisasmVifDecompile.cpp b/test/decompiler/test_DisasmVifDecompile.cpp index d375f82854..93f6e7be9c 100644 --- a/test/decompiler/test_DisasmVifDecompile.cpp +++ b/test/decompiler/test_DisasmVifDecompile.cpp @@ -5,7 +5,7 @@ using namespace decompiler; -TEST_F(FormRegressionTest, ExprDisasmVif) { +TEST_F(FormRegressionTestJak1, ExprDisasmVif) { std::string func = " sll r0, r0, 0\n" "L53:\n" @@ -681,17 +681,17 @@ TEST_F(FormRegressionTest, ExprDisasmVif) { " )\n" " (- gp-0 (* arg1 4))\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", - {{"L139", " #x~X:"}, - {"L138", " (~s :irq ~D)~%"}, - {"L137", " (~s :irq ~D :~s #x~X)~%"}, - {"L136", " (~s :irq ~D :wl ~D :cl ~D)~%"}, - {"L135", " (~s :irq ~D :~s "}, - {"L134", "#x~X #x~X #x~X #x~X)~%"}, - {"L133", " (~s :irq ~D :instructions #x~D :addr #x~X)~%"}, - {"L132", " (~s :irq ~D :qwc #x~D)~%"}, - {"L145", " #x~X: #x~8x #x~8x #x~8x #x~8x~%"}, - {"L131", " (~s :irq ~D :num ~D :addr #x~X "}, - {"L130", ":msk ~D :flg ~D :usn ~D [skip ~d])~%"}, - {"L129", " (*unknown* vif-tag #x~X)~%"}}); -} \ No newline at end of file + test_with_expr(func, type, expected, false, "", + {{"L139", " #x~X:"}, + {"L138", " (~s :irq ~D)~%"}, + {"L137", " (~s :irq ~D :~s #x~X)~%"}, + {"L136", " (~s :irq ~D :wl ~D :cl ~D)~%"}, + {"L135", " (~s :irq ~D :~s "}, + {"L134", "#x~X #x~X #x~X #x~X)~%"}, + {"L133", " (~s :irq ~D :instructions #x~D :addr #x~X)~%"}, + {"L132", " (~s :irq ~D :qwc #x~D)~%"}, + {"L145", " #x~X: #x~8x #x~8x #x~8x #x~8x~%"}, + {"L131", " (~s :irq ~D :num ~D :addr #x~X "}, + {"L130", ":msk ~D :flg ~D :usn ~D [skip ~d])~%"}, + {"L129", " (*unknown* vif-tag #x~X)~%"}}); +} diff --git a/test/decompiler/test_FormBeforeExpressions.cpp b/test/decompiler/test_FormBeforeExpressions.cpp index 0ad4b69fcb..8f5c5f71d1 100644 --- a/test/decompiler/test_FormBeforeExpressions.cpp +++ b/test/decompiler/test_FormBeforeExpressions.cpp @@ -4,7 +4,7 @@ using namespace decompiler; -TEST_F(FormRegressionTest, StringTest) { +TEST_F(FormRegressionTestJak1, StringTest) { std::string func = " sll r0, r0, 0\n" " or v0, a0, r0\n" @@ -20,7 +20,7 @@ TEST_F(FormRegressionTest, StringTest) { "testing-string-2"); } -TEST_F(FormRegressionTest, SimplestTest) { +TEST_F(FormRegressionTestJak1, SimplestTest) { std::string func = " sll r0, r0, 0\n" " or v0, a0, r0\n" @@ -28,10 +28,10 @@ TEST_F(FormRegressionTest, SimplestTest) { " daddu sp, sp, r0"; std::string type = "(function object object)"; std::string expected = "(begin (set! v0-0 a0-0) (ret-value v0-0))"; - test_no_expr_jak1(func, type, expected); + test_no_expr(func, type, expected); } -TEST_F(FormRegressionTest, Op3) { +TEST_F(FormRegressionTestJak1, Op3) { std::string func = " sll r0, r0, 0\n" "L308:\n" @@ -40,10 +40,10 @@ TEST_F(FormRegressionTest, Op3) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(begin (set! v0-0 (*.si a0-0 a1-0)) (ret-value v0-0))"; - test_no_expr_jak1(func, type, expected); + test_no_expr(func, type, expected); } -TEST_F(FormRegressionTest, Division) { +TEST_F(FormRegressionTestJak1, Division) { std::string func = " sll r0, r0, 0\n" "L307:\n" @@ -53,10 +53,10 @@ TEST_F(FormRegressionTest, Division) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(begin (set! v0-0 (/.si a0-0 a1-0)) (ret-value v0-0))"; - test_no_expr_jak1(func, type, expected); + test_no_expr(func, type, expected); } -TEST_F(FormRegressionTest, Ash) { +TEST_F(FormRegressionTestJak1, Ash) { std::string func = " sll r0, r0, 0\n" "L305:\n" @@ -73,10 +73,10 @@ TEST_F(FormRegressionTest, Ash) { " sll r0, r0, 0"; std::string type = "(function int int int)"; std::string expected = "(begin (set! v1-0 a0-0) (set! v0-0 (ash.si v1-0 a1-0)) (ret-value v0-0))"; - test_no_expr_jak1(func, type, expected); + test_no_expr(func, type, expected); } -TEST_F(FormRegressionTest, Abs) { +TEST_F(FormRegressionTestJak1, Abs) { std::string func = " sll r0, r0, 0\n" "L301:\n" @@ -89,10 +89,10 @@ TEST_F(FormRegressionTest, Abs) { " daddu sp, sp, r0"; std::string type = "(function int int)"; std::string expected = "(begin (set! v0-0 a0-0) (set! v0-0 (abs v0-0)) (ret-value v0-0))"; - test_no_expr_jak1(func, type, expected); + test_no_expr(func, type, expected); } -TEST_F(FormRegressionTest, Min) { +TEST_F(FormRegressionTestJak1, Min) { std::string func = " sll r0, r0, 0\n" " or v0, a0, r0\n" @@ -109,10 +109,10 @@ TEST_F(FormRegressionTest, Min) { " (set! v0-1 (min.si v0-0 v1-0))\n" " (ret-value v0-1)\n" " )"; - test_no_expr_jak1(func, type, expected); + test_no_expr(func, type, expected); } -TEST_F(FormRegressionTest, Max) { +TEST_F(FormRegressionTestJak1, Max) { std::string func = " sll r0, r0, 0\n" "L299:\n" @@ -130,10 +130,10 @@ TEST_F(FormRegressionTest, Max) { " (set! v0-1 (max.si v0-0 v1-0))\n" " (ret-value v0-1)\n" " )"; - test_no_expr_jak1(func, type, expected); + test_no_expr(func, type, expected); } -TEST_F(FormRegressionTest, FormatString) { +TEST_F(FormRegressionTestJak1, FormatString) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -32\n" @@ -169,10 +169,10 @@ TEST_F(FormRegressionTest, FormatString) { " (set! v0-1 a0-0)\n" " (ret-value v0-1)\n" " )"; - test_no_expr_jak1(func, type, expected, false, "", {{"L343", "~f"}}); + test_no_expr(func, type, expected, false, "", {{"L343", "~f"}}); } -TEST_F(FormRegressionTest, WhileLoop) { +TEST_F(FormRegressionTestJak1, WhileLoop) { std::string func = " sll r0, r0, 0\n" "L285:\n" @@ -212,11 +212,11 @@ TEST_F(FormRegressionTest, WhileLoop) { " (set! v0-0 #f)\n" " (ret-value v0-0)\n" " )"; - test_no_expr_jak1(func, type, expected); + test_no_expr(func, type, expected); } // Note - this test looks weird because or's aren't fully processed at this point. -TEST_F(FormRegressionTest, Or) { +TEST_F(FormRegressionTestJak1, Or) { std::string func = " sll r0, r0, 0\n" "L280:\n" @@ -278,10 +278,10 @@ TEST_F(FormRegressionTest, Or) { " (set! v0-0 #f)\n" " (ret-value v0-0)\n" " )"; - test_no_expr_jak1(func, type, expected); + test_no_expr(func, type, expected); } -TEST_F(FormRegressionTest, DynamicMethodAccess) { +TEST_F(FormRegressionTestJak1, DynamicMethodAccess) { std::string func = " sll r0, r0, 0\n" @@ -355,10 +355,10 @@ TEST_F(FormRegressionTest, DynamicMethodAccess) { " )\n" " (ret-value v0-0)\n" " )"; - test_no_expr_jak1(func, type, expected); + test_no_expr(func, type, expected); } -TEST_F(FormRegressionTest, SimpleLoopMergeCheck) { +TEST_F(FormRegressionTestJak1, SimpleLoopMergeCheck) { std::string func = " sll r0, r0, 0\n" @@ -397,10 +397,10 @@ TEST_F(FormRegressionTest, SimpleLoopMergeCheck) { " (set! v0-0 (car a0-0))\n" " (ret-value v0-0)\n" " )"; - test_no_expr_jak1(func, type, expected, true); + test_no_expr(func, type, expected, true); } -TEST_F(FormRegressionTest, And) { +TEST_F(FormRegressionTestJak1, And) { std::string func = " sll r0, r0, 0\n" @@ -467,10 +467,10 @@ TEST_F(FormRegressionTest, And) { " )\n" " )" "(ret-value v0-0))\n"; - test_no_expr_jak1(func, type, expected, true); + test_no_expr(func, type, expected, true); } -TEST_F(FormRegressionTest, FunctionCall) { +TEST_F(FormRegressionTestJak1, FunctionCall) { // nmember std::string func = " sll r0, r0, 0\n" @@ -548,10 +548,10 @@ TEST_F(FormRegressionTest, FunctionCall) { " (set! v0-1 a1-0)\n" // not empty, so return the result " )" // the (set! v0 #f) from the if is added later. " (ret-value v0-1))\n"; - test_no_expr_jak1(func, type, expected, true); + test_no_expr(func, type, expected, true); } -TEST_F(FormRegressionTest, NestedAndOr) { +TEST_F(FormRegressionTestJak1, NestedAndOr) { std::string func = " sll r0, r0, 0\n" @@ -715,10 +715,10 @@ TEST_F(FormRegressionTest, NestedAndOr) { " (set! v0-1 a0-0)\n" " (ret-value v0-1)\n" " )"; - test_no_expr_jak1(func, type, expected, true); + test_no_expr(func, type, expected, true); } -TEST_F(FormRegressionTest, NewMethod) { +TEST_F(FormRegressionTestJak1, NewMethod) { // inline-array-class new std::string func = " sll r0, r0, 0\n" @@ -770,10 +770,10 @@ TEST_F(FormRegressionTest, NewMethod) { " (set! (-> v0-0 allocated-length) a2-0)\n" " )" " (ret-value v0-0))\n"; - test_no_expr_jak1(func, type, expected, false, "inline-array-class"); + test_no_expr(func, type, expected, false, "inline-array-class"); } -TEST_F(FormRegressionTest, Recursive) { +TEST_F(FormRegressionTestJak1, Recursive) { std::string func = " sll r0, r0, 0\n" @@ -815,10 +815,10 @@ TEST_F(FormRegressionTest, Recursive) { " )\n" " )" " (ret-value v0-0))\n"; - test_no_expr_jak1(func, type, expected, false); + test_no_expr(func, type, expected, false); } -TEST_F(FormRegressionTest, TypeOf) { +TEST_F(FormRegressionTestJak1, TypeOf) { std::string func = " sll r0, r0, 0\n" @@ -851,5 +851,5 @@ TEST_F(FormRegressionTest, TypeOf) { " (set! v0-0 (call! a0-0))\n" " (ret-value v0-0)\n" " )"; - test_no_expr_jak1(func, type, expected, false); + test_no_expr(func, type, expected, false); } diff --git a/test/decompiler/test_FormExpressionBuild.cpp b/test/decompiler/test_FormExpressionBuild.cpp index 13b404dd5f..f87d9618b3 100644 --- a/test/decompiler/test_FormExpressionBuild.cpp +++ b/test/decompiler/test_FormExpressionBuild.cpp @@ -4,7 +4,7 @@ using namespace decompiler; -TEST_F(FormRegressionTest, ExprIdentity) { +TEST_F(FormRegressionTestJak1, DraftExprIdentity) { std::string func = " sll r0, r0, 0\n" " or v0, a0, r0\n" @@ -12,10 +12,10 @@ TEST_F(FormRegressionTest, ExprIdentity) { " daddu sp, sp, r0"; std::string type = "(function object object)"; std::string expected = "arg0"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprFloatingPoint) { +TEST_F(FormRegressionTestJak1, ExprFloatingPoint) { std::string func = " sll r0, r0, 0\n" "L345:\n" @@ -31,10 +31,10 @@ TEST_F(FormRegressionTest, ExprFloatingPoint) { " daddiu sp, sp, 16"; std::string type = "(function float float)"; std::string expected = "(/ 0.0 arg0)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprAdditionSigned) { +TEST_F(FormRegressionTestJak1, ExprAdditionSigned) { std::string func = " sll r0, r0, 0\n" " daddu v0, a0, a1\n" @@ -42,10 +42,10 @@ TEST_F(FormRegressionTest, ExprAdditionSigned) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(+ arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprAdditionUnSigned) { +TEST_F(FormRegressionTestJak1, ExprAdditionUnSigned) { std::string func = " sll r0, r0, 0\n" " daddu v0, a0, a1\n" @@ -53,10 +53,10 @@ TEST_F(FormRegressionTest, ExprAdditionUnSigned) { " daddu sp, sp, r0"; std::string type = "(function uint uint uint)"; std::string expected = "(+ arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprAdditionMixed1) { +TEST_F(FormRegressionTestJak1, ExprAdditionMixed1) { std::string func = " sll r0, r0, 0\n" " daddu v0, a0, a1\n" @@ -64,10 +64,10 @@ TEST_F(FormRegressionTest, ExprAdditionMixed1) { " daddu sp, sp, r0"; std::string type = "(function int uint int)"; std::string expected = "(+ arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprAdditionMixed2) { +TEST_F(FormRegressionTestJak1, ExprAdditionMixed2) { std::string func = " sll r0, r0, 0\n" " daddu v0, a0, a1\n" @@ -75,10 +75,10 @@ TEST_F(FormRegressionTest, ExprAdditionMixed2) { " daddu sp, sp, r0"; std::string type = "(function uint int uint)"; std::string expected = "(+ arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprAdditionSignedWrongReturn) { +TEST_F(FormRegressionTestJak1, ExprAdditionSignedWrongReturn) { std::string func = " sll r0, r0, 0\n" " daddu v0, a0, a1\n" @@ -86,10 +86,10 @@ TEST_F(FormRegressionTest, ExprAdditionSignedWrongReturn) { " daddu sp, sp, r0"; std::string type = "(function int int uint)"; std::string expected = "(the-as uint (+ arg0 arg1))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprAdditionUnSignedWrongReturn) { +TEST_F(FormRegressionTestJak1, ExprAdditionUnSignedWrongReturn) { std::string func = " sll r0, r0, 0\n" " daddu v0, a0, a1\n" @@ -97,10 +97,10 @@ TEST_F(FormRegressionTest, ExprAdditionUnSignedWrongReturn) { " daddu sp, sp, r0"; std::string type = "(function uint uint int)"; std::string expected = "(the-as int (+ arg0 arg1))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprAdditionMixed1WrongReturn) { +TEST_F(FormRegressionTestJak1, ExprAdditionMixed1WrongReturn) { std::string func = " sll r0, r0, 0\n" " daddu v0, a0, a1\n" @@ -108,10 +108,10 @@ TEST_F(FormRegressionTest, ExprAdditionMixed1WrongReturn) { " daddu sp, sp, r0"; std::string type = "(function int uint uint)"; std::string expected = "(the-as uint (+ arg0 arg1))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprAdditionMixed2WrongReturn) { +TEST_F(FormRegressionTestJak1, ExprAdditionMixed2WrongReturn) { std::string func = " sll r0, r0, 0\n" " daddu v0, a0, a1\n" @@ -119,10 +119,10 @@ TEST_F(FormRegressionTest, ExprAdditionMixed2WrongReturn) { " daddu sp, sp, r0"; std::string type = "(function uint int int)"; std::string expected = "(the-as int (+ arg0 arg1))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprSubtraction) { +TEST_F(FormRegressionTestJak1, ExprSubtraction) { std::string func = " sll r0, r0, 0\n" " dsubu v0, a0, a1\n" @@ -130,10 +130,10 @@ TEST_F(FormRegressionTest, ExprSubtraction) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(- arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMultiplication) { +TEST_F(FormRegressionTestJak1, ExprMultiplication) { std::string func = " sll r0, r0, 0\n" " mult3 v0, a0, a1\n" @@ -141,10 +141,10 @@ TEST_F(FormRegressionTest, ExprMultiplication) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(* arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMultiplicationWrong1) { +TEST_F(FormRegressionTestJak1, ExprMultiplicationWrong1) { std::string func = " sll r0, r0, 0\n" " mult3 v0, a0, a1\n" @@ -152,10 +152,10 @@ TEST_F(FormRegressionTest, ExprMultiplicationWrong1) { " daddu sp, sp, r0"; std::string type = "(function int uint int)"; std::string expected = "(* arg0 (the-as int arg1))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMultiplicationWrong2) { +TEST_F(FormRegressionTestJak1, ExprMultiplicationWrong2) { std::string func = " sll r0, r0, 0\n" " mult3 v0, a0, a1\n" @@ -163,10 +163,10 @@ TEST_F(FormRegressionTest, ExprMultiplicationWrong2) { " daddu sp, sp, r0"; std::string type = "(function uint int int)"; std::string expected = "(* (the-as int arg0) arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMultiplicationWrong3) { +TEST_F(FormRegressionTestJak1, ExprMultiplicationWrong3) { std::string func = " sll r0, r0, 0\n" " mult3 v0, a0, a1\n" @@ -174,10 +174,10 @@ TEST_F(FormRegressionTest, ExprMultiplicationWrong3) { " daddu sp, sp, r0"; std::string type = "(function uint uint uint)"; std::string expected = "(the-as uint (* (the-as int arg0) (the-as int arg1)))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprDivision1) { +TEST_F(FormRegressionTestJak1, ExprDivision1) { std::string func = " sll r0, r0, 0\n" " div a0, a1\n" @@ -186,10 +186,10 @@ TEST_F(FormRegressionTest, ExprDivision1) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(/ arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprDivision2) { +TEST_F(FormRegressionTestJak1, ExprDivision2) { std::string func = " sll r0, r0, 0\n" " div a0, a1\n" @@ -198,10 +198,10 @@ TEST_F(FormRegressionTest, ExprDivision2) { " daddu sp, sp, r0"; std::string type = "(function uint int int)"; std::string expected = "(/ (the-as int arg0) arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprDivision3) { +TEST_F(FormRegressionTestJak1, ExprDivision3) { std::string func = " sll r0, r0, 0\n" " div a0, a1\n" @@ -210,10 +210,10 @@ TEST_F(FormRegressionTest, ExprDivision3) { " daddu sp, sp, r0"; std::string type = "(function int uint int)"; std::string expected = "(/ arg0 (the-as int arg1))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprDivision4) { +TEST_F(FormRegressionTestJak1, ExprDivision4) { std::string func = " sll r0, r0, 0\n" " div a0, a1\n" @@ -222,10 +222,10 @@ TEST_F(FormRegressionTest, ExprDivision4) { " daddu sp, sp, r0"; std::string type = "(function uint uint uint)"; std::string expected = "(the-as uint (/ (the-as int arg0) (the-as int arg1)))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprAsh) { +TEST_F(FormRegressionTestJak1, ExprAsh) { std::string func = " sll r0, r0, 0\n" "L305:\n" @@ -240,10 +240,10 @@ TEST_F(FormRegressionTest, ExprAsh) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(ash arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMod) { +TEST_F(FormRegressionTestJak1, ExprMod) { std::string func = " sll r0, r0, 0\n" " div a0, a1\n" @@ -252,10 +252,10 @@ TEST_F(FormRegressionTest, ExprMod) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(mod arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprAbs) { +TEST_F(FormRegressionTestJak1, ExprAbs) { std::string func = " sll r0, r0, 0\n" "L301:\n" @@ -268,10 +268,10 @@ TEST_F(FormRegressionTest, ExprAbs) { " daddu sp, sp, r0"; std::string type = "(function int int)"; std::string expected = "(abs arg0)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMin) { +TEST_F(FormRegressionTestJak1, ExprMin) { std::string func = " sll r0, r0, 0\n" " or v0, a0, r0\n" @@ -282,10 +282,10 @@ TEST_F(FormRegressionTest, ExprMin) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(min arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMax) { +TEST_F(FormRegressionTestJak1, ExprMax) { std::string func = " sll r0, r0, 0\n" " or v0, a0, r0\n" @@ -296,10 +296,10 @@ TEST_F(FormRegressionTest, ExprMax) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(max arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprLogior) { +TEST_F(FormRegressionTestJak1, ExprLogior) { std::string func = " sll r0, r0, 0\n" " or v0, a0, a1\n" @@ -307,10 +307,10 @@ TEST_F(FormRegressionTest, ExprLogior) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(logior arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprLogxor) { +TEST_F(FormRegressionTestJak1, ExprLogxor) { std::string func = " sll r0, r0, 0\n" " xor v0, a0, a1\n" @@ -318,10 +318,10 @@ TEST_F(FormRegressionTest, ExprLogxor) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(logxor arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprLognor) { +TEST_F(FormRegressionTestJak1, ExprLognor) { std::string func = " sll r0, r0, 0\n" " nor v0, a0, a1\n" @@ -329,10 +329,10 @@ TEST_F(FormRegressionTest, ExprLognor) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(lognor arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprLogand) { +TEST_F(FormRegressionTestJak1, ExprLogand) { std::string func = " sll r0, r0, 0\n" " and v0, a0, a1\n" @@ -340,10 +340,10 @@ TEST_F(FormRegressionTest, ExprLogand) { " daddu sp, sp, r0"; std::string type = "(function int int int)"; std::string expected = "(logand arg0 arg1)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprLognot) { +TEST_F(FormRegressionTestJak1, ExprLognot) { std::string func = " sll r0, r0, 0\n" " nor v0, a0, r0\n" @@ -351,10 +351,10 @@ TEST_F(FormRegressionTest, ExprLognot) { " daddu sp, sp, r0"; std::string type = "(function int int)"; std::string expected = "(lognot arg0)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprFalse) { +TEST_F(FormRegressionTestJak1, ExprFalse) { std::string func = " sll r0, r0, 0\n" " or v0, s7, r0\n" @@ -362,10 +362,10 @@ TEST_F(FormRegressionTest, ExprFalse) { " daddu sp, sp, r0"; std::string type = "(function symbol)"; std::string expected = "#f"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprTrue) { +TEST_F(FormRegressionTestJak1, ExprTrue) { std::string func = " sll r0, r0, 0\n" " daddiu v0, s7, #t\n" @@ -373,10 +373,10 @@ TEST_F(FormRegressionTest, ExprTrue) { " daddu sp, sp, r0"; std::string type = "(function symbol)"; std::string expected = "#t"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprPrintBfloat) { +TEST_F(FormRegressionTestJak1, ExprPrintBfloat) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -32\n" @@ -403,10 +403,10 @@ TEST_F(FormRegressionTest, ExprPrintBfloat) { std::string type = "(function bfloat bfloat)"; std::string expected = "(begin (format #t \"~f\" (-> arg0 data)) arg0)"; - test_with_expr_jak1(func, type, expected, false, "", {{"L343", "~f"}}); + test_with_expr(func, type, expected, false, "", {{"L343", "~f"}}); } -TEST_F(FormRegressionTest, ExprSizeOfType) { +TEST_F(FormRegressionTestJak1, ExprSizeOfType) { std::string func = "L346:\n" // fake label. " sll r0, r0, 0\n" @@ -425,10 +425,10 @@ TEST_F(FormRegressionTest, ExprSizeOfType) { std::string type = "(function type uint)"; std::string expected = "(logand 3 (+ (* (-> arg0 allocated-length) 4) 43))"; - test_with_expr_jak1(func, type, expected, false, ""); + test_with_expr(func, type, expected, false, ""); } -TEST_F(FormRegressionTest, ExprBasicTypeP) { +TEST_F(FormRegressionTestJak1, ExprBasicTypeP) { std::string func = " sll r0, r0, 0\n" "L285:\n" @@ -468,10 +468,10 @@ TEST_F(FormRegressionTest, ExprBasicTypeP) { " )\n" " #f\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, FinalBasicTypeP) { +TEST_F(FormRegressionTestJak1, FinalBasicTypeP) { std::string func = " sll r0, r0, 0\n" "L285:\n" @@ -511,10 +511,10 @@ TEST_F(FormRegressionTest, FinalBasicTypeP) { " )\n" " #f\n" " )"; - test_final_function_jak1(func, type, expected); + test_final_function(func, type, expected); } -TEST_F(FormRegressionTest, ExprTypeTypep) { +TEST_F(FormRegressionTestJak1, ExprTypeTypep) { std::string func = " sll r0, r0, 0\n" "L280:\n" @@ -565,10 +565,10 @@ TEST_F(FormRegressionTest, ExprTypeTypep) { " )\n" " #f\n" " )"; - test_with_expr_jak1(func, type, expected, false, ""); + test_with_expr(func, type, expected, false, ""); } -TEST_F(FormRegressionTest, ExprFindParentMethod) { +TEST_F(FormRegressionTestJak1, ExprFindParentMethod) { std::string func = " sll r0, r0, 0\n" "L275:\n" @@ -629,10 +629,10 @@ TEST_F(FormRegressionTest, ExprFindParentMethod) { " )\n" " v0-0\n" " )"; - test_with_expr_jak1(func, type, expected, false, ""); + test_with_expr(func, type, expected, false, ""); } -TEST_F(FormRegressionTest, ExprRef) { +TEST_F(FormRegressionTestJak1, ExprRef) { std::string func = " sll r0, r0, 0\n" "L272:\n" @@ -660,10 +660,10 @@ TEST_F(FormRegressionTest, ExprRef) { std::string expected = "(begin (dotimes (v1-0 arg1) (nop!) (nop!) (set! arg0 (cdr arg0))) (car arg0))"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprPairMethod4) { +TEST_F(FormRegressionTestJak1, ExprPairMethod4) { std::string func = " sll r0, r0, 0\n" "L266:\n" @@ -728,10 +728,10 @@ TEST_F(FormRegressionTest, ExprPairMethod4) { " )\n" " v0-0\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprPairMethod5) { +TEST_F(FormRegressionTestJak1, ExprPairMethod5) { std::string func = " sll r0, r0, 0\n" " lw v1, pair(s7)\n" @@ -741,10 +741,10 @@ TEST_F(FormRegressionTest, ExprPairMethod5) { std::string type = "(function pair uint)"; std::string expected = "(-> pair size)"; - test_with_expr_jak1(func, type, expected, false, ""); + test_with_expr(func, type, expected, false, ""); } -TEST_F(FormRegressionTest, ExprLast) { +TEST_F(FormRegressionTestJak1, ExprLast) { std::string func = " sll r0, r0, 0\n" @@ -774,10 +774,10 @@ TEST_F(FormRegressionTest, ExprLast) { " (while (not (null? (cdr v0-0))) (nop!) (nop!) (set! v0-0 (cdr v0-0)))\n" " v0-0\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprMember) { +TEST_F(FormRegressionTestJak1, ExprMember) { std::string func = " sll r0, r0, 0\n" "L257:\n" @@ -826,10 +826,10 @@ TEST_F(FormRegressionTest, ExprMember) { " )\n" " (if (not (null? v1-0)) v1-0)\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprNmember) { +TEST_F(FormRegressionTestJak1, ExprNmember) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -48\n" @@ -888,10 +888,10 @@ TEST_F(FormRegressionTest, ExprNmember) { " )\n" " (if (not (null? arg1)) arg1)\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprAssoc) { +TEST_F(FormRegressionTestJak1, ExprAssoc) { std::string func = " sll r0, r0, 0\n" " or v1, a1, r0\n" @@ -939,10 +939,10 @@ TEST_F(FormRegressionTest, ExprAssoc) { " )\n" " (if (not (null? v1-0)) (car v1-0))\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprAssoce) { +TEST_F(FormRegressionTestJak1, ExprAssoce) { std::string func = " sll r0, r0, 0\n" @@ -1007,10 +1007,10 @@ TEST_F(FormRegressionTest, ExprAssoce) { " )\n" " (if (not (null? v1-0)) (car v1-0))\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprNassoc) { +TEST_F(FormRegressionTestJak1, ExprNassoc) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -48\n" @@ -1098,10 +1098,10 @@ TEST_F(FormRegressionTest, ExprNassoc) { " )\n" " (if (not (null? arg1)) (car arg1))\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprNassoce) { +TEST_F(FormRegressionTestJak1, ExprNassoce) { std::string func = " sll r0, r0, 0\n" "L230:\n" @@ -1203,10 +1203,10 @@ TEST_F(FormRegressionTest, ExprNassoce) { " )\n" " (if (not (null? arg1)) (car arg1))\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprAppend) { +TEST_F(FormRegressionTestJak1, ExprAppend) { std::string func = " sll r0, r0, 0\n" "L224:\n" @@ -1262,10 +1262,10 @@ TEST_F(FormRegressionTest, ExprAppend) { " arg0\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprDelete) { +TEST_F(FormRegressionTestJak1, ExprDelete) { std::string func = " sll r0, r0, 0\n" "L217:\n" @@ -1339,10 +1339,10 @@ TEST_F(FormRegressionTest, ExprDelete) { " )\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprDeleteCar) { +TEST_F(FormRegressionTestJak1, ExprDeleteCar) { std::string func = " sll r0, r0, 0\n" "L210:\n" @@ -1418,10 +1418,10 @@ TEST_F(FormRegressionTest, ExprDeleteCar) { " )\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprInsertCons) { +TEST_F(FormRegressionTestJak1, ExprInsertCons) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -32\n" @@ -1451,10 +1451,10 @@ TEST_F(FormRegressionTest, ExprInsertCons) { // NOTE - this appears to _not_ be a nested call. std::string expected = "(let ((a3-0 (delete-car! (car arg0) arg1))) (cons arg0 a3-0))"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprSort) { +TEST_F(FormRegressionTestJak1, ExprSort) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -112\n" @@ -1587,10 +1587,10 @@ TEST_F(FormRegressionTest, ExprSort) { " )\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected, true, ""); + test_with_expr(func, type, expected, true, ""); } -TEST_F(FormRegressionTest, ExprInlineArrayMethod0) { +TEST_F(FormRegressionTestJak1, ExprInlineArrayMethod0) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -32\n" @@ -1639,10 +1639,10 @@ TEST_F(FormRegressionTest, ExprInlineArrayMethod0) { " )\n" " v0-0\n" " )"; - test_with_expr_jak1(func, type, expected, true, "inline-array-class"); + test_with_expr(func, type, expected, true, "inline-array-class"); } -TEST_F(FormRegressionTest, ExprInlineArrayMethod4) { +TEST_F(FormRegressionTestJak1, ExprInlineArrayMethod4) { std::string func = " sll r0, r0, 0\n" " lw v0, 0(a0)\n" @@ -1651,10 +1651,10 @@ TEST_F(FormRegressionTest, ExprInlineArrayMethod4) { std::string type = "(function inline-array-class int)"; std::string expected = "(-> arg0 length)"; - test_with_expr_jak1(func, type, expected, true, "inline-array-class"); + test_with_expr(func, type, expected, true, "inline-array-class"); } -TEST_F(FormRegressionTest, ExprInlineArrayMethod5) { +TEST_F(FormRegressionTestJak1, ExprInlineArrayMethod5) { std::string func = " sll r0, r0, 0\n" " lwu v1, -4(a0)\n" @@ -1676,10 +1676,10 @@ TEST_F(FormRegressionTest, ExprInlineArrayMethod5) { " (* (-> arg0 allocated-length) (the-as int (-> arg0 type heap-base)))\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected, true, "inline-array-class"); + test_with_expr(func, type, expected, true, "inline-array-class"); } -TEST_F(FormRegressionTest, ExprArrayMethod0) { +TEST_F(FormRegressionTestJak1, ExprArrayMethod0) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -112\n" @@ -1758,10 +1758,10 @@ TEST_F(FormRegressionTest, ExprArrayMethod0) { " (set! (-> v0-1 content-type) arg2)\n" " v0-1\n" " )"; - test_with_expr_jak1(func, type, expected, true, "array"); + test_with_expr(func, type, expected, true, "array"); } -TEST_F(FormRegressionTest, ExprArrayMethod4) { +TEST_F(FormRegressionTestJak1, ExprArrayMethod4) { std::string func = " sll r0, r0, 0\n" "L90:\n" @@ -1771,10 +1771,10 @@ TEST_F(FormRegressionTest, ExprArrayMethod4) { std::string type = "(function array int)"; std::string expected = "(-> arg0 length)"; - test_with_expr_jak1(func, type, expected, true, "array"); + test_with_expr(func, type, expected, true, "array"); } -TEST_F(FormRegressionTest, ExprArrayMethod5) { +TEST_F(FormRegressionTestJak1, ExprArrayMethod5) { std::string func = " sll r0, r0, 0\n" "L87:\n" @@ -1826,10 +1826,10 @@ TEST_F(FormRegressionTest, ExprArrayMethod5) { " )\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected, true, "array"); + test_with_expr(func, type, expected, true, "array"); } -TEST_F(FormRegressionTest, ExprMemCopy) { +TEST_F(FormRegressionTestJak1, ExprMemCopy) { std::string func = " sll r0, r0, 0\n" "L84:\n" @@ -1866,10 +1866,10 @@ TEST_F(FormRegressionTest, ExprMemCopy) { " )\n" " v0-0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMemSet32) { +TEST_F(FormRegressionTestJak1, ExprMemSet32) { std::string func = " sll r0, r0, 0\n" "L75:\n" @@ -1905,10 +1905,10 @@ TEST_F(FormRegressionTest, ExprMemSet32) { " )\n" " v0-0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMemOr) { +TEST_F(FormRegressionTestJak1, ExprMemOr) { std::string func = " sll r0, r0, 0\n" "L72:\n" @@ -1948,10 +1948,10 @@ TEST_F(FormRegressionTest, ExprMemOr) { " )\n" " v0-0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprFact) { +TEST_F(FormRegressionTestJak1, ExprFact) { std::string func = " sll r0, r0, 0\n" "L65:\n" @@ -1982,10 +1982,10 @@ TEST_F(FormRegressionTest, ExprFact) { std::string type = "(function int int)"; std::string expected = "(if (= arg0 1) 1 (* arg0 (fact (+ arg0 -1))))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprPrint) { +TEST_F(FormRegressionTestJak1, ExprPrint) { std::string func = " sll r0, r0, 0\n" "L63:\n" @@ -2010,10 +2010,10 @@ TEST_F(FormRegressionTest, ExprPrint) { std::string type = "(function object object)"; std::string expected = "((method-of-type (rtype-of arg0) print) arg0)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprPrintl) { +TEST_F(FormRegressionTestJak1, ExprPrintl) { std::string func = " sll r0, r0, 0\n" "L61:\n" @@ -2058,10 +2058,10 @@ TEST_F(FormRegressionTest, ExprPrintl) { " (format #t \"~%\")\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {{"L324", "~%"}}); + test_with_expr(func, type, expected, false, "", {{"L324", "~%"}}); } -TEST_F(FormRegressionTest, ExprInspect) { +TEST_F(FormRegressionTestJak1, ExprInspect) { std::string func = " sll r0, r0, 0\n" "L59:\n" @@ -2086,10 +2086,10 @@ TEST_F(FormRegressionTest, ExprInspect) { std::string type = "(function object object)"; std::string expected = "((method-of-type (rtype-of arg0) inspect) arg0)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprPrintTreeBitmask) { +TEST_F(FormRegressionTestJak1, ExprPrintTreeBitmask) { std::string func = " sll r0, r0, 0\n" "L54:\n" @@ -2157,10 +2157,10 @@ TEST_F(FormRegressionTest, ExprPrintTreeBitmask) { " )\n" " #f\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {{"L323", " "}, {"L322", "| "}}); + test_with_expr(func, type, expected, false, "", {{"L323", " "}, {"L322", "| "}}); } -TEST_F(FormRegressionTest, ExprPrintName) { +TEST_F(FormRegressionTestJak1, ExprPrintName) { std::string func = " sll r0, r0, 0\n" "L136:\n" @@ -2278,12 +2278,12 @@ TEST_F(FormRegressionTest, ExprPrintName) { "(the-as int arg0))))))\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {}, - "[\t\t[24, \"a1\", \"symbol\"],\n" - "\t\t[39, \"a0\", \"symbol\"]]"); + test_with_expr(func, type, expected, false, "", {}, + "[\t\t[24, \"a1\", \"symbol\"],\n" + "\t\t[39, \"a0\", \"symbol\"]]"); } -TEST_F(FormRegressionTest, ExprProfileBarMethod9) { +TEST_F(FormRegressionTestJak1, ExprProfileBarMethod9) { std::string func = " sll r0, r0, 0\n" " lw v1, 0(a0)\n" @@ -2296,10 +2296,10 @@ TEST_F(FormRegressionTest, ExprProfileBarMethod9) { std::string type = "(function profile-bar int uint)"; std::string expected = "(-> arg0 data (+ (-> arg0 profile-frame-count) -2) time-stamp)"; - test_with_expr_jak1(func, type, expected, false, ""); + test_with_expr(func, type, expected, false, ""); } -TEST_F(FormRegressionTest, ExprStopwatchElapsedSeconds) { +TEST_F(FormRegressionTestJak1, ExprStopwatchElapsedSeconds) { std::string func = " sll r0, r0, 0\n" "L20:\n" @@ -2326,10 +2326,10 @@ TEST_F(FormRegressionTest, ExprStopwatchElapsedSeconds) { std::string type = "(function int float)"; std::string expected = "(let ((v1-0 (abs arg0))) (* 0.0 (the float v1-0)))"; - test_with_expr_jak1(func, type, expected, false, ""); + test_with_expr(func, type, expected, false, ""); } -TEST_F(FormRegressionTest, ExprCopyStringString) { +TEST_F(FormRegressionTestJak1, ExprCopyStringString) { std::string func = " sll r0, r0, 0\n" "L161:\n" @@ -2374,10 +2374,10 @@ TEST_F(FormRegressionTest, ExprCopyStringString) { " )\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected, false, ""); + test_with_expr(func, type, expected, false, ""); } -TEST_F(FormRegressionTest, StringLt) { +TEST_F(FormRegressionTestJak1, StringLt) { std::string func = " sll r0, r0, 0\n" "L91:\n" @@ -2479,10 +2479,10 @@ TEST_F(FormRegressionTest, StringLt) { " )\n" " #f\n" " )"; - test_with_expr_jak1(func, type, expected, false, ""); + test_with_expr(func, type, expected, false, ""); } -TEST_F(FormRegressionTest, ExprAssert) { +TEST_F(FormRegressionTestJak1, ExprAssert) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -16\n" @@ -2510,10 +2510,10 @@ TEST_F(FormRegressionTest, ExprAssert) { std::string type = "(function symbol string int)"; std::string expected = "(begin (if (not arg0) (format #t \"A ~A\" arg1)) 0)"; - test_with_expr_jak1(func, type, expected, false, "", {{"L17", "A ~A"}}); + test_with_expr(func, type, expected, false, "", {{"L17", "A ~A"}}); } -TEST_F(FormRegressionTest, ExprTerminal2) { +TEST_F(FormRegressionTestJak1, ExprTerminal2) { std::string func = "sll r0, r0, 0\n" "L29:\n" @@ -2547,10 +2547,10 @@ TEST_F(FormRegressionTest, ExprTerminal2) { " ((f0-4 (sqrtf (/ (- (* 0.0 arg0) arg1) arg2))))\n" " (- f0-4 (+ arg1 (* arg2 (* f0-4 f0-4))))\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {{"L17", "A ~A"}}); + test_with_expr(func, type, expected, false, "", {{"L17", "A ~A"}}); } -TEST_F(FormRegressionTest, MoveFalse) { +TEST_F(FormRegressionTestJak1, MoveFalse) { std::string func = "sll r0, r0, 0\n" "L29:\n" @@ -2568,11 +2568,11 @@ TEST_F(FormRegressionTest, MoveFalse) { std::string type = "(function int symbol)"; std::string expected = "(logtest? (+ arg0 12) 1)"; - test_with_expr_jak1(func, type, expected, false, "", {{"L17", "A ~A"}}); + test_with_expr(func, type, expected, false, "", {{"L17", "A ~A"}}); } // Good for testing that in-place ops (+!) check the _variable_ is the same. -TEST_F(FormRegressionTest, QMemCpy) { +TEST_F(FormRegressionTestJak1, QMemCpy) { std::string func = "sll r0, r0, 0\n" "L78:\n" @@ -2620,10 +2620,10 @@ TEST_F(FormRegressionTest, QMemCpy) { " )\n" " v0-0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, StripStripTrailingWhitespace) { +TEST_F(FormRegressionTestJak1, StripStripTrailingWhitespace) { std::string func = "sll r0, r0, 0\n" "L52:\n" @@ -2728,11 +2728,11 @@ TEST_F(FormRegressionTest, StripStripTrailingWhitespace) { " )\n" " #f\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } // Let bug (github #328) -TEST_F(FormRegressionTest, TimeToGround) { +TEST_F(FormRegressionTestJak1, TimeToGround) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -16\n" @@ -2782,11 +2782,11 @@ TEST_F(FormRegressionTest, TimeToGround) { " )\n" " (the-as float v0-0)\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } // Infinite loop bug (github #196) -TEST_F(FormRegressionTest, LoopingCode) { +TEST_F(FormRegressionTestJak1, LoopingCode) { std::string func = "sll r0, r0, 0\n" "L1:\n" @@ -2815,10 +2815,10 @@ TEST_F(FormRegressionTest, LoopingCode) { " )\n" " (the-as symbol #f)\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, AbsAsSideEffect) { +TEST_F(FormRegressionTestJak1, AbsAsSideEffect) { std::string func = "sll r0, r0, 0\n" " dsubu v1, a1, a0\n" @@ -2869,12 +2869,12 @@ TEST_F(FormRegressionTest, AbsAsSideEffect) { " )\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } // for github https://github.com/water111/jak-project/issues/332 // method 11 bit-array -TEST_F(FormRegressionTest, AshPropagation) { +TEST_F(FormRegressionTestJak1, AshPropagation) { // (ash a2-0 a3-0) std::string func = "sll r0, r0, 0\n" @@ -2905,13 +2905,13 @@ TEST_F(FormRegressionTest, AshPropagation) { " (logior! (-> arg0 bytes (/ arg1 8)) (ash 1 (logand arg1 7)))\n" " 0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } // for github https://github.com/water111/jak-project/issues/332 // method 9 bit-array // also checks output prop. -TEST_F(FormRegressionTest, AshPropagation2) { +TEST_F(FormRegressionTestJak1, AshPropagation2) { // (ash a2-0 a3-0) std::string func = "sll r0, r0, 0\n" @@ -2939,5 +2939,5 @@ TEST_F(FormRegressionTest, AshPropagation2) { "(let ((v1-2 (-> arg0 bytes (/ arg1 8))))\n" " (logtest? v1-2 (ash 1 (logand arg1 7)))\n" " )"; - test_with_expr_jak1(func, type, expected); -} \ No newline at end of file + test_with_expr(func, type, expected); +} diff --git a/test/decompiler/test_FormExpressionBuild2.cpp b/test/decompiler/test_FormExpressionBuild2.cpp index 3eb73d2bd5..fb36820eea 100644 --- a/test/decompiler/test_FormExpressionBuild2.cpp +++ b/test/decompiler/test_FormExpressionBuild2.cpp @@ -5,7 +5,7 @@ using namespace decompiler; // tests stack variables -TEST_F(FormRegressionTest, MatrixPMult) { +TEST_F(FormRegressionTestJak1, MatrixPMult) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -112\n" @@ -50,14 +50,14 @@ TEST_F(FormRegressionTest, MatrixPMult) { " )\n" " arg0\n" " )"; - test_with_stack_structures_jak1(func, type, expected, - "[\n" - " [16, \"matrix\"]\n" - " ]"); + test_with_stack_structures(func, type, expected, + "[\n" + " [16, \"matrix\"]\n" + " ]"); } // TODO- this should also work without the cast, but be uglier. -TEST_F(FormRegressionTest, VectorXQuaternionWithCast) { +TEST_F(FormRegressionTestJak1, VectorXQuaternionWithCast) { std::string func = "sll r0, r0, 0\n" @@ -96,14 +96,14 @@ TEST_F(FormRegressionTest, VectorXQuaternionWithCast) { " )\n" " arg0\n" " )"; - test_with_stack_structures_jak1(func, type, expected, - "[\n" - " [16, \"matrix\"]\n" - " ]", - "[[10, \"v1\", \"(pointer uint128)\"]]"); + test_with_stack_structures(func, type, expected, + "[\n" + " [16, \"matrix\"]\n" + " ]", + "[[10, \"v1\", \"(pointer uint128)\"]]"); } -TEST_F(FormRegressionTest, EliminateFloatDeadSet) { +TEST_F(FormRegressionTestJak1, EliminateFloatDeadSet) { std::string func = "sll r0, r0, 0\n" "L32:\n" @@ -227,10 +227,10 @@ TEST_F(FormRegressionTest, EliminateFloatDeadSet) { " )\n" " )\n" " )"; - test_with_stack_structures_jak1(func, type, expected, "[]"); + test_with_stack_structures(func, type, expected, "[]"); } -TEST_F(FormRegressionTest, IterateProcessTree) { +TEST_F(FormRegressionTestJak1, IterateProcessTree) { std::string func = "sll r0, r0, 0\n" @@ -319,10 +319,10 @@ TEST_F(FormRegressionTest, IterateProcessTree) { " )\n" " s4-0\n" " )"; - test_with_stack_structures_jak1(func, type, expected, "[]"); + test_with_stack_structures(func, type, expected, "[]"); } -TEST_F(FormRegressionTest, InspectVifStatBitfield) { +TEST_F(FormRegressionTestJak1, InspectVifStatBitfield) { std::string func = "sll r0, r0, 0\n" @@ -451,21 +451,21 @@ TEST_F(FormRegressionTest, InspectVifStatBitfield) { " (format #t \"~T ~D~%\" (-> arg0 fqc))\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", - {{"L37", "[~8x] ~A~%"}, - {"L36", "~T ~D~%"}, - {"L35", "~T ~D~%"}, - {"L34", "~T ~D~%"}, - {"L33", "~T ~D~%"}, - {"L32", "~T ~D~%"}, - {"L31", "~T ~D~%"}, - {"L30", "~T ~D~%"}, - {"L29", "~T ~D~%"}, - {"L28", "~T ~D~%"}, - {"L27", "~T ~D~%"}}); + test_with_expr(func, type, expected, false, "", + {{"L37", "[~8x] ~A~%"}, + {"L36", "~T ~D~%"}, + {"L35", "~T ~D~%"}, + {"L34", "~T ~D~%"}, + {"L33", "~T ~D~%"}, + {"L32", "~T ~D~%"}, + {"L31", "~T ~D~%"}, + {"L30", "~T ~D~%"}, + {"L29", "~T ~D~%"}, + {"L28", "~T ~D~%"}, + {"L27", "~T ~D~%"}}); } -TEST_F(FormRegressionTest, InspectHandleBitfield) { +TEST_F(FormRegressionTestJak1, InspectHandleBitfield) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -32\n" @@ -512,12 +512,11 @@ TEST_F(FormRegressionTest, InspectHandleBitfield) { " (format #t \"~Tpid: ~D~%\" (-> arg0 pid))\n" " arg0\n" " )"; - test_with_expr_jak1( - func, type, expected, false, "", - {{"L79", "[~8x] ~A~%"}, {"L32", "~Tprocess: #x~X~%"}, {"L31", "~Tpid: ~D~%"}}); + test_with_expr(func, type, expected, false, "", + {{"L79", "[~8x] ~A~%"}, {"L32", "~Tprocess: #x~X~%"}, {"L31", "~Tpid: ~D~%"}}); } -TEST_F(FormRegressionTest, InspectDmaTagBitfield) { +TEST_F(FormRegressionTestJak1, InspectDmaTagBitfield) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -32\n" @@ -599,20 +598,20 @@ TEST_F(FormRegressionTest, InspectDmaTagBitfield) { " (format #t \"~Ta: ~D~%\" (-> arg0 spr))\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", - { - {"L65", "[~8x] ~A~%"}, - {"L37", "~Ta: ~D~%"}, - {"L36", "~Ta: ~D~%"}, - {"L35", "~Ta: ~D~%"}, - {"L34", "~Ta: ~D~%"}, - {"L33", "~Ta: ~D~%"}, - {"L32", "~Ta: ~D~%"}, - }); + test_with_expr(func, type, expected, false, "", + { + {"L65", "[~8x] ~A~%"}, + {"L37", "~Ta: ~D~%"}, + {"L36", "~Ta: ~D~%"}, + {"L35", "~Ta: ~D~%"}, + {"L34", "~Ta: ~D~%"}, + {"L33", "~Ta: ~D~%"}, + {"L32", "~Ta: ~D~%"}, + }); } // Tests nonzero-check on bitfield -TEST_F(FormRegressionTest, DmaSyncCrash) { +TEST_F(FormRegressionTestJak1, DmaSyncCrash) { std::string func = "sll r0, r0, 0\n" "L46:\n" @@ -662,10 +661,10 @@ TEST_F(FormRegressionTest, DmaSyncCrash) { " )\n" " 0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, DmaSend) { +TEST_F(FormRegressionTestJak1, DmaSend) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -64\n" @@ -743,10 +742,10 @@ TEST_F(FormRegressionTest, DmaSend) { " (.sync.l)\n" " 0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, DmaInitialize) { +TEST_F(FormRegressionTestJak1, DmaInitialize) { std::string func = "sll r0, r0, 0\n" " lui v1, 4096\n" @@ -777,13 +776,13 @@ TEST_F(FormRegressionTest, DmaInitialize) { " (set! (-> (the-as vif-bank #x10003c00) err me0) 1)\n" " 0\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {}, - "[[1, \"v1\", \"vif-bank\"], [8, \"v1\", \"vif-bank\"], [6, \"a0\", " - "\"vif-bank\"], [13, \"a0\", \"vif-bank\"]]"); + test_with_expr(func, type, expected, false, "", {}, + "[[1, \"v1\", \"vif-bank\"], [8, \"v1\", \"vif-bank\"], [6, \"a0\", " + "\"vif-bank\"], [13, \"a0\", \"vif-bank\"]]"); } // Dynamic bitfield stuff. -TEST_F(FormRegressionTest, SetDisplayEnv) { +TEST_F(FormRegressionTestJak1, SetDisplayEnv) { std::string func = "sll r0, r0, 0\n" " ori v1, r0, 65441\n" @@ -860,10 +859,10 @@ TEST_F(FormRegressionTest, SetDisplayEnv) { " (set! (-> arg0 bgcolor) (new 'static 'gs-bgcolor))\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, DmaBufferAddVuFunction) { +TEST_F(FormRegressionTestJak1, DmaBufferAddVuFunction) { std::string func = "sll r0, r0, 0\n" " daddiu v1, a1, 16\n" @@ -975,10 +974,10 @@ TEST_F(FormRegressionTest, DmaBufferAddVuFunction) { " )\n" " #f\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {}, "[[[9, 33], \"t2\", \"dma-packet\"]]"); + test_with_expr(func, type, expected, false, "", {}, "[[[9, 33], \"t2\", \"dma-packet\"]]"); } -TEST_F(FormRegressionTest, DmaBucketInsertTag) { +TEST_F(FormRegressionTestJak1, DmaBucketInsertTag) { std::string func = "sll r0, r0, 0\n" " dsll v1, a1, 4\n" @@ -998,14 +997,14 @@ TEST_F(FormRegressionTest, DmaBucketInsertTag) { " )\n" " arg2\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {}, - "[\n" - " [[2, 6], \"v1\", \"dma-bucket\"],\n" - " [3, \"a0\", \"dma-bucket\"]\n" - " ]"); + test_with_expr(func, type, expected, false, "", {}, + "[\n" + " [[2, 6], \"v1\", \"dma-bucket\"],\n" + " [3, \"a0\", \"dma-bucket\"]\n" + " ]"); } -TEST_F(FormRegressionTest, StupidFloatMove) { +TEST_F(FormRegressionTestJak1, StupidFloatMove) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -48\n" @@ -1110,11 +1109,11 @@ TEST_F(FormRegressionTest, StupidFloatMove) { " )\n" " 0.0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } // gpr->fpr not being propagated -TEST_F(FormRegressionTest, Method11FontContext) { +TEST_F(FormRegressionTestJak1, Method11FontContext) { std::string func = "sll r0, r0, 0\n" " mtc1 f0, a1\n" @@ -1129,11 +1128,11 @@ TEST_F(FormRegressionTest, Method11FontContext) { " (set! (-> arg0 origin z) (the float arg1))\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } // 128-bit bitfields, also type for pextuw -TEST_F(FormRegressionTest, Method4ResTag) { +TEST_F(FormRegressionTestJak1, Method4ResTag) { std::string func = "sll r0, r0, 0\n" "L135:\n" @@ -1167,10 +1166,10 @@ TEST_F(FormRegressionTest, Method4ResTag) { " (* (-> arg0 elt-count) (-> arg0 elt-type size))\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, MakeSqrtTable) { +TEST_F(FormRegressionTestJak1, MakeSqrtTable) { std::string func = "sll r0, r0, 0\n" "L149:\n" @@ -1241,12 +1240,12 @@ TEST_F(FormRegressionTest, MakeSqrtTable) { " 0\n" " (none)\n" " )"; - test_with_expr_jak1( + test_with_expr( func, type, expected, false, "", {{"L190", "static int sqrt_table[256] =~%{~%"}, {"L189", "~D,~%"}, {"L188", "};~%"}}); } -TEST_F(FormRegressionTest, Method2Vec4s) { +TEST_F(FormRegressionTestJak1, Method2Vec4s) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -32\n" @@ -1289,10 +1288,10 @@ TEST_F(FormRegressionTest, Method2Vec4s) { " )\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {{"L344", "#"}}); + test_with_expr(func, type, expected, false, "", {{"L344", "#"}}); } -TEST_F(FormRegressionTest, SoundNameEqual) { +TEST_F(FormRegressionTestJak1, SoundNameEqual) { std::string func = "sll r0, r0, 0\n" " dsubu v1, a0, a1\n" @@ -1311,10 +1310,10 @@ TEST_F(FormRegressionTest, SoundNameEqual) { std::string type = "(function sound-name sound-name symbol)"; std::string expected = "(and (= (the-as uint arg0) (the-as uint arg1)) (= (-> arg0 hi) (-> arg1 hi)))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, DebugMenuFuncDecode) { +TEST_F(FormRegressionTestJak1, DebugMenuFuncDecode) { std::string func = "sll r0, r0, 0\n" " dsll32 v1, a0, 29\n" @@ -1377,10 +1376,10 @@ TEST_F(FormRegressionTest, DebugMenuFuncDecode) { " )\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {}, "[[13, \"a0\", \"symbol\"]]"); + test_with_expr(func, type, expected, false, "", {}, "[[13, \"a0\", \"symbol\"]]"); } -TEST_F(FormRegressionTest, MatrixNewInlineProp) { +TEST_F(FormRegressionTestJak1, MatrixNewInlineProp) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -112\n" @@ -1432,10 +1431,10 @@ TEST_F(FormRegressionTest, MatrixNewInlineProp) { " )\n" " arg0\n" " )"; - test_with_stack_structures_jak1(func, type, expected, R"([[16, "matrix"]])"); + test_with_stack_structures(func, type, expected, R"([[16, "matrix"]])"); } -TEST_F(FormRegressionTest, VectorNewInlineProp) { +TEST_F(FormRegressionTestJak1, VectorNewInlineProp) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -64\n" @@ -1492,10 +1491,10 @@ TEST_F(FormRegressionTest, VectorNewInlineProp) { " )\n" " arg0\n" " )"; - test_with_stack_structures_jak1(func, type, expected, R"([[16, "vector"]])"); + test_with_stack_structures(func, type, expected, R"([[16, "vector"]])"); } -TEST_F(FormRegressionTest, Method23Trsqv) { +TEST_F(FormRegressionTestJak1, Method23Trsqv) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -32\n" @@ -1518,10 +1517,10 @@ TEST_F(FormRegressionTest, Method23Trsqv) { std::string type = "(function trsqv vector float)"; std::string expected = "(vector-y-angle (vector-! (new 'stack-no-clear 'vector) arg1 (-> arg0 trans)))"; - test_with_stack_structures_jak1(func, type, expected, R"([[16, "vector"]])"); + test_with_stack_structures(func, type, expected, R"([[16, "vector"]])"); } -TEST_F(FormRegressionTest, VectorLineDistance) { +TEST_F(FormRegressionTestJak1, VectorLineDistance) { std::string func = "sll r0, r0, 0\n" "\n" @@ -1613,6 +1612,6 @@ TEST_F(FormRegressionTest, VectorLineDistance) { " )\n" " (vector-length (vector-! (new-stack-vector0) gp-1 v1-3))\n" " )"; - test_with_stack_structures_jak1( - func, type, expected, R"([[16, "vector"], [32, "vector"], [48, "vector"], [64, "vector"]])"); + test_with_stack_structures(func, type, expected, + R"([[16, "vector"], [32, "vector"], [48, "vector"], [64, "vector"]])"); } diff --git a/test/decompiler/test_FormExpressionBuild3.cpp b/test/decompiler/test_FormExpressionBuild3.cpp index 2b51cc38a7..051b6e1821 100644 --- a/test/decompiler/test_FormExpressionBuild3.cpp +++ b/test/decompiler/test_FormExpressionBuild3.cpp @@ -5,7 +5,7 @@ using namespace decompiler; // vector-rad<-vector-deg/2! -TEST_F(FormRegressionTest, VectorDegToVectorRad) { +TEST_F(FormRegressionTestJak1, VectorDegToVectorRad) { std::string func = "sll r0, r0, 0\n" " lui v1, 14537\n" @@ -53,11 +53,11 @@ TEST_F(FormRegressionTest, VectorDegToVectorRad) { " (none)\n" " )\n" " )"; - test_final_function_jak1(func, type, expected); + test_final_function(func, type, expected); } // weird short circuit thing -TEST_F(FormRegressionTest, WeirdShortCircuit) { +TEST_F(FormRegressionTestJak1, WeirdShortCircuit) { std::string func = "sll r0, r0, 0\n" " daddiu sp, sp, -144\n" @@ -141,10 +141,10 @@ TEST_F(FormRegressionTest, WeirdShortCircuit) { " )\n" " s5-0\n" " )"; - test_with_stack_structures_jak1(func, type, expected, "[[16, \"event-message-block\"]]"); + test_with_stack_structures(func, type, expected, "[[16, \"event-message-block\"]]"); } -TEST_F(FormRegressionTest, WeirdShortCircuit2) { +TEST_F(FormRegressionTestJak1, WeirdShortCircuit2) { std::string func = "sll r0, r0, 0\n" "L62:\n" @@ -162,5 +162,5 @@ TEST_F(FormRegressionTest, WeirdShortCircuit2) { " daddu sp, sp, r0"; std::string type = "(function actor-link-info object)"; std::string expected = "(the-as object (and (-> arg0 prev) (-> arg0 prev extra process)))"; - test_with_stack_structures_jak1(func, type, expected, "[[16, \"event-message-block\"]]"); -} \ No newline at end of file + test_with_stack_structures(func, type, expected, "[[16, \"event-message-block\"]]"); +} diff --git a/test/decompiler/test_FormExpressionBuildLong.cpp b/test/decompiler/test_FormExpressionBuildLong.cpp index f0f0bf907e..3e1f41644b 100644 --- a/test/decompiler/test_FormExpressionBuildLong.cpp +++ b/test/decompiler/test_FormExpressionBuildLong.cpp @@ -4,7 +4,7 @@ using namespace decompiler; -TEST_F(FormRegressionTest, ExprArrayMethod2) { +TEST_F(FormRegressionTestJak1, ExprArrayMethod2) { std::string func = " sll r0, r0, 0\n" "L130:\n" @@ -665,35 +665,35 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) { " (format #t \")\")\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected, true, "array", - {{"L343", "~f"}, - {"L342", "#("}, - {"L341", "~D"}, - {"L340", " ~D"}, - {"L339", "#x~X"}, - {"L338", " #x~X"}, - {"L337", " ~f"}, - {"L336", "~A"}, - {"L335", " ~A"}, - {"L334", ")"}}, - "[" - "\t\t[23, \"gp\", \"(array int32)\"],\n" - "\t\t[43, \"gp\", \"(array uint32)\"],\n" - "\t\t[63, \"gp\", \"(array int64)\"],\n" - "\t\t[83, \"gp\", \"(array uint64)\"],\n" - "\t\t[102, \"gp\", \"(array int8)\"],\n" - "\t\t[121, \"gp\", \"(array uint8)\"],\n" - "\t\t[141, \"gp\", \"(array int16)\"],\n" - "\t\t[161, \"gp\", \"(array uint16)\"],\n" - "\t\t[186, \"gp\", \"(array uint128)\"],\n" - "\t\t[204, \"gp\", \"(array int32)\"],\n" - "\t\t[223, \"gp\", \"(array float)\"],\n" - "\t\t[232, \"gp\", \"(array float)\"],\n" - "\t\t[249, \"gp\", \"(array basic)\"],\n" - "\t\t[258, \"gp\", \"(array basic)\"]]"); + test_with_expr(func, type, expected, true, "array", + {{"L343", "~f"}, + {"L342", "#("}, + {"L341", "~D"}, + {"L340", " ~D"}, + {"L339", "#x~X"}, + {"L338", " #x~X"}, + {"L337", " ~f"}, + {"L336", "~A"}, + {"L335", " ~A"}, + {"L334", ")"}}, + "[" + "\t\t[23, \"gp\", \"(array int32)\"],\n" + "\t\t[43, \"gp\", \"(array uint32)\"],\n" + "\t\t[63, \"gp\", \"(array int64)\"],\n" + "\t\t[83, \"gp\", \"(array uint64)\"],\n" + "\t\t[102, \"gp\", \"(array int8)\"],\n" + "\t\t[121, \"gp\", \"(array uint8)\"],\n" + "\t\t[141, \"gp\", \"(array int16)\"],\n" + "\t\t[161, \"gp\", \"(array uint16)\"],\n" + "\t\t[186, \"gp\", \"(array uint128)\"],\n" + "\t\t[204, \"gp\", \"(array int32)\"],\n" + "\t\t[223, \"gp\", \"(array float)\"],\n" + "\t\t[232, \"gp\", \"(array float)\"],\n" + "\t\t[249, \"gp\", \"(array basic)\"],\n" + "\t\t[258, \"gp\", \"(array basic)\"]]"); } -TEST_F(FormRegressionTest, ExprArrayMethod3) { +TEST_F(FormRegressionTestJak1, ExprArrayMethod3) { std::string func = " sll r0, r0, 0\n" "L91:\n" @@ -1226,31 +1226,31 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) { " )\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected, true, "array", - {{"L333", "[~8x] ~A~%"}, - {"L332", "~Tallocated-length: ~D~%"}, - {"L331", "~Tlength: ~D~%"}, - {"L330", " ~Tcontent-type: ~A~%"}, - {"L329", "~Tdata[~D]: @ #x~X~%"}, - {"L328", "~T [~D] ~D~%"}, - {"L327", "~T [~D] #x~X~%"}, - {"L326", "~T [~D] ~f~%"}, - {"L325", "~T [~D] ~A~%"}}, - "[\t\t[44, \"gp\", \"(array int32)\"],\n" - "\t\t[62, \"gp\", \"(array uint32)\"],\n" - "\t\t[80, \"gp\", \"(array int64)\"],\n" - "\t\t[98, \"gp\", \"(array uint64)\"],\n" - "\t\t[115, \"gp\", \"(array int8)\"],\n" - "\t\t[132, \"gp\", \"(array int8)\"],\n" - "\t\t[150, \"gp\", \"(array int16)\"],\n" - "\t\t[168, \"gp\", \"(array uint16)\"],\n" - "\t\t[191, \"gp\", \"(array uint128)\"],\n" - "\t\t[207, \"gp\", \"(array int32)\"],\n" - "\t\t[226, \"gp\", \"(array float)\"],\n" - "\t\t[243, \"gp\", \"(array basic)\"]]"); + test_with_expr(func, type, expected, true, "array", + {{"L333", "[~8x] ~A~%"}, + {"L332", "~Tallocated-length: ~D~%"}, + {"L331", "~Tlength: ~D~%"}, + {"L330", " ~Tcontent-type: ~A~%"}, + {"L329", "~Tdata[~D]: @ #x~X~%"}, + {"L328", "~T [~D] ~D~%"}, + {"L327", "~T [~D] #x~X~%"}, + {"L326", "~T [~D] ~f~%"}, + {"L325", "~T [~D] ~A~%"}}, + "[\t\t[44, \"gp\", \"(array int32)\"],\n" + "\t\t[62, \"gp\", \"(array uint32)\"],\n" + "\t\t[80, \"gp\", \"(array int64)\"],\n" + "\t\t[98, \"gp\", \"(array uint64)\"],\n" + "\t\t[115, \"gp\", \"(array int8)\"],\n" + "\t\t[132, \"gp\", \"(array int8)\"],\n" + "\t\t[150, \"gp\", \"(array int16)\"],\n" + "\t\t[168, \"gp\", \"(array uint16)\"],\n" + "\t\t[191, \"gp\", \"(array uint128)\"],\n" + "\t\t[207, \"gp\", \"(array int32)\"],\n" + "\t\t[226, \"gp\", \"(array float)\"],\n" + "\t\t[243, \"gp\", \"(array basic)\"]]"); } -TEST_F(FormRegressionTest, ExprValid) { +TEST_F(FormRegressionTestJak1, ExprValid) { std::string func = " sll r0, r0, 0\n" "L1:\n" @@ -2013,7 +2013,7 @@ TEST_F(FormRegressionTest, ExprValid) { " )\n" " )\n" "\n"; - test_with_expr_jak1( + test_with_expr( func, type, expected, false, "", {{"L321", "ERROR: object #x~X ~S is not a valid object (misaligned)~%"}, {"L320", "ERROR: object #x~X ~S is not a valid object (bad address)~%"}, @@ -2027,7 +2027,7 @@ TEST_F(FormRegressionTest, ExprValid) { "ERROR: object #x~X ~S is not a valid object of type '~A' (inside symbol table)~%"}}); } -TEST_F(FormRegressionTest, ExprStringToInt) { +TEST_F(FormRegressionTestJak1, ExprStringToInt) { std::string func = " sll r0, r0, 0\n" "L14:\n" @@ -2397,10 +2397,10 @@ TEST_F(FormRegressionTest, ExprStringToInt) { " )\n" " )\n" " )"; - test_final_function_jak1(func, type, expected); + test_final_function(func, type, expected); } -TEST_F(FormRegressionTest, Method19ResTag) { +TEST_F(FormRegressionTestJak1, Method19ResTag) { std::string func = "sll r0, r0, 0\n" "L101:\n" @@ -2888,11 +2888,11 @@ TEST_F(FormRegressionTest, Method19ResTag) { " (logior (logand 0 t0-6) (shl v1-14 32))\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {}, - "[\n" - " [46, \"t2\", \"(pointer uint64)\"],\n" - " [100, \"t3\", \"(pointer uint64)\"],\n" - " [184, \"t5\", \"(pointer uint64)\"],\n" - " [64, \"t6\", \"(pointer uint64)\"]\n" - " ]"); -} \ No newline at end of file + test_with_expr(func, type, expected, false, "", {}, + "[\n" + " [46, \"t2\", \"(pointer uint64)\"],\n" + " [100, \"t3\", \"(pointer uint64)\"],\n" + " [184, \"t5\", \"(pointer uint64)\"],\n" + " [64, \"t6\", \"(pointer uint64)\"]\n" + " ]"); +} diff --git a/test/decompiler/test_gkernel_decomp.cpp b/test/decompiler/test_gkernel_jak1_decomp.cpp similarity index 93% rename from test/decompiler/test_gkernel_decomp.cpp rename to test/decompiler/test_gkernel_jak1_decomp.cpp index fb80d840dd..95e0919d25 100644 --- a/test/decompiler/test_gkernel_decomp.cpp +++ b/test/decompiler/test_gkernel_jak1_decomp.cpp @@ -4,7 +4,7 @@ using namespace decompiler; -TEST_F(FormRegressionTest, ExprMethod7Object) { +TEST_F(FormRegressionTestJak1, ExprMethod7Object) { std::string func = " sll r0, r0, 0\n" " or v0, a0, r0\n" @@ -12,10 +12,10 @@ TEST_F(FormRegressionTest, ExprMethod7Object) { " daddu sp, sp, r0\n"; std::string type = "(function object int object)"; std::string expected = "arg0"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprLoadPackage) { +TEST_F(FormRegressionTestJak1, ExprLoadPackage) { std::string func = " sll r0, r0, 0\n" "L278:\n" @@ -71,10 +71,10 @@ TEST_F(FormRegressionTest, ExprLoadPackage) { " v0-1\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprUnloadPackage) { +TEST_F(FormRegressionTestJak1, ExprUnloadPackage) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -16\n" @@ -110,10 +110,10 @@ TEST_F(FormRegressionTest, ExprUnloadPackage) { " )\n" " *kernel-packages*\n" " )"; - test_with_expr_jak1(func, type, expected, true); + test_with_expr(func, type, expected, true); } -TEST_F(FormRegressionTest, ExprMethod1Thread) { +TEST_F(FormRegressionTestJak1, ExprMethod1Thread) { std::string func = " sll r0, r0, 0\n" "L274:\n" @@ -141,10 +141,10 @@ TEST_F(FormRegressionTest, ExprMethod1Thread) { " (set! (-> arg0 process top-thread) (-> arg0 previous))\n" " (none)\n" " )"; - test_with_expr_jak1(func, type, expected, false); + test_with_expr(func, type, expected, false); } -TEST_F(FormRegressionTest, ExprMethod2Thread) { +TEST_F(FormRegressionTestJak1, ExprMethod2Thread) { std::string func = " sll r0, r0, 0\n" "L273:\n" @@ -187,11 +187,10 @@ TEST_F(FormRegressionTest, ExprMethod2Thread) { " )\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", - {{"L343", "#<~A ~S of ~S pc: #x~X @ #x~X>"}}); + test_with_expr(func, type, expected, false, "", {{"L343", "#<~A ~S of ~S pc: #x~X @ #x~X>"}}); } -TEST_F(FormRegressionTest, ExprMethod9Thread) { +TEST_F(FormRegressionTestJak1, ExprMethod9Thread) { std::string func = " sll r0, r0, 0\n" "L268:\n" @@ -289,10 +288,10 @@ TEST_F(FormRegressionTest, ExprMethod9Thread) { " 0\n" " (none)\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {{"L342", "1 ~A ~%"}, {"L341", "2 ~A ~%"}}); + test_with_expr(func, type, expected, false, "", {{"L342", "1 ~A ~%"}, {"L341", "2 ~A ~%"}}); } -TEST_F(FormRegressionTest, ExprMethod0Thread) { +TEST_F(FormRegressionTestJak1, ExprMethod0Thread) { std::string func = " sll r0, r0, 0\n" " lwu v1, 44(a2)\n" @@ -364,12 +363,12 @@ TEST_F(FormRegressionTest, ExprMethod0Thread) { " (set! (-> obj stack-size) arg4)\n" " (the-as cpu-thread obj)\n" " )"; - test_with_expr_jak1(func, type, expected, false, "cpu-thread", {}, - "[[[13, 28], \"v0\", \"cpu-thread\"]]", - "{\"vars\":{\"v0-0\":[\"obj\", \"cpu-thread\"]}}"); + test_with_expr(func, type, expected, false, "cpu-thread", {}, + "[[[13, 28], \"v0\", \"cpu-thread\"]]", + "{\"vars\":{\"v0-0\":[\"obj\", \"cpu-thread\"]}}"); } -TEST_F(FormRegressionTest, ExprMethod5CpuThread) { +TEST_F(FormRegressionTestJak1, ExprMethod5CpuThread) { std::string func = " sll r0, r0, 0\n" "L264:\n" @@ -381,10 +380,10 @@ TEST_F(FormRegressionTest, ExprMethod5CpuThread) { " daddu sp, sp, r0"; std::string type = "(function cpu-thread int)"; std::string expected = "(the-as int (+ (-> arg0 type size) (-> arg0 stack-size)))"; - test_with_expr_jak1(func, type, expected, false); + test_with_expr(func, type, expected, false); } -TEST_F(FormRegressionTest, RemoveExit) { +TEST_F(FormRegressionTestJak1, RemoveExit) { std::string func = " sll r0, r0, 0\n" "L262:\n" @@ -407,10 +406,10 @@ TEST_F(FormRegressionTest, RemoveExit) { " v0-0\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected, false); + test_with_expr(func, type, expected, false); } -TEST_F(FormRegressionTest, RemoveMethod0ProcessTree) { +TEST_F(FormRegressionTestJak1, RemoveMethod0ProcessTree) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -32\n" @@ -452,10 +451,10 @@ TEST_F(FormRegressionTest, RemoveMethod0ProcessTree) { " (set! (-> v0-0 ppointer) (the-as (pointer process) (&-> v0-0 self)))\n" " v0-0\n" " )"; - test_with_expr_jak1(func, type, expected, false, "process-tree"); + test_with_expr(func, type, expected, false, "process-tree"); } -TEST_F(FormRegressionTest, RemoveMethod3ProcessTree) { +TEST_F(FormRegressionTestJak1, RemoveMethod3ProcessTree) { std::string func = " sll r0, r0, 0\n" @@ -548,16 +547,16 @@ TEST_F(FormRegressionTest, RemoveMethod3ProcessTree) { " (format #t \"~Tchild: ~A~%\" (ppointer->process (-> arg0 child)))\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected, false, "process-tree", - {{"L340", "[~8x] ~A~%"}, - {"L339", "~Tname: ~S~%"}, - {"L338", "~Tmask: #x~X~%"}, - {"L337", "~Tparent: ~A~%"}, - {"L336", "~Tbrother: ~A~%"}, - {"L335", "~Tchild: ~A~%"}}); + test_with_expr(func, type, expected, false, "process-tree", + {{"L340", "[~8x] ~A~%"}, + {"L339", "~Tname: ~S~%"}, + {"L338", "~Tmask: #x~X~%"}, + {"L337", "~Tparent: ~A~%"}, + {"L336", "~Tbrother: ~A~%"}, + {"L335", "~Tchild: ~A~%"}}); } -TEST_F(FormRegressionTest, ExprMethod0Process) { +TEST_F(FormRegressionTestJak1, ExprMethod0Process) { std::string func = " sll r0, r0, 0\n" "L254:\n" @@ -667,12 +666,12 @@ TEST_F(FormRegressionTest, ExprMethod0Process) { " )\n" " (the-as process v0-0)\n" " )"; - test_with_expr_jak1(func, type, expected, false, "process", {}, - "[\t\t[12, \"a0\", \"int\"],\n" - "\t\t[[13, 43], \"v0\", \"process\"]]"); + test_with_expr(func, type, expected, false, "process", {}, + "[\t\t[12, \"a0\", \"int\"],\n" + "\t\t[[13, 43], \"v0\", \"process\"]]"); } -TEST_F(FormRegressionTest, ExprInspectProcessHeap) { +TEST_F(FormRegressionTestJak1, ExprInspectProcessHeap) { std::string func = " sll r0, r0, 0\n" "L251:\n" @@ -732,15 +731,15 @@ TEST_F(FormRegressionTest, ExprInspectProcessHeap) { " )\n" " #f\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {}, - "[\t\t[[4,11], \"s5\", \"basic\"],\n" - "\t\t[[17,20], \"s5\", \"pointer\"]]", - "{\"vars\":{\"s5-0\":[\"obj\", \"pointer\"]}}"); + test_with_expr(func, type, expected, false, "", {}, + "[\t\t[[4,11], \"s5\", \"basic\"],\n" + "\t\t[[17,20], \"s5\", \"pointer\"]]", + "{\"vars\":{\"s5-0\":[\"obj\", \"pointer\"]}}"); } // note: skipped method 3 process -TEST_F(FormRegressionTest, ExprMethod5Process) { +TEST_F(FormRegressionTestJak1, ExprMethod5Process) { std::string func = " sll r0, r0, 0\n" " lw v1, process(s7)\n" @@ -751,10 +750,10 @@ TEST_F(FormRegressionTest, ExprMethod5Process) { " daddu sp, sp, r0"; std::string type = "(function process int)"; std::string expected = "(the-as int (+ (-> process size) (-> arg0 allocated-length)))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMethod2Process) { +TEST_F(FormRegressionTestJak1, ExprMethod2Process) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -32\n" @@ -832,12 +831,11 @@ TEST_F(FormRegressionTest, ExprMethod2Process) { " )\n" " arg0\n" " )"; - test_with_expr_jak1( - func, type, expected, false, "", - {{"L317", "#<~A ~S ~A :state ~S "}, {"L316", ":stack ~D/~D :heap ~D/~D @ #x~X>"}}); + test_with_expr(func, type, expected, false, "", + {{"L317", "#<~A ~S ~A :state ~S "}, {"L316", ":stack ~D/~D :heap ~D/~D @ #x~X>"}}); } -TEST_F(FormRegressionTest, ExprMethod0DeadPool) { +TEST_F(FormRegressionTestJak1, ExprMethod0DeadPool) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -112\n" @@ -947,10 +945,10 @@ TEST_F(FormRegressionTest, ExprMethod0DeadPool) { " )\n" " s3-0\n" " )"; - test_with_expr_jak1(func, type, expected, false, "dead-pool"); + test_with_expr(func, type, expected, false, "dead-pool"); } -TEST_F(FormRegressionTest, ExprMethod14DeadPool) { +TEST_F(FormRegressionTestJak1, ExprMethod14DeadPool) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -64\n" @@ -1087,7 +1085,7 @@ TEST_F(FormRegressionTest, ExprMethod14DeadPool) { " )"; // note - there's likely an actual bug here. - test_with_expr_jak1( + test_with_expr( func, type, expected, false, "dead-pool", {{"L315", "WARNING: ~A ~A had to be allocated from the debug pool, because ~A was empty.~%"}, {"L314", "WARNING: ~A ~A could not be allocated, because ~A was empty.~%"}}, @@ -1095,7 +1093,7 @@ TEST_F(FormRegressionTest, ExprMethod14DeadPool) { "\t\t[[30,39], \"s4\", \"(pointer process)\"]]"); } -TEST_F(FormRegressionTest, ExprMethod15DeadPool) { +TEST_F(FormRegressionTestJak1, ExprMethod15DeadPool) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -16\n" @@ -1113,10 +1111,10 @@ TEST_F(FormRegressionTest, ExprMethod15DeadPool) { " daddiu sp, sp, 16"; std::string type = "(function dead-pool process none)"; std::string expected = "(begin (change-parent arg1 arg0) (none))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMethod0DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod0DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -64\n" @@ -1258,13 +1256,13 @@ TEST_F(FormRegressionTest, ExprMethod0DeadPoolHeap) { " (set! (-> obj heap top-base) (-> obj heap top))\n" " obj\n" " )"; - test_with_expr_jak1(func, type, expected, false, "dead-pool-heap", {}, - "[\t\t[60, \"v0\", \"int\"],\n" - "\t\t[61, \"a0\", \"pointer\"], [61, \"v0\", \"dead-pool-heap\"]]", - "{\"vars\":{\"v0-0\":[\"obj\", \"dead-pool-heap\"]}}"); + test_with_expr(func, type, expected, false, "dead-pool-heap", {}, + "[\t\t[60, \"v0\", \"int\"],\n" + "\t\t[61, \"a0\", \"pointer\"], [61, \"v0\", \"dead-pool-heap\"]]", + "{\"vars\":{\"v0-0\":[\"obj\", \"dead-pool-heap\"]}}"); } -TEST_F(FormRegressionTest, ExprMethod22DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod22DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " lwu v1, 0(a1)\n" @@ -1298,10 +1296,10 @@ TEST_F(FormRegressionTest, ExprMethod22DeadPoolHeap) { " (-> arg0 heap base)\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMethod21DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod21DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" "L209:\n" @@ -1384,13 +1382,13 @@ TEST_F(FormRegressionTest, ExprMethod21DeadPoolHeap) { " (&- (-> arg0 heap top) (the-as uint (-> arg0 heap base)))\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {}, - "[\t\t[5, \"v1\", \"pointer\"],\n" - "\t\t[13, \"a0\", \"pointer\"],\n" - "\t\t[25, \"v1\", \"pointer\"]]"); + test_with_expr(func, type, expected, false, "", {}, + "[\t\t[5, \"v1\", \"pointer\"],\n" + "\t\t[13, \"a0\", \"pointer\"],\n" + "\t\t[25, \"v1\", \"pointer\"]]"); } -TEST_F(FormRegressionTest, ExprMethod3DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod3DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -128\n" @@ -1563,13 +1561,13 @@ TEST_F(FormRegressionTest, ExprMethod3DeadPoolHeap) { " )\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", - {{"L300", "~Tprocess-list[0] @ #x~X ~D/~D bytes used~%"}, - {"L299", "~T [~3D] # ~A~%"}, - {"L298", "~T gap: ~D bytes @ #x~X~%"}}); + test_with_expr(func, type, expected, false, "", + {{"L300", "~Tprocess-list[0] @ #x~X ~D/~D bytes used~%"}, + {"L299", "~T [~3D] # ~A~%"}, + {"L298", "~T gap: ~D bytes @ #x~X~%"}}); } -TEST_F(FormRegressionTest, ExprMethod5DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod5DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " addiu v1, r0, -4\n" @@ -1581,11 +1579,11 @@ TEST_F(FormRegressionTest, ExprMethod5DeadPoolHeap) { std::string type = "(function dead-pool-heap int)"; std::string expected = "(+ (the-as int (- -4 (the-as int arg0))) (the-as int (-> arg0 heap top)))"; - test_with_expr_jak1(func, type, expected, false, "", {}, - "[[3, \"v1\", \"int\"], [3, \"a0\", \"int\"]]"); + test_with_expr(func, type, expected, false, "", {}, + "[[3, \"v1\", \"int\"], [3, \"a0\", \"int\"]]"); } -TEST_F(FormRegressionTest, ExprMethod19DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod19DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" "L194:\n" @@ -1634,10 +1632,10 @@ TEST_F(FormRegressionTest, ExprMethod19DeadPoolHeap) { " (- (memory-total arg0) (gap-size arg0 (-> arg0 alive-list prev)))\n" " 0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMethod20DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod20DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " lwu v1, 64(a0)\n" @@ -1647,10 +1645,10 @@ TEST_F(FormRegressionTest, ExprMethod20DeadPoolHeap) { " daddu sp, sp, r0"; std::string type = "(function dead-pool-heap int)"; std::string expected = "(&- (-> arg0 heap top) (the-as uint (-> arg0 heap base)))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMethod25DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod25DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -16\n" @@ -1690,10 +1688,10 @@ TEST_F(FormRegressionTest, ExprMethod25DeadPoolHeap) { " (&- v1-0 (the-as uint (-> arg0 heap base)))\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMethod26DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod26DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " lwu v0, 32(a0)\n" @@ -1701,10 +1699,10 @@ TEST_F(FormRegressionTest, ExprMethod26DeadPoolHeap) { " daddu sp, sp, r0"; std::string type = "(function dead-pool-heap uint)"; std::string expected = "(-> arg0 compact-time)"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMethod24DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod24DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -64\n" @@ -1758,10 +1756,10 @@ TEST_F(FormRegressionTest, ExprMethod24DeadPoolHeap) { " (while (and gp-0 (< (gap-size arg0 gp-0) arg1)) (set! gp-0 (-> gp-0 next)))\n" " gp-0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMethod14DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod14DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -112\n" @@ -2034,13 +2032,13 @@ TEST_F(FormRegressionTest, ExprMethod14DeadPoolHeap) { " )\n" " s3-0\n" " )"; - test_with_expr_jak1( + test_with_expr( func, type, expected, false, "", {{"L315", "WARNING: ~A ~A had to be allocated from the debug pool, because ~A was empty.~%"}, {"L314", "WARNING: ~A ~A could not be allocated, because ~A was empty.~%"}}); } -TEST_F(FormRegressionTest, ExprMethod15DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod15DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -64\n" @@ -2201,11 +2199,11 @@ TEST_F(FormRegressionTest, ExprMethod15DeadPoolHeap) { " 0\n" " (none)\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", - {{"L297", "ERROR: process ~A does not belong to dead-pool-heap ~A.~%"}}); + test_with_expr(func, type, expected, false, "", + {{"L297", "ERROR: process ~A does not belong to dead-pool-heap ~A.~%"}}); } -TEST_F(FormRegressionTest, ExprMethod17DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod17DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -64\n" @@ -2327,10 +2325,10 @@ TEST_F(FormRegressionTest, ExprMethod17DeadPoolHeap) { " )\n" " arg0\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprMethod16DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod16DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" " daddiu sp, sp, -96\n" @@ -2576,11 +2574,11 @@ TEST_F(FormRegressionTest, ExprMethod16DeadPoolHeap) { " 0\n" " (none)\n" " )"; - test_with_expr_jak1(func, type, expected, false, "", {{"L296", "~3LLow Actor Memory~%~0L"}}); + test_with_expr(func, type, expected, false, "", {{"L296", "~3LLow Actor Memory~%~0L"}}); } // nested method calls -TEST_F(FormRegressionTest, ExprMethod18DeadPoolHeap) { +TEST_F(FormRegressionTestJak1, ExprMethod18DeadPoolHeap) { std::string func = " sll r0, r0, 0\n" "L140:\n" @@ -2773,5 +2771,5 @@ TEST_F(FormRegressionTest, ExprMethod18DeadPoolHeap) { " 0\n" " (none)\n" " )"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } diff --git a/test/decompiler/test_math_decomp.cpp b/test/decompiler/test_math_decomp.cpp index 452079df75..38d468fc3f 100644 --- a/test/decompiler/test_math_decomp.cpp +++ b/test/decompiler/test_math_decomp.cpp @@ -4,7 +4,7 @@ using namespace decompiler; -TEST_F(FormRegressionTest, ExprTruncate) { +TEST_F(FormRegressionTestJak1, ExprTruncate) { std::string func = " sll r0, r0, 0\n" " mtc1 f0, a0\n" @@ -15,10 +15,10 @@ TEST_F(FormRegressionTest, ExprTruncate) { " daddu sp, sp, r0"; std::string type = "(function float float)"; std::string expected = "(the float (the int arg0))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprIntegralP) { +TEST_F(FormRegressionTestJak1, ExprIntegralP) { std::string func = " sll r0, r0, 0\n" " mtc1 f0, a0\n" @@ -37,10 +37,10 @@ TEST_F(FormRegressionTest, ExprIntegralP) { " daddu sp, sp, r0"; std::string type = "(function float float)"; std::string expected = "(the-as float (= (the float (the int arg0)) arg0))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprFractionalPart) { +TEST_F(FormRegressionTestJak1, ExprFractionalPart) { std::string func = " sll r0, r0, 0\n" " mtc1 f0, a0\n" @@ -55,10 +55,10 @@ TEST_F(FormRegressionTest, ExprFractionalPart) { " daddu sp, sp, r0"; std::string type = "(function float float)"; std::string expected = "(- arg0 (the float (the int arg0)))"; - test_with_expr_jak1(func, type, expected); + test_with_expr(func, type, expected); } -TEST_F(FormRegressionTest, ExprSeek) { +TEST_F(FormRegressionTestJak1, ExprSeek) { std::string func = " sll r0, r0, 0\n" "L24:\n" @@ -103,5 +103,5 @@ TEST_F(FormRegressionTest, ExprSeek) { " (else (- arg0 arg2))\n" " )\n" " )"; - test_with_expr_jak1(func, type, expected); -} \ No newline at end of file + test_with_expr(func, type, expected); +}