I am currently working in my matrix class. After completion of the matrix I am planing to write a unit test for this matrix class testing all the functions that I wrote. class Matrix{    Matrix(size_t, size_t);    Matrix transpose();    Matrix operator+(const Matrix&)const;    ...private:    std::vector<std::vector<double>> matrix;};How am I planning to test?Well currently I am planning not use any external library and use my own testing method. void test_transpose(){    matrix a = {...some value..}; // nxm    // I calculate the expected value via matlab    matrix expected = {...some value..}; // mxn    matrix b = a.transpose();    assert(expected == b);}void test_xxxxx1(){    ....} int main(){    test_transpose();      test_xxxxx1();    test_xxxxx2();    ...    return 0;}Can anyone give me advice if the method I am following is correct or is there any better method that I should follow?
How would I test my matrix class?
c++;unit testing
So I know you said that you're not planning on using an external library, but this is what I've done in similar situations with great success: 1) Generate millions of random matrix math problems and save them in a file. Make sure you cover every edge case you can think of while generating matrices.2) Get the answers using Matlab or Octave and save them in another file.3) Test that your code by reading both files and checking that you get the same answers.You're not so much using an external library in your code as you are creating a set of test cases with answers to check your code against.