From f4b191f0ea396b58465bfba40749977780a3af58 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 11 Feb 2009 05:29:41 +0000 Subject: Just removing some things that are cluttering up the source tree. --- src/old/unit/hashtable/hashtable.cpp | 107 ----------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 src/old/unit/hashtable/hashtable.cpp (limited to 'src/old/unit/hashtable') diff --git a/src/old/unit/hashtable/hashtable.cpp b/src/old/unit/hashtable/hashtable.cpp deleted file mode 100644 index b2e1cf5..0000000 --- a/src/old/unit/hashtable/hashtable.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "hashfunctionstring.h" -#include "hashfunctioncasestring.h" -#include "hashfunctionint.h" - -class HashFunctionSuite : public Test::Suite -{ -public: - HashFunctionSuite() - { - TEST_ADD( HashFunctionSuite::functionString ) - TEST_ADD( HashFunctionSuite::functionCaseString ) - TEST_ADD( HashFunctionSuite::functionInt ) - } - -private: - void functionStringWorker( HashFunction &hf, std::set &sCodes, char *str, int nLevel, int nMax ) - { - for( char let = 'A'; let <= 'z'; let += 3 ) - { - str[nLevel+1] = '\0'; - str[nLevel] = let; - unsigned long x = hf.hash( str ); - TEST_ASSERT( sCodes.find( x ) == sCodes.end() ); - TEST_ASSERT( hf.cmpIDs( str, str ) ); - sCodes.insert( x ); - - if( nLevel < nMax ) - functionStringWorker( hf, sCodes, str, nLevel+1, nMax ); - } - } - - void functionString() - { - HashFunctionString hf; - char str[10]; - - std::set sCodes; - - functionStringWorker( hf, sCodes, str, 0, 3 ); - } - - void functionCaseStringWorker( HashFunction &hf, std::map &sCodes, char *str, int nLevel, int nMax ) - { - for( char let = 'A'; let <= 'z'; let += 3 ) - { - str[nLevel+1] = '\0'; - str[nLevel] = let; - unsigned long x = hf.hash( str ); - std::map::iterator i = sCodes.find( x ); - if( i == sCodes.end() ) - { - sCodes[x] = strdup( str ); - } - else - { - TEST_ASSERT( strcasecmp( (*i).second, str ) == 0 ); - TEST_ASSERT( hf.cmpIDs( (*i).second, str ) == true ); - } - - if( nLevel < nMax ) - functionCaseStringWorker( hf, sCodes, str, nLevel+1, nMax ); - } - } - - void functionCaseString() - { - HashFunctionCaseString hf; - char str[10]; - - std::map sCodes; - - functionCaseStringWorker( hf, sCodes, str, 0, 3 ); - - std::map::iterator i; - for( i = sCodes.begin(); i != sCodes.end(); i++ ) - { - free( (*i).second ); - } - } - - void functionInt() - { - HashFunctionInt hf; - - for( long i = -100000; i <= 100000; i += 100 ) - { - TEST_ASSERT( ((long)hf.hash( (void *)i )) == i ); - TEST_ASSERT( ((long)hf.cmpIDs( (void *)i, (void *)i )) ); - } - } -}; - -int main( int argc, char *argv[] ) -{ - Test::TextOutput output( Test::TextOutput::Verbose ); - HashFunctionSuite ts; - return ts.run( output ) ? EXIT_SUCCESS : EXIT_FAILURE; -} - -- cgit v1.2.3