You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a hardware abstraction layer interface, as well as a driver interface. I have multiple drivers utilizing the HAL interface, while implementing the driver interface. This plugin approach causes me to have identically named tests across multiple test files.
For example:
TEST_CASE("init() returns `E_HAL_INIT`, when HardwareAbstractionLayer::init() returns an error", "[init][hal][error]") {
When I attempt to compile multiple test files into a single test runner, then I get the following name collisions...
error: TEST_CASE( "init() returns `SUCCESS`, when no errors occur" ) already defined.
First seen at signal_generator.test.cpp:36
Redefined at led_ntsc_driver.test.cpp:179
I noticed you have a flag on the test binary, --filenames-as-tags. I am curious if you could incorporate the "test case + tags" into a test identifier to achieve uniqueness.
This seems like an elegant solution to this problem, unless you already have a workaround. If so, would you please share the preferred pattern with me.
Thanks,
Zak
The text was updated successfully, but these errors were encountered:
You aren't first to ask this, and there is a relatively simple workaround, as long as you keep your test case named with string literals (strictly speaking you don't have to).
This should work
#defineFILE_TEST_CASE(...) (__FILE__ __VA_ARGS__)
Caveats: It is too early in the morning to think about anonymous test cases (TEST_CASE()), but they should work, if you dynamically create the test name, you will have to do proper concatenation.
Description
I have a hardware abstraction layer interface, as well as a driver interface. I have multiple drivers utilizing the HAL interface, while implementing the driver interface. This plugin approach causes me to have identically named tests across multiple test files.
For example:
When I attempt to compile multiple test files into a single test runner, then I get the following name collisions...
I noticed you have a flag on the test binary,
--filenames-as-tags
. I am curious if you could incorporate the "test case + tags" into a test identifier to achieve uniqueness.This seems like an elegant solution to this problem, unless you already have a workaround. If so, would you please share the preferred pattern with me.
Thanks,
Zak
The text was updated successfully, but these errors were encountered: