-
Notifications
You must be signed in to change notification settings - Fork 44
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
User-defined functions based on lest macros #23
Comments
You need to provide the test environment, type For example:
Compile & run:
|
Nice! Many thanks, Martin! |
Good questions, you're welcome;) |
Martin, I just managed a few minutes ago to type some code.
|
.. it would be handy if you show the source code for what you're trying to accomplish... |
Martin, I was wrong! Your code runs fine! I compiled the wrong file.. 8-)
The above code is compiled and produces the below output:
|
mm missed the " for the above code" ... |
... The real content of |
Please see my previous post, which was updated with code + output of StandaloneFunction.cpp. Thank you! |
Works for me with gcc 4.8.1. |
Thanks, then it might be due to the environment (gcc 4.8.1 runs under MinGW).. |
For above test I used MinGW gcc 4.8.1 (not via msys) under Windows 8.1. I've no idea(s) yet what might go wrong. |
Done! So .. on Fedora 22 (gcc 5.1.1), the below code:
.. produces the following output (at least first error lines below are same as the ones I had with gcc 4.8.1 above):
So given I reproduced it on a fresh installation as well (so in my case Win 7 + Fedora 22), I would like to know why this is not the case on your machine. This might be..: Thanks! |
Ouch.. dos2unix lest.hpp did the trick on Fedora (and I would expect this to be the case on Windows as well)! |
Great! Line ending did cross my mind... Was writing: a) this is what I had already done, and just did again: it compiles/runs fine, Just to be sure: which lest code did you download? |
Just using LF under Windows (as it appears after unzip with 7-zip) does not lead to erroneous compilation under Windows 8.1/g++ 4.8.1. |
Untar using:
.. on Fedora still leads to the compilation error above. Sorry, in my previous post I did a mistake: dos2unix does not fixed this on Fedora (I double checked again by running it on all files from lest framework). My next step will be to unzip on Windows 7 with 7-zip and see if that makes a difference. |
Isn't the source of the problem in the source file |
It can be anywhere, so also in StandaloneFunction.cpp.
(of course first 54k lines skipped)
Thanks! |
Compiling the preprocessed source-code will give the following error
I think it expects that the below will first be closed using '}' .. but why does it work in your case then?
|
Ok, I was right to ask for the real code in Take note of your line(44) Then please read Module registration macro: No need, meaning it's an error to do so. Cheers, |
... and look at lines 3, 13,14, 41 and 44. Either: Use modules:
and omit or Use auto test registration:
and specify Please have a look/start from the relevant examples. |
Martin, I referenced something which was already posted, to reduce the length of the post. Thank you a lot for the examples and documentation reference!! Maybe for the future a preprocessing error (which would politely invite the ignorant user to "Please read the ... manual") could help in getting faster to the problem when manual registration macros are used ; ) OK, I will next try to combine manual registration & reusable functions, as this is what my test currently uses. Cheers, |
Indeed makes sense to try to warn against unintended or unsupported use.
cheers, |
I think a preprocessor check in lest_MODULE() would suffice. So manual registration & reusable functions in a sample program work amazing. Cheers, |
Hi, again a basic question about a simple use-case: what options are available for users which need stand-alone functions which use lest related macros (like EXPECT(), etc.)?
My use-case would be a (reusable) function which needs to be called repeatedly from one or more CASE()s.
I tried the classic approaches: stand-alone function defined outside of CASE() as well as lambda function - defined inside the CASE(), which contains EXPECT() calls- but I did not managed to have working code (gcc 4.8.1).
Here is the error when calling the lambda function containing the EXPECT() calls:
Cheers,
Marius
The text was updated successfully, but these errors were encountered: