+1
0
-1

Stubbing a function with multiple calls using user code

Hello everyone,

i would like to stub a parameter of a function that gets called several times inside another function, something like the following:

void func1(void){
func(a,...

Posting in: 

5 Answers:

+1
+1
-1

Hello,

It can be done without user code. Just use a comma separated list for the input value. E.g.  1,2

In user code it is just C code.

Let's say the two returns need to be...

+1
0
-1

hello brian,

thank you very much for your response.

i am using user code because the parameter is a void pointer and i can't seem to stub it directly using commas. if there is a...

+1
0
-1

Hi,

I'm worried there may be some typos in your code, so I've created some code from scratch

Source unit.

void func(int a, void *b);

void func1()
{
  int a, b...

+1
0
-1

Hello brian,

I figured out the problem but i am not sure what was causing it.

I changed the data type of the variable "val" to char instead of int and the "type cast...

+1
+1
-1

Hello Mohab,

Be very careful with C. You can write any value to a char and C will truncate it if necessary (maybe with a compile warning). Compile warnings are difficult to see in...