-
Notifications
You must be signed in to change notification settings - Fork 0
Add dmod unit test framework: dmod_test.h, DMOD_TEST_STEP, dmod_add_test, Dmod_RunTests #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7705b6a
Initial plan
Copilot 5d9e10b
Add dmod unit test framework (dmod_test.h, dmod_add_test, DMOD_TEST_S…
Copilot b22a178
Refactor test runner: move helpers to dmod, add CLI filtering, add ex…
Copilot 0d5f5aa
Add Dmod_RunTests/Dmod_RunModuleTests; refactor test_main to register…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| add_subdirectory(library) | ||
| add_subdirectory(application) | ||
| add_subdirectory(log_step) | ||
| add_subdirectory(log_step) | ||
| add_subdirectory(test_example) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| set(DMOD_MODULE_NAME test_example) | ||
| set(DMOD_MODULE_VERSION "1.0") | ||
| set(DMOD_AUTHOR_NAME "DMOD") | ||
|
|
||
| dmod_add_test(${DMOD_MODULE_NAME} ${DMOD_MODULE_VERSION} | ||
| test_example_test.c | ||
| ) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /** | ||
| * @file test_example_test.c | ||
| * @brief Example DMOD test module | ||
| * | ||
| * Demonstrates the dmod_add_test / DMOD_TEST_STEP framework. | ||
| * All steps here must pass so the CI job exits with 0. | ||
| */ | ||
| #include "dmod_test.h" | ||
|
|
||
| void dmod_test_setup(void) | ||
| { | ||
| /* runs before every step */ | ||
| } | ||
|
|
||
| void dmod_test_teardown(void) | ||
| { | ||
| /* runs after every step */ | ||
| } | ||
|
|
||
| DMOD_TEST_STEP(arithmetic) | ||
| { | ||
| DMOD_TEST_EXPECT_EQ( 1 + 1, 2 ); | ||
| DMOD_TEST_EXPECT_NE( 1 + 1, 3 ); | ||
| } | ||
|
|
||
| DMOD_TEST_STEP(boolean) | ||
| { | ||
| DMOD_TEST_EXPECT_TRUE( 1 ); | ||
| DMOD_TEST_EXPECT_FALSE( 0 ); | ||
| } | ||
|
|
||
| DMOD_TEST_STEP(null_checks) | ||
| { | ||
| void* p = (void*)0; | ||
| DMOD_TEST_EXPECT_NULL( p ); | ||
| p = (void*)1; | ||
| DMOD_TEST_EXPECT_NOT_NULL( p ); | ||
| } |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nie dodałeś wsparcia dla tej sygnatury do ApiSignature i nie ma szans by ten moduł ci ruszył
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in
0d5f5aa.Dmod_RunTestsis now declared asDMOD_BUILTIN_API(Dmod, 1.0, int, _RunTests, (Dmod_Context_t* Context, int argc, char* argv[]))ininc/dmod.h. On the system side this registers the implementation in.dmod.inputs; on the module side it creates the output function-pointer slot that gets resolved at load time — same mechanism as every other builtin.