Rtrt stub for an input parameter of an array

883 Views Asked by At

I have a stub like "void read(uint8 _inout data[5]); " .Now I need to expect a value 2 for data[3]. I have done multiple methods like below "stub read((0,0),(0,0),(0,0),(0,2)) " "stub read({0,0,0,0},{0,0,0,2})

but none of them are working. Please help me regarding this.

1

There are 1 best solutions below

0
Van Tr On

Your array data[5] has 5 element so I believe this should work:

STUB read 1=> ({0,0,0,0,0}, {0,0,0,2,0})

You could also create 2 arrays and pass to the stub:

ARRAY in_array, INIT = 0, EV ==

ARRAY out_array, INIT = (0 => 0, 1=> 0, 2=> 0, 3=>2, others=>0), EV ==

STUB read((in_array, out_array))