Detect when compiling for unit tests?

Sysprogs forums Forums VisualGDB Detect when compiling for unit tests?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31219
    curtis.hendrix
    Participant

    I’m trying to get a unit test project setup around the nRF52832.  When I try to run unit test with the soft device enabled, the soft device crashes.

    Is there a preprocessor macro that I could use to disable the soft device when unit tests are being run?

    #31220
    support
    Keymaster

    Sorry, there is no special flag like this.

    #31390
    curtis.hendrix
    Participant

    This example shows a function call to IsRunningUnitTests, but I can’t seem to find it in the test library.  I’m using CppUTest.

    https://visualgdb.com/tutorials/tests/arm/

    #31415
    support
    Keymaster

    Hi,

    The IsRunningUnitTests() function is a run-time check, rather than a compile-time one. If you have trouble finding it, please try following our unit test tutorial with exactly the same device and framework as shown (you don’t need to run the code) and use Go-to-definition to locate it. You will then get a reference point that can be easily compared against your project.

    If following the tutorial doesn’t work, please attach the relevant screenshots showing the difference, and we will try to help you.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.