Hi Robin,
Sorry for my slow reply!
> I did some searching and I saw something about adding functionality to cpputest for "ReturnValueOrDefault" but didn't quite follow all of that. It sounded as if the goal was to allow a test case to tell the mock to return some specific value other than the default return value, yes?
Yes.
> Does anyone know if that's been added yet?
Not yet integrated :(
> And does/will it support different return value types (e.g., int, bool, etc)? The majority of the time I want my mock'd methods to return a default "success" value but there are a couple of instances I need to have them return a failure condition.
Yes, it would be for all the types.
> Using a global value would work but isn't very elegant. Any thoughts?
Yes, this is what setData and getData is for. You can, in your test, do setData and it will map a value to a String. In your mock, you can then do getData and you'll get the value. This way, you don't need to hassle with globals and header files and you can achieve the same thing.
> Also, assuming it's in place, would it basically act as an immediate return (i.e., no code after that in the mock'd method would run)? Because if so, then that would cause problems in that just prior to the return statement, I'm posting to a semaphore (on which my test case has been blocked).
It couldn't act as an immediate return, I guess, as it will be a function and not a macro. In a function, I can't say that the function calling the function must immediately return :)
Hope this helps?
Thanks!
Bas
>
> Thanks,
> Robin
>
> --
> You received this message because you are subscribed to the Google Groups "cpputest" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
cpputest+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>