Hello everyone,
I do not understand and i might be doing something wrong here so i will give some detail.
I am mocking a built in 12c_read function (dev, ADDR, read_buff, sizeof(readbuff))
this function works with both given single uint8_t val and an array of uint8_t but cannot get it to work while testing.
the working example using a single uint8_t val
struct device *i2c_dev = GET(DEV);
uint8_t ADDR = 0x19;
uint8_t val = 0xf;
i2c_read_ExpectAndReturn(dev, ADDR, NULL, sizeof(val));
i2c_read_IgnoreArg_read_buffer(); /// this is that name of the 3rd arg in read function
i2c_read_ReturnThruPtr_read_buffer(&val);
in the situation above, it woks and i am able to go through all branches from the function that i am testing.
but if i change this to be used as an array It returns all zeros and i cannot test any of the
logic that checks for non-zero data.
uint8_t val[] = {0x2, 0x3};
uint8_t size = 2;
i2c_read_ExpectAndReturn(dev, ADDR, NULL, sizeof(val));
i2c_read_IgnoreArg_read_buffer(); /// this is that name of the 3rd arg in read function
i2c_read_ReturnArrayThruPtr_read_buffer(&val, size);
am i not using ReturnArray... correctly?
thanks.