sample_test.cpp
Go to the documentation of this file.
00001 // Copyright (C) 2007 Klaas Gadeyne <first dot last at gmail dot com>
00002 //
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016 //
00017 
00018 #include "sample_test.hpp"
00019 
00020 // Registers the fixture into the 'registry'
00021 CPPUNIT_TEST_SUITE_REGISTRATION( SampleTest );
00022 using namespace BFL;
00023 
00024 void
00025 SampleTest::setUp()
00026 {
00027   a = ColumnVector(3);
00028   a(1) = 1; a(2) = 2; a(3) = 1;
00029   a_sample_cv.ValueSet(a);
00030   a_sample_int.ValueSet(2);
00031   a_sample_double.ValueSet(3.1);
00032 
00033   b_sample_cv = a_sample_cv;
00034 
00035 }
00036 
00037 
00038 void
00039 SampleTest::tearDown()
00040 {
00041 }
00042 
00043 void
00044 SampleTest::testSampleValue()
00045 {
00046     // Test one way
00047     CPPUNIT_ASSERT_EQUAL( a, a_sample_cv.ValueGet());
00048     CPPUNIT_ASSERT_EQUAL( 2.0  , (a_sample_cv.ValueGet())(2));
00049     //    CPPUNIT_ASSERT_EQUAL( a_sample_cv, b_sample_cv);
00050     CPPUNIT_ASSERT_EQUAL( a_sample_cv.ValueGet(), b_sample_cv.ValueGet());
00051 
00052     CPPUNIT_ASSERT_EQUAL( 2, a_sample_int.ValueGet());
00053     CPPUNIT_ASSERT_EQUAL( 3.1, a_sample_double.ValueGet());
00054 }
00055 
00056 void
00057 SampleTest::testSampleDimension()
00058 {
00059   CPPUNIT_ASSERT_EQUAL((unsigned int) 3,a_sample_cv.DimensionGet());
00060   CPPUNIT_ASSERT_EQUAL((unsigned int) 3,b_sample_cv.DimensionGet());
00061   CPPUNIT_ASSERT_EQUAL((unsigned int) 1,a_sample_int.DimensionGet());
00062   CPPUNIT_ASSERT_EQUAL((unsigned int) 1,a_sample_double.DimensionGet());
00063 }
00064 
00065 void
00066 SampleTest::testWeightedSample()
00067 {
00068   double weight = 0.75;
00069   a_weighted_sample_cv.ValueSet(a);
00070   a_weighted_sample_cv.WeightSet(weight);
00071   CPPUNIT_ASSERT_EQUAL( weight, a_weighted_sample_cv.WeightGet());
00072 
00073   b_weighted_sample_cv = a_weighted_sample_cv;
00074   CPPUNIT_ASSERT_EQUAL( a_weighted_sample_cv.ValueGet(), b_weighted_sample_cv.ValueGet());
00075   CPPUNIT_ASSERT_EQUAL( a_weighted_sample_cv.WeightGet(), b_weighted_sample_cv.WeightGet());
00076 }
00077 
00078 // void
00079 // SampleTest::testTimeProgress()
00080 // {
00081 //     CPPUNIT_ASSERT( t !=  hbg->getTicks() );
00082 // }
00083 
00084 
00085 


bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Sun Oct 5 2014 22:29:53