Add Doctest unit testing to C++ template project#3121
Merged
halx99 merged 4 commits intoaxmolengine:release/2.xfrom Apr 23, 2026
Merged
Add Doctest unit testing to C++ template project#3121halx99 merged 4 commits intoaxmolengine:release/2.xfrom
halx99 merged 4 commits intoaxmolengine:release/2.xfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a unit testing framework using doctest for the Axmol engine templates. It adds a new _AX_TESTS CMake option to enable a test target, modifies entry points across platforms (macOS, Linux, Windows) to run tests when enabled, and provides a sample test case. Feedback highlights a compilation error in the Windows entry point due to unnamed parameters, suggests using a generic bundle identifier for the test target on macOS, and recommends using a unique filename for the test batch script on Windows to avoid overwriting the main application's runner.
halx99
approved these changes
Apr 23, 2026
Contributor
Author
|
Hi @halx99, is there something I need to do? |
Collaborator
|
Nothing, merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
C++ Project Unit Testing
This PR integrates doctest (already part of the third-party dependencies) into the standard Axmol build system to enable seamless unit testing for C++ projects on desktop platforms.
Key changes include:
_AX_TESTS(default:OFF) in CMakeLists.txt. When enabled, the build system generates a separate test executable alongside the main game binary.set_target_propertiesto ensure the test executable is named${APP_NAME}_testto prevent overwriting the game build.AppDelegateand desktop-specificmain.cppfiles to conditionally invoke the doctest runner when the test flag is active._AX_TESTSis set.