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

mock tests fails on cygwin64 - because of typing problems #37

Closed
thoni56 opened this issue Nov 21, 2015 · 4 comments · Fixed by #38
Closed

mock tests fails on cygwin64 - because of typing problems #37

thoni56 opened this issue Nov 21, 2015 · 4 comments · Fixed by #38

Comments

@thoni56
Copy link
Contributor

thoni56 commented Nov 21, 2015

On Cygwin64 a couple of tests fails (always_expect_keeps_affirming_parameter, expect_a_sequence and learning_mocks_emit_pastable_code), all because of the va_arg unpacking wrong size of data.

It seems that on Cygwin64 uintptr_t are bigger than int so when an int argument to mock() is unpacked often garbage is included.

(Strange thing is that those tests have code that causes multiple evaluation of constraints and every one fails on this problem except the last one in the test, no matter how many you add....)

They pass if the argument to the mocked function is defined as uintptr_t so this is some kind of proof of the problem.

Is there a way to force a type cast to uintptr_t to all VA_ARGS in the mock() macro?

I suppose I'm asking @matthargett primarily, but any input is appreciated.

@thoni56
Copy link
Contributor Author

thoni56 commented Nov 21, 2015

Adding a cast in the macro like

..., (uintptr_t)__VA_ARGS__, ...

works, but I am assuming this only covers the first argument.

@thoni56
Copy link
Contributor Author

thoni56 commented Nov 21, 2015

@thoni56
Copy link
Contributor Author

thoni56 commented Nov 21, 2015

Ok, so problem was not applying the cast to actual arguments to mock(). That is done already. But only if there are more than one...

@thoni56
Copy link
Contributor Author

thoni56 commented Nov 21, 2015

Ok, created a PR with a fix, so closing this.

@thoni56 thoni56 closed this as completed Nov 21, 2015
thoni56 added a commit that referenced this issue Nov 21, 2015
Fixed #37 - single mock() argument was not cast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant