mercredi 22 février 2017

EXPECT_THROW - Actual: it throws a different type, google tests

Hi guys so i have this constructor

`Matrix::Matrix(size_t row, size_t col)
{
  if(row < 1 || col < 1)
    throw new std::runtime_error("Minimalni velikost matice je 1x1");
  matrix = std::vector<std::vector< double > >(row,std::vector<double>(col, 0));
}`

and this test

`Matrix *TestedMatrix;
 EXPECT_THROW(TestedMatrix = new Matrix(-2,3),std::runtime_error );`

but im still getting that exepction is of different type. I also tried std::runtime_error* but result is the same. I wanted use EXPECT_ANY_THROW at first but it was not displayed in my code coverage. Thanks for help ! :)

Aucun commentaire:

Enregistrer un commentaire