implement the first _real_ unit-tests, testing the results for correctness instead

of just checking compilation.

Fix the many issues discovered by these unit-tests, by the way fixing a performance bug.
This commit is contained in:
Benoit Jacob
2007-10-13 16:56:24 +00:00
parent 31061557a5
commit e445f5085a
16 changed files with 132 additions and 281 deletions

View File

@@ -7,24 +7,20 @@ using namespace std;
template<typename Scalar, typename Derived>
void foo(const Eigen::Object<Scalar, Derived>& m)
{
cout << "Here's m:" << endl << m << endl;
cout << "Here's m:" << endl << m << endl;
}
template<typename Scalar, typename Derived>
Eigen::ScalarMultiple<Derived>
twice(const Eigen::Object<Scalar, Derived>& m)
{
return 2 * m;
return 2 * m;
}
int main(int, char**)
{
Matrix2d m;
m(0,0)= 1;
m(1,0)= 2;
m(0,1)= 3;
m(1,1)= 4;
foo(m);
foo(twice(m));
return 0;
Matrix2d m = Matrix2d::random();
foo(m);
foo(twice(m));
return 0;
}