/* -*- C++ -*-
*
* ---------------------------------------------------------------------
* $Id: testfvec2.cpp,v 1.1.1.1 2002/08/28 18:52:39 drory Exp $
* ---------------------------------------------------------------------
*
* Copyright (C) 2000-2002 Niv Drory <drory@usm.uni-muenchen.de>
* Claus A. Goessl <cag@usm.uni-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* ---------------------------------------------------------------------
*
*/
#define LTL_RANGE_CHECKING
#define LTL_TEMPLATE_LOOP_LIMIT 0
#include <ltl/fvector.h>
#include <iostream>
using namespace ltl;
using std::cout;
using std::endl;
int main(int argc, char **argv)
{
cerr << "Testing FVector (for-loops) ..." << endl;
FVector<float,3> A;
A = 1,2,3;
LTL_ASSERT_( (A(1) == A[0] && A(1) == 1. && A(2) == 2. && A(3) == 3.),
"FVector basic indexing failed" );
FVector<float,3> B = A;
LTL_ASSERT_( (B(1) == 1. && B(2) == 2. && B(3) == 3.),
"FVector init assignment failed" );
B = 1.;
LTL_ASSERT_( (B(1) == 1. && B(2) == 1. && B(3) == 1.),
"FVector assignment failed" );
FVector<float,3> C = 0.;
C = A + B + log10(B);
FVector<float,3> D;
D = 2,3,4;
LTL_ASSERT_( (C(1) == D(1) && C(2) == D(2) && C(3) == D(3) ),
"FVector expression failed" );
LTL_ASSERT_( allof( C == D ),
"FVector allof() failed" );
LTL_ASSERT_( noneof( C != D ),
"FVector noneof() failed" );
LTL_ASSERT_( !anyof( C != D ),
"FVector anyof() failed" );
C *= C;
LTL_ASSERT_( allof( C == pow2(D) ),
"FVector allof(expr) failed" );
float d = dot(D,D);
float dd = D(1)*D(1) + D(2)*D(2) + D(3)*D(3);
LTL_ASSERT_( (d==dd),
"FVector dot() failed" );
}
syntax highlighted by Code2HTML, v. 0.9.1