From 937d960d2677c87ac6d68dc5445be115ac001d3e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 29 Jun 2006 05:50:44 +0000 Subject: Completely switched over to the much simpler, nicer pymake. Things look great, and the old Makefile may soon fall into disrepair. To use the old one, which should almost always be able to build at least thi library, call: make -f Makefile.legacy The new Makefile just calls pymake --- src/unit/hashtable.cpp | 107 --------------------------------------- src/unit/hashtable/hashtable.cpp | 107 +++++++++++++++++++++++++++++++++++++++ src/unit/xml.cpp | 59 --------------------- src/unit/xml/xml.cpp | 59 +++++++++++++++++++++ 4 files changed, 166 insertions(+), 166 deletions(-) delete mode 100644 src/unit/hashtable.cpp create mode 100644 src/unit/hashtable/hashtable.cpp delete mode 100644 src/unit/xml.cpp create mode 100644 src/unit/xml/xml.cpp (limited to 'src/unit') diff --git a/src/unit/hashtable.cpp b/src/unit/hashtable.cpp deleted file mode 100644 index b2e1cf5..0000000 --- a/src/unit/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; -} - diff --git a/src/unit/hashtable/hashtable.cpp b/src/unit/hashtable/hashtable.cpp new file mode 100644 index 0000000..b2e1cf5 --- /dev/null +++ b/src/unit/hashtable/hashtable.cpp @@ -0,0 +1,107 @@ +#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; +} + diff --git a/src/unit/xml.cpp b/src/unit/xml.cpp deleted file mode 100644 index e4d779c..0000000 --- a/src/unit/xml.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include -#include -#include - -#include "xmlstringreader.h" -#include "xmlexception.h" - -class XmlCoreTestSuite : public Test::Suite -{ -public: - XmlCoreTestSuite() - { - TEST_ADD( XmlCoreTestSuite::badXml01 ) - TEST_ADD( XmlCoreTestSuite::badXml02 ) - TEST_ADD( XmlCoreTestSuite::badXml03 ) - - TEST_ADD( XmlCoreTestSuite::entityBuiltin01 ) - - TEST_ADD( XmlCoreTestSuite::entityDoc01 ) - } - -private: - void badXml01() - { - TEST_THROWS( XmlStringReader r(""), XmlException & ); - } - - void badXml02() - { - TEST_THROWS( XmlStringReader r(""), XmlException & ); - } - - void badXml03() - { - TEST_THROWS( XmlStringReader r("><&'""); - TEST_ASSERT( strcmp( r.getRoot()->getContent(), "><&\'\"" ) == 0 ); - } - - void entityDoc01() - { - XmlStringReader r(""&name;""); - TEST_ASSERT( strcmp( r.getRoot()->getContent(), "\"bob the man\"" ) == 0 ); - } -}; - -int main( int argc, char *argv[] ) -{ - Test::TextOutput output( Test::TextOutput::Verbose ); - XmlCoreTestSuite ts; - return ts.run( output ) ? EXIT_SUCCESS : EXIT_FAILURE; -} - diff --git a/src/unit/xml/xml.cpp b/src/unit/xml/xml.cpp new file mode 100644 index 0000000..e4d779c --- /dev/null +++ b/src/unit/xml/xml.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include + +#include "xmlstringreader.h" +#include "xmlexception.h" + +class XmlCoreTestSuite : public Test::Suite +{ +public: + XmlCoreTestSuite() + { + TEST_ADD( XmlCoreTestSuite::badXml01 ) + TEST_ADD( XmlCoreTestSuite::badXml02 ) + TEST_ADD( XmlCoreTestSuite::badXml03 ) + + TEST_ADD( XmlCoreTestSuite::entityBuiltin01 ) + + TEST_ADD( XmlCoreTestSuite::entityDoc01 ) + } + +private: + void badXml01() + { + TEST_THROWS( XmlStringReader r(""), XmlException & ); + } + + void badXml02() + { + TEST_THROWS( XmlStringReader r(""), XmlException & ); + } + + void badXml03() + { + TEST_THROWS( XmlStringReader r("><&'""); + TEST_ASSERT( strcmp( r.getRoot()->getContent(), "><&\'\"" ) == 0 ); + } + + void entityDoc01() + { + XmlStringReader r(""&name;""); + TEST_ASSERT( strcmp( r.getRoot()->getContent(), "\"bob the man\"" ) == 0 ); + } +}; + +int main( int argc, char *argv[] ) +{ + Test::TextOutput output( Test::TextOutput::Verbose ); + XmlCoreTestSuite ts; + return ts.run( output ) ? EXIT_SUCCESS : EXIT_FAILURE; +} + -- cgit v1.2.3