Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

LinearProcessorTester.cxx

Go to the documentation of this file.
00001 // ================================================
00002 // Test program for Linearprocessor
00003 // ================================================
00004 
00005 #include "FastShowerUtils/LinearProcessorTester.h"
00006 #include "FastShowerUtils/LinearProcessor.h"
00007 #include "FastShowerUtils/TestStat.h"
00008 
00009 namespace FastShower{
00010   LinearProcessorTester::~LinearProcessorTester(){}
00011   TestStat LinearProcessorTester::test(){
00012     m_ts+=this->test1();
00013     return m_ts;
00014   }
00015   TestStat LinearProcessorTester::test1(){
00016     TestStat ts;
00017     
00018 
00019     std::vector<double>::const_iterator xEnd = m_testPoints.end();
00020     std::vector<double>::const_iterator aEnd = m_a.end();
00021     std::vector<double>::const_iterator bEnd = m_b.end();
00022 
00023     std::vector<double>::const_iterator xIter = m_testPoints.begin();
00024 
00025     for (;xIter!=xEnd; ++xIter){
00026       std::vector<double>::const_iterator aIter = m_a.begin();
00027       for (;aIter!=aEnd; ++aIter){
00028         std::vector<double>::const_iterator bIter = m_b.begin();
00029         for (;bIter!=bEnd; ++bIter){
00030           double a(*aIter); double b(*bIter); double x(*xIter);
00031           //      cout<<"test1:  a: "<<a<<"  b: "<<b<<"  x: "<<x<<endl;
00032           LinearProcessor lp(a, b);
00033           (lp.process(x)==(a*x+b))? ts.incPass():ts.incFail();
00034         }
00035       }
00036     }
00037     return ts;
00038   }        
00039   void LinearProcessorTester::results() const{
00040     cout<<"LinearProcessorTester: "<<m_ts;
00041     if(!m_ts) cout<<" Failures! ";
00042     cout<<endl;
00043   }
00044     
00045   
00046 }//namespace
00047 
00048 
00049 
00050 
00051 
00052 

Generated on Tue Mar 18 11:50:01 2003 for FastShowerUtils by doxygen1.3-rc1