Reputation: 19
I am using gtest for unit testing. I have to call a lot to arrays to test. But I am not figuring out how i can pass N - number of variables
in 'INSTANTIATE_TEST_CASE_P'
to test.
I have simply created two arrays array1
and array2
and I am passing these two array in the field 'testing :: Values'
of INSTANTIATE_TEST_CASE_P
to test both of them and this test is working fine.
INSTANTIATE_TEST_CASE_P(
ParameterizedTest,
TestParam,
testing :: Values(
array1,array2
));
I want to create N
-number of arrays like array1,array2,...,arrayN
. But I do not know how i can pass them in the field testing :: Values
of INSTANTIATE_TEST_CASE_P
to test all of these N arrays.
Upvotes: 0
Views: 405
Reputation: 415
The simplest solution is to gather all arrays in one class/struct, then have that struct passed as the parameter.
For anything more advanced, consult the "Parameter generator" section at https://github.com/google/googletest/blob/master/googletest/docs/advanced.md
Upvotes: 1