You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@mynewt.apache.org by "wiktorkwiatkowski (via GitHub)" <gi...@apache.org> on 2026/01/29 15:02:47 UTC
[PR] test/automated: Add initial test framework implementation [mynewt-core]
wiktorkwiatkowski opened a new pull request, #3566:
URL: https://github.com/apache/mynewt-core/pull/3566
The framework provides macros for defining test cases and test suites with automatic counting of passed and failed tests.
Features:
- MTEST_CASE macro for defining individual test cases
- MTEST_SUITE macro for grouping test cases into suites
- MTEST_ASSERT macro for test assertions with formatted output
- MTEST_INIT and MTEST_CLEANUP for initializing/deinitializing necessary resources
- MTEST_RUN_INIT and MTEST_RUN_CLEANUP for executing initialization and cleanup
Init and cleanup are optional for the user to define. Any configuration to be done **must be run explicitly** by the user via the defined macros **MTEST_RUN_INIT** and **MTEST_RUN_CLEANUP** at the beginning and end of the suite, test cases should be placed between those two macros.
Example usage:
```
MTEST_INIT(pwm_test)
{
pwm = pwm_open();
}
MTEST_CLEANUP(pwm_test)
{
pwm_close(pwm);
}
MTEST_CASE(pwm_duty_test)
{
int top = pwm_get_top_value(pwm);
MTEST_ASSERT(top > 0, "Get top value");
int rc = pwm_set_duty_cycle(pwm, 0, top / 2);
MTEST_ASSERT(rc == 0, "Set duty 50%%");
}
MTEST_SUITE(pwm_test)
{
MTEST_RUN_INIT(pwm_test);
pwm_duty_test();
MTEST_RUN_CLEANUP(pwm_test);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test/automated: Add initial test framework implementation [mynewt-core]
Posted by "wiktorkwiatkowski (via GitHub)" <gi...@apache.org>.
wiktorkwiatkowski closed pull request #3566: test/automated: Add initial test framework implementation
URL: https://github.com/apache/mynewt-core/pull/3566
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org