/* This file is part of Eigen, a C++ template library for linear algebra * Copyright (C) 2007 Benoit Jacob * * Based on Tvmet source code, http://tvmet.sourceforge.net, * Copyright (C) 2001 - 2003 Olaf Petzold * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: SelfTest.cc,v 1.1 2004/04/24 11:55:15 opetzold Exp $ */ #include "main.h" template static void basics1() { const Vector vZero(0); const Vector vOne(1); const Matrix mZero(0); const Matrix mOne(1); for(int i = 0; i < n; i++) { QVERIFY(vZero(i) == T(0)); QVERIFY(vOne(i) == T(1)); } for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { QVERIFY(mZero(i,j) == T(0)); QVERIFY(mOne(i,j) == T(1)); } } } template static void basics2() { // test the CommaInitializer Vector v1; v1 = 1,2,3; Matrix m1; m1 = 1,4,7, 2,5,8, 3,6,9; assert(v1(0) == T(1) && v1(1) == T(2) && v1(2) == T(3)); assert(m1(0,0) == T(1) && m1(0,1) == T(4) && m1(0,2) == T(7) && m1(1,0) == T(2) && m1(1,1) == T(5) && m1(1,2) == T(8) && m1(2,0) == T(3) && m1(2,1) == T(6) && m1(2,2) == T(9)); } void TvmetTestSuite::selfTest() { basics1 (); basics1 (); basics1 (); basics1 (); basics2 (); basics2 (); #ifdef TVMET_HAVE_COMPLEX basics1, 4> (); basics1, 4> (); basics2 > (); basics2 > (); #endif }