Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

Test.h

Go to the documentation of this file.
00001 #ifndef Impala_Util_Test_h
00002 #define Impala_Util_Test_h
00003 
00004 #include "Util/ApplyOrder.h"
00005 
00006 namespace Impala
00007 {
00008 namespace Util
00009 {
00010 
00011 
00012 void TestApplyOrder()
00013 {
00014     double data1[5] = {2.1, 1.1, 3.1, 0.1};
00015     int    order[5] = {2,   1,   3,   0};
00016     std::string data2[5] = {"two", "one", "three", "zero"};
00017 
00018     ApplyOrder(data1, order, 4);
00019     ApplyOrder(data2, order, 4);
00020     for(int i=0 ; i<4 ; ++i)
00021         std::cout << data1[i] << "\t" << data2[i] << std::endl;
00022 }
00023 
00024 void TestSort()
00025 {
00026     // quicksort only 'kicks in' if testLength > Util::cQuicksortTreshold
00027     int testLength = 20;
00028     namespace blabla = Domain::Classifier;
00029     using namespace blabla;
00030     RankingTableType* rank = MakeRankingTable(testLength);
00031     int i;
00032     for(i=0 ; i<testLength ; ++i)
00033         rank->Add(std::string(3, 'd'-i), i, (double)testLength/(i+1.), (i+1.)/(double)testLength);
00034     for(i=0 ; i<4 ; ++i)
00035     {
00036         Sort(rank,i+1);
00037         rank->Dump();
00038     }
00039 }
00040 
00041 
00042 } // namespace Util
00043 } // namespace Impala
00044 
00045 #endif

Generated on Fri Mar 19 09:31:48 2010 for ImpalaSrc by  doxygen 1.5.1