Skip to content

Commit

Permalink
Merge pull request ethz-asl#15 from ethz-asl/gtest_near
Browse files Browse the repository at this point in the history
Gtest near
  • Loading branch information
simonlynen committed Aug 18, 2014
2 parents d403817 + 7a52ed0 commit c309bd5
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/test_gtest-near.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
#include <eigen-checks/entrypoint.h>
#include <eigen-checks/gtest.h>

#include "test_helper.h"

TYPED_TEST(EigenChecks, EigenMatrixNear_Matrix_Equal) {
EXPECT_TRUE(EIGEN_MATRIX_NEAR(this->ground_truth_matrix_54,
this->test_matrix_54_equal,
1e-8));
}

TYPED_TEST(EigenChecks, EigenMatrixNear_Matrix_NonEqualRandom) {
EXPECT_FALSE(EIGEN_MATRIX_NEAR(this->ground_truth_matrix_54,
this->test_matrix_54_random,
1e-8));
}

TYPED_TEST(EigenChecks, EigenMatrixNear_Matrix_OtherSize) {
EXPECT_FALSE(EIGEN_MATRIX_NEAR(this->ground_truth_matrix_54,
this->test_matrix_D4,
1e-8));
}

TYPED_TEST(EigenChecks, EigenMatrixNear_Matrix_Near5) {
EXPECT_TRUE(EIGEN_MATRIX_NEAR(this->ground_truth_matrix_54,
this->test_matrix_54_near_e_minus_5,
1e-4));
}

TYPED_TEST(EigenChecks, EigenMatrixNear_Vector_Equal) {
EXPECT_TRUE(EIGEN_MATRIX_NEAR(this->ground_truth_vector_5,
this->test_vector_5_equal,
1e-8));
}

TYPED_TEST(EigenChecks, EigenMatrixNear_Vector_NonEqualRandom) {
EXPECT_FALSE(EIGEN_MATRIX_NEAR(this->ground_truth_vector_5,
this->test_vector_5_random,
1e-8));
}

TYPED_TEST(EigenChecks, EigenMatrixNear_Vector_OtherSize) {
EXPECT_FALSE(EIGEN_MATRIX_NEAR(this->ground_truth_vector_5,
this->test_vector_D,
1e-8));
}

TYPED_TEST(EigenChecks, EigenMatrixNear_Vector_Near5) {
EXPECT_TRUE(EIGEN_MATRIX_NEAR(this->ground_truth_vector_5,
this->test_vector_5_near_e_minus_5,
1e-4));
}

UNITTEST_ENTRYPOINT

0 comments on commit c309bd5

Please sign in to comment.