0

I am using gtest for my tests and i am discovering value-parameterized tests. I understand the google example with

int tab[] = {1, 2, 3};    
INSTANTIATE_TEST_CASE_P(MyTestName, MyTest, ::testingCombine(Bool(), ::testing::ValuesIn(tab)));

It is testing all combinations of 'true' with {1, 2, 3} and 'false' with {1,2,3}.

  1. If i want to fix the Boolean to 'false', how do i do ?
  2. And i want to test several combinations like (true, ::testing::ValuesIn(tab)), (true, ::testing::ValuesIn(tab2)) , (false, ::testing::ValuesIn(tab3)) ?

Well, i am lost.

YopAndMail
  • 53
  • 5
  • I find a way but i wish it still could exist a more elegant way with a "::testingValueIn". I use an array of std::tuple: `std::tuple tab[] = { std::make_tuple(true, 1), std::make_tuple(true, 12) };` – YopAndMail Aug 06 '20 at 13:42
  • Another possibility for fixing a parameter is to use a one element array. `bool tabBool[] = {true}; INSTANTIATE_TEST_CASE_P(MyTestName, MyTest, ::testingCombine(::testing::ValuesIn(tabBool), ::testing::ValuesIn(tab)));` – YopAndMail Aug 06 '20 at 14:47

0 Answers0