Include the expected result with the inputs. Instead of a triple of input values, make your test parameter a 4-tuple.
class MyTest: public ::testing::TestWithParam< std::tr1::tuple<double, double, double, double>> { }; TEST_P(MyTest, TestFormula) { double const C = std::tr1::get<0>(GetParam()); double const A = std::tr1::get<1>(GetParam()); double const B = std::tr1::get<2>(GetParam()); double const result = std::tr1::get<3>(GetParam()); ASSERT_EQ(result, MyFormula(A, B, C)); }
The disadvantage is that you cannot save your test parameters with testing::Combine . Instead, you can use testing::Values to define each individual 4-tuple that you want to test. You can click on the argument limit for Values so that you can split your instances, for example by putting all C = 1 cases in one and all C = 2 cases in another.
INSTANTIATE_TEST_CASE_P( TestWithParametersC1, MyTest, testing::Values(
Or you can put all the values ββin an array separately from your instance, and then use testing::ValuesIn :
std::tr1::tuple<double, double, double, double> const FormulaTable[] = {
source share