Expecting the arrays are static then you can pass them like the following example shows:
class ArrayTests : public UnitTest_SomeClass,
public testing::WithParamInterface<std::pair<int*, int*>>
{
};
TEST_P(ArrayTests, doSomething)
{
const auto pair = GetParam();
const auto a = pair.first;
const auto b = pair.second;
EXPECT_EQ(4, a[3]);
EXPECT_EQ(6, b[4]);
}
int a[]{ 1,2,3,4 };
int b[]{ 2,3,4,5,6 };
INSTANTIATE_TEST_CASE_P(UnitTest_SomeClass, ArrayTests, testing::Values(std::make_pair(a, b)));
You can now pass different arrays to the test:
int a0[]{ 1,2,3,4 };
int b0[]{ 2,3,4,5,6 };
int a1[]{ 7,8,9,10 };
int b1[]{ 2,3,4,5,6 };
INSTANTIATE_TEST_CASE_P(UnitTest_SomeClass, ArrayTests, testing::Values(std::make_pair(a0, b0), std::make_pair(a1, b1)));
I think it would be easier to use std::vector
here for the int arrays, cause you got access to the number of elements. HTH