From 95c13d64dc2cae7552466506c98fc2bb116c25be Mon Sep 17 00:00:00 2001 From: dellaert Date: Sat, 15 Feb 2014 12:10:41 -0500 Subject: [PATCH] Minimal unit test, forgotten by @richardroberts :-) --- .cproject | 8 ++++ gtsam/base/tests/testVerticalBlockMatrix.cpp | 47 ++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 gtsam/base/tests/testVerticalBlockMatrix.cpp diff --git a/.cproject b/.cproject index ef291326f..e6e040b97 100644 --- a/.cproject +++ b/.cproject @@ -2100,6 +2100,14 @@ true true + + make + -j5 + testVerticalBlockMatrix.run + true + true + true + make -j5 diff --git a/gtsam/base/tests/testVerticalBlockMatrix.cpp b/gtsam/base/tests/testVerticalBlockMatrix.cpp new file mode 100644 index 000000000..fad23fa7d --- /dev/null +++ b/gtsam/base/tests/testVerticalBlockMatrix.cpp @@ -0,0 +1,47 @@ +/* ---------------------------------------------------------------------------- + + * GTSAM Copyright 2010, Georgia Tech Research Corporation, + * Atlanta, Georgia 30332-0415 + * All Rights Reserved + * Authors: Frank Dellaert, et al. (see THANKS for the full author list) + + * See LICENSE for the license information + + * -------------------------------------------------------------------------- */ + +/** + * @file testVerticalBlockMatrix.cpp + * @brief Unit tests for VerticalBlockMatrix class + * @author Frank Dellaert + * @date February 15, 2014 + **/ + +#include +#include +#include + +using namespace std; +using namespace gtsam; +using boost::assign::list_of; + +//***************************************************************************** +TEST(VerticalBlockMatrix, constructor) { + VerticalBlockMatrix actual(list_of(3)(2)(1), + (Matrix(6, 6) << 1, 2, 3, 4, 5, 6, // + 2, 8, 9, 10, 11, 12, // + 3, 9, 15, 16, 17, 18, // + 4, 10, 16, 22, 23, 24, // + 5, 11, 17, 23, 29, 30, // + 6, 12, 18, 24, 30, 36)); + EXPECT_LONGS_EQUAL(6,actual.rows()); + EXPECT_LONGS_EQUAL(6,actual.cols()); + EXPECT_LONGS_EQUAL(3,actual.nBlocks()); +} + +//***************************************************************************** +int main() { + TestResult tr; + return TestRegistry::runAllTests(tr); +} +//***************************************************************************** +