Skip to content

Add SplashKit Transpiler - Automated C# unit testing - #175

Draft
rory-cd wants to merge 25 commits into
thoth-tech:mainfrom
rory-cd:feature/transpiler
Draft

rory-cd wants to merge 25 commits into
thoth-tech:mainfrom
rory-cd:feature/transpiler

Conversation

@rory-cd

@rory-cd rory-cd commented Sep 22, 2026 •

Copy link
Copy Markdown

Description

This PR adds a new program to the repo - the SplashKit Transpiler.

It automatically scans the specified directory (defaults to test/unit_tests) for C++ unit tests, and converts them to the target language. A C# translator module is included, for generating C# tests using the xUnit framework.

Documentation has been created - please see here for more information on file structure, building, and running the program.

Type of change

  • New feature (non-breaking change which adds functionality)

Known issues

  • Text test: C# translator ignores the following line: REQUIRE(VALID_PTR(test, FONT_PTR));, but this is fine since it is irrelevant in C#. The rest of the test generates fine, but font loading is not working for some reason.
  • Music and sound effect tests: The generated C# version of these tests fail due to the structure of the original tests, which should be updated. It is a structural issue with test setup/cleanup which doesn't affect Catch2, but breaks the test in xUnit. Specifically, the way open_audio() is used - it should be placed outside of each individual Section, to be used as setup for every execution path.
  • Bitmap test: In this test a variable (circ2) is re-declared inside a child section. The C# translator flattens sections into one scope, so this becomes an issue. This could be handled with re-declared nested variables being renamed.
  • Utilities test:
    • Some syntax is not yet supported (e.g. "INFINITY")
    • Some intentional C++ errors are thrown which aren't caught by C#
  • Network test: Fails. Cause to be determined
  • Geometry and Sprites tests: Contain some unsupported syntax

How Has This Been Tested?

Compiled and ran Transpiler in WSL.
Generated tests were verified manually (by eye), and run with dotnet test to ensure results are aligned with C++.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have requested a review from ... on the Pull Request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant