diff options
author | 2007-12-02 18:32:59 +0000 | |
---|---|---|
committer | 2007-12-02 18:32:59 +0000 | |
commit | e05f29191e7c7e0433b49f88016cb9fb348985d7 (patch) | |
tree | 4a408b5d04459cfddbedfdd2fc280c1c1cc9a021 /test/basicstuff.cpp | |
parent | 2fdd067d9e353fe26f2526789691978678bc3d0a (diff) |
Much more convenient, less over-engineered NumTraits. Done during this KDE-Edu weekend.
Diffstat (limited to 'test/basicstuff.cpp')
-rw-r--r-- | test/basicstuff.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp index d929b0883..babddb670 100644 --- a/test/basicstuff.cpp +++ b/test/basicstuff.cpp @@ -25,6 +25,8 @@ #include "main.h" +namespace Eigen { + template<typename MatrixType> void basicStuff(const MatrixType& m) { /* this test covers the following files: @@ -56,14 +58,15 @@ template<typename MatrixType> void basicStuff(const MatrixType& m) v2 = VectorType::random(rows), vzero = VectorType::zero(rows); - Scalar s1 = NumTraits<Scalar>::random(), - s2 = NumTraits<Scalar>::random(); + Scalar s1 = random<Scalar>(), + s2 = random<Scalar>(); // test Fuzzy.h and Zero.h. QVERIFY(v1.isApprox(v1)); QVERIFY(!v1.isApprox(2*v1)); QVERIFY(vzero.isMuchSmallerThan(v1)); - QVERIFY(vzero.isMuchSmallerThan(v1.norm())); + if(NumTraits<Scalar>::HasFloatingPoint) + QVERIFY(vzero.isMuchSmallerThan(v1.norm())); QVERIFY(!v1.isMuchSmallerThan(v1)); QVERIFY(vzero.isApprox(v1-v1)); QVERIFY(m1.isApprox(m1)); @@ -134,8 +137,10 @@ template<typename MatrixType> void basicStuff(const MatrixType& m) void EigenTest::testBasicStuff() { basicStuff(Matrix<float, 1, 1>()); - basicStuff(Matrix<complex<double>, 4, 4>()); + basicStuff(Matrix4cd()); basicStuff(MatrixXcf(3, 3)); basicStuff(MatrixXi(8, 12)); basicStuff(MatrixXd(20, 20)); } + +} // namespace Eigen |