Skip to content
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

Ignore calling order of mocked functions #439

Open
gorogbalazs opened this issue May 9, 2023 · 3 comments
Open

Ignore calling order of mocked functions #439

gorogbalazs opened this issue May 9, 2023 · 3 comments

Comments

@gorogbalazs
Copy link

gorogbalazs commented May 9, 2023

(This is a feature request, I hope this is the right place for it.)

It would be nice to have some way to ignore calling order of mocked functions. E.g.

    for (uint8_t i = 0; i < n; i++)
    {
        Cmock_start_ignore_call_order();
        functionA_Expect(...);
        functionB_Expect(...);
        functionC_Expect(...);
        functionD_Expect(...);
        Cmock_stop_ignore_call_order();
    }

In my case it does not matter, whether I call functionA first or functionD, what matters is that all of them are called with the correct values. Currently this can only be implemented with a lot of boilerplate, if I also want to check the parameter values (add stubs, set flags, use global vars, etc.).

@mvandervoord
Copy link
Member

Hi. This feature exists. In your project configuration file, set the following:

:cmock:
  :enforce_strict_ordering: false

@gorogbalazs
Copy link
Author

gorogbalazs commented May 9, 2023

Thank you for your fast reply. If I understand you correctly, that setting is going to turn off order checking in all the tests in the project. What if I only want to apply it for a specific subpart of the tests (e.g. only 1 or 2 functions of the unit under test)? Is there a feature to solve that?

@mvandervoord
Copy link
Member

At the moment there is not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants