← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-896426 into lp:zorba

 

Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/bug-896426 into lp:zorba.

Requested reviews:
  Paul J. Lucas (paul-lucas)
Related bugs:
  Bug #896426 in Zorba: "Unit test migration"
  https://bugs.launchpad.net/zorba/+bug/896426

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-896426/+merge/83885
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-896426/+merge/83885
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/unit_tests/CMakeLists.txt'
--- src/unit_tests/CMakeLists.txt	2011-06-01 13:16:28 +0000
+++ src/unit_tests/CMakeLists.txt	2011-11-30 01:29:26 +0000
@@ -14,12 +14,24 @@
                                   
 
 SET(UNIT_TEST_SRCS
+  string_instantiate.cpp
+  string.cpp
+  test_uri.cpp
+  unique_ptr.cpp
   unit_tests.cpp
-  test_uri.cpp
 )
 
+IF (NOT ZORBA_NO_FULL_TEXT)
+  LIST (APPEND UNIT_TEST_SRCS
+    stemmer.cpp
+    thesaurus.cpp
+    tokenizer.cpp)
+ENDIF (NOT ZORBA_NO_FULL_TEXT)
+
 IF(ZORBA_WITH_DEBUGGER)
   LIST(APPEND UNIT_TEST_SRCS
 #    test_debugger_protocol.cpp
   )
 ENDIF(ZORBA_WITH_DEBUGGER)
+
+# vim:set et sw=2 tw=2:

=== renamed file 'test/unit/stemmer.cpp' => 'src/unit_tests/stemmer.cpp'
--- test/unit/stemmer.cpp	2011-08-25 15:54:19 +0000
+++ src/unit_tests/stemmer.cpp	2011-11-30 01:29:26 +0000
@@ -74,7 +74,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-int stemmer( int argc, char *argv[] ) {
+namespace zorba {
+namespace UnitTests {
+
+int test_stemmer( int argc, char *argv[] ) {
   void *const zstore = StoreManager::getStore();
   Zorba *const zorba = Zorba::getInstance( zstore );
 
@@ -113,4 +116,8 @@
   StoreManager::shutdownStore( zstore );
   return result;
 }
+
+} // namespace UnitTests
+} // namespace zorba
+
 /* vim:set et sw=2 ts=2: */

=== renamed file 'test/unit/string_test.cpp' => 'src/unit_tests/string.cpp'
--- test/unit/string_test.cpp	2011-08-24 12:48:09 +0000
+++ src/unit_tests/string.cpp	2011-11-30 01:29:26 +0000
@@ -778,7 +778,12 @@
   ASSERT_TRUE( xml::parse_entity( "&#x26", &c ) == -1 );
 }
 
-int string_test( int, char*[] ) {
+///////////////////////////////////////////////////////////////////////////////
+
+namespace zorba {
+namespace UnitTests {
+
+int test_string( int, char*[] ) {
 
   ////////// basic string functionality ///////////////////////////////////////
 
@@ -898,4 +903,8 @@
   cout << failures << " test(s) failed\n";
   return failures ? 1 : 0;
 }
+
+} // namespace UnitTests
+} // namespace zorba
+
 /* vim:set et sw=2 ts=2: */

=== renamed file 'test/unit/string_instantiate.cpp' => 'src/unit_tests/string_instantiate.cpp'
--- test/unit/string_instantiate.cpp	2011-06-14 17:26:33 +0000
+++ src/unit_tests/string_instantiate.cpp	2011-11-30 01:29:26 +0000
@@ -547,7 +547,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-int string_instantiate( int, char*[] ) {
+namespace zorba {
+namespace UnitTests {
+
+int test_string_instantiate( int, char*[] ) {
   return 0;                             // don't actually call anything
 
   instantiate_common<zstring>();
@@ -570,4 +573,8 @@
 
   return 0;
 }
+
+} // namespace UnitTests
+} // namespace zorba
+
 /* vim:set et sw=2 ts=2: */

=== renamed file 'test/unit/thesaurus.cpp' => 'src/unit_tests/thesaurus.cpp'
--- test/unit/thesaurus.cpp	2011-10-24 23:26:11 +0000
+++ src/unit_tests/thesaurus.cpp	2011-11-30 01:29:26 +0000
@@ -118,7 +118,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-int thesaurus( int argc, char *argv[] ) {
+namespace zorba {
+namespace UnitTests {
+
+int test_thesaurus( int argc, char *argv[] ) {
   void *const zstore = StoreManager::getStore();
   Zorba *const zorba = Zorba::getInstance( zstore );
 
@@ -157,4 +160,8 @@
   StoreManager::shutdownStore( zstore );
   return result;
 }
+
+} // namespace UnitTests
+} // namespace zorba
+
 /* vim:set et sw=2 ts=2: */

=== renamed file 'test/unit/tokenizer.cpp' => 'src/unit_tests/tokenizer.cpp'
--- test/unit/tokenizer.cpp	2011-08-31 01:59:30 +0000
+++ src/unit_tests/tokenizer.cpp	2011-11-30 01:29:26 +0000
@@ -341,7 +341,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-int tokenizer( int argc, char *argv[] ) {
+namespace zorba {
+namespace UnitTests {
+
+int test_tokenizer( int argc, char *argv[] ) {
   int result = 0;
 
   void *const zstore = StoreManager::getStore();
@@ -389,4 +392,8 @@
   StoreManager::shutdownStore( zstore );
   return result;
 }
+
+} // namespace UnitTests
+} // namespace zorba
+
 /* vim:set et sw=2 ts=2: */

=== renamed file 'test/unit/unique_ptr.cpp' => 'src/unit_tests/unique_ptr.cpp'
--- test/unit/unique_ptr.cpp	2011-08-27 14:57:52 +0000
+++ src/unit_tests/unique_ptr.cpp	2011-11-30 01:29:26 +0000
@@ -221,7 +221,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-int unique_ptr( int, char*[] ) {
+namespace zorba {
+namespace UnitTests {
+
+int test_unique_ptr( int, char*[] ) {
   compile_test();
   test_array();
   test_basic();
@@ -239,6 +242,9 @@
   return failures ? 1 : 0;
 }
 
+} // namespace UnitTests
+} // namespace zorba
+
 ///////////////////////////////////////////////////////////////////////////////
 
 /* vim:set et sw=2 ts=2: */

=== modified file 'src/unit_tests/unit_test_list.h'
--- src/unit_tests/unit_test_list.h	2011-06-14 17:26:33 +0000
+++ src/unit_tests/unit_test_list.h	2011-11-30 01:29:26 +0000
@@ -17,19 +17,24 @@
 #ifndef ZORBA_UNIT_TEST_LIST_H
 #define ZORBA_UNIT_TEST_LIST_H
 
-#include <iostream>
-
+#include <zorba/config.h>
 
 namespace zorba {
 
   namespace UnitTests {
     int runUriTest(int argc, char* argv[]);
     int runDebuggerProtocolTest(int argc, char* argv[]);
+    int test_string( int, char*[] );
+    int test_unique_ptr( int, char*[] );
+#ifndef ZORBA_NO_FULL_TEXT
+    int test_stemmer( int, char*[] );
+    int test_thesaurus( int, char*[] );
+    int test_tokenizer( int, char*[] );
+#endif /* ZORBA_NO_FULL_TEXT */
     /**
      * ADD NEW UNIT TESTS HERE
      */
 
-
     void initializeTestList();
   };
     

=== modified file 'src/unit_tests/unit_tests.cpp'
--- src/unit_tests/unit_tests.cpp	2011-06-14 17:26:33 +0000
+++ src/unit_tests/unit_tests.cpp	2011-11-30 01:29:26 +0000
@@ -37,10 +37,18 @@
      * ADD NEW UNIT TESTS HERE
      */
     void initializeTestList() {
+      libunittests["string"] = test_string;
       libunittests["uri"] = runUriTest;
+      libunittests["unique_ptr"] = test_unique_ptr;
+#ifndef ZORBA_NO_FULL_TEXT
+      libunittests["stemmer"] = test_stemmer;
+      libunittests["thesaurus"] = test_thesaurus;
+      libunittests["tokenizer"] = test_tokenizer;
+#endif /* ZORBA_NO_FULL_TEXT */
+
 #ifdef ZORBA_WITH_DEBUGGER
 //      libunittests["debugger_protocol"] = runDebuggerProtocolTest;
-#endif
+#endif /* ZORBA_WITH_DEBUGGER */
     }
 
     int runUnitTest(int argc, char* argv[]) {

=== modified file 'src/util/ascii_util.h'
--- src/util/ascii_util.h	2011-06-19 16:17:46 +0000
+++ src/util/ascii_util.h	2011-11-30 01:29:26 +0000
@@ -22,8 +22,6 @@
 #include <cstddef>
 #include <cstring>
 
-#include <zorba/config.h>
-
 #include "stl_util.h"
 
 namespace zorba {
@@ -205,7 +203,7 @@
  * @param s The NULL-terminated C string to check.
  * @return Returns \c true only if the entire string is whitespace.
  */
-ZORBA_DLL_PUBLIC bool is_whitespace( char const *s );
+bool is_whitespace( char const *s );
 
 /**
  * Checks whether an entire string is whitespace.
@@ -684,7 +682,6 @@
  * @return Returns a pointer to the first character in \a s that is not among
  * the characters in \a chars.
  */
-ZORBA_DLL_PUBLIC
 char const* trim_start( char const *s, char const *chars );
 
 /**
@@ -696,7 +693,6 @@
  * @return Returns a pointer to the first character in \a s that is not among
  * the characters in \a chars.
  */
-ZORBA_DLL_PUBLIC
 char const* trim_start( char const *s, size_type s_len, char const *chars );
 
 /**
@@ -782,7 +778,6 @@
  * @param chars The characters to trim.
  * @return Returns the new length of \a s.
  */
-ZORBA_DLL_PUBLIC
 size_type trim_end( char const *s, size_type s_len, char const *chars );
 
 /**

=== modified file 'src/util/regex.h'
--- src/util/regex.h	2011-07-18 14:25:21 +0000
+++ src/util/regex.h	2011-11-30 01:29:26 +0000
@@ -48,7 +48,7 @@
 /**
  * The %regex class wraps the underlying Unicode regular expression library.
  */
-class ZORBA_DLL_PUBLIC regex {
+class regex {
 public:
   /**
    * Constructs a %regex.
@@ -520,7 +520,7 @@
 /**
  * The %regex class wraps the underlying Unicode regular expression library.
  */
-class ZORBA_DLL_PUBLIC regex {
+class regex {
 public:
   /**
    * Constructs a %regex.

=== modified file 'src/util/regex_ascii.h'
--- src/util/regex_ascii.h	2011-07-18 14:25:21 +0000
+++ src/util/regex_ascii.h	2011-11-30 01:29:26 +0000
@@ -20,8 +20,6 @@
 #include <list>
 #include <vector>
 
-#include <zorba/config.h>
-
 namespace zorba {
   namespace regex_ascii{
 

=== modified file 'src/util/string_util.h'
--- src/util/string_util.h	2011-10-11 17:59:20 +0000
+++ src/util/string_util.h	2011-11-30 01:29:26 +0000
@@ -555,7 +555,6 @@
  * sufficient size.
  * @return Returns \a buf for convenience.
  */
-ZORBA_DLL_PUBLIC
 char* itoa( long long n, char *buf );
 
 /**
@@ -626,7 +625,6 @@
  * sufficient size.
  * @return Returns \a buf for convenience.
  */
-ZORBA_DLL_PUBLIC
 char* itoa( unsigned long long n, char *buf );
 
 /**

=== modified file 'src/util/unicode_util.h'
--- src/util/unicode_util.h	2011-11-20 19:02:06 +0000
+++ src/util/unicode_util.h	2011-11-30 01:29:26 +0000
@@ -78,7 +78,6 @@
  * @return Returns \c true only if the character is invalid in an IRI.
  * See RFC 3987.
  */
-ZORBA_DLL_PUBLIC
 bool is_invalid_in_iri( code_point c );
 
 /**
@@ -88,7 +87,6 @@
  * @return Returns \c true only if the character is a "iprivate".
  * See RFC 3987.
  */
-ZORBA_DLL_PUBLIC
 bool is_iprivate( code_point c );
 
 /**
@@ -114,7 +112,6 @@
  * @return Returns \c true only if the character is a "ucschar".
  * See RFC 3987.
  */
-ZORBA_DLL_PUBLIC
 bool is_ucschar( code_point c );
 
 /**
@@ -138,7 +135,6 @@
  * @param c The character.
  * @return Returns \c true only if the character is lower-case.
  */
-ZORBA_DLL_PUBLIC
 bool is_lower( code_point c );
 
 /**
@@ -147,7 +143,6 @@
  * @param c The character.
  * @return Returns \c true only if the character is upper-case.
  */
-ZORBA_DLL_PUBLIC
 bool is_upper( code_point c );
 
 /**
@@ -157,7 +152,6 @@
  * @return Returns the given character converted to lower-case or the original
  * character if either it was already lower-case or not a letter.
  */
-ZORBA_DLL_PUBLIC
 code_point to_lower( code_point c );
 
 /**
@@ -167,7 +161,6 @@
  * @return Returns the given character converted to upper-case or the original
  * character if either it was already upper-case or not a letter.
  */
-ZORBA_DLL_PUBLIC
 code_point to_upper( code_point c );
 
 ////////// normalization //////////////////////////////////////////////////////
@@ -179,7 +172,6 @@
  * @param out The normalized string.  It is overwritten.
  * @return Returns \c true only if the normalization succeeded.
  */
-ZORBA_DLL_PUBLIC
 bool normalize( string const &in, normalization::type n, string *out );
 
 ////////// string conversion //////////////////////////////////////////////////
@@ -214,7 +206,6 @@
  * @param out The Unicode string result.
  * @return Returns \c true only if the conversion succeeded.
  */
-ZORBA_DLL_PUBLIC
 bool to_string( char const *in, size_type in_len, string *out );
 
 /**

=== modified file 'src/util/uri_util.h'
--- src/util/uri_util.h	2011-07-17 20:05:49 +0000
+++ src/util/uri_util.h	2011-11-30 01:29:26 +0000
@@ -80,8 +80,8 @@
 
 ////////// Encoding ///////////////////////////////////////////////////////////
 
-ZORBA_DLL_PUBLIC extern char const uri_safe[];
-ZORBA_DLL_PUBLIC extern signed char const hex2dec[];
+extern char const uri_safe[];
+extern signed char const hex2dec[];
 
 /**
  * A %back_insert_iterator can be used to append characters to a string

=== modified file 'src/util/utf8_util.h'
--- src/util/utf8_util.h	2011-07-17 20:05:49 +0000
+++ src/util/utf8_util.h	2011-11-30 01:29:26 +0000
@@ -21,8 +21,6 @@
 #include <cwchar>
 #include <string>
 
-#include <zorba/config.h>
-
 #include "ascii_util.h"
 #include "cxx_util.h"
 #include "unicode_util.h"
@@ -319,7 +317,6 @@
  * the UTF-8 string are put here.
  * @return Returns \c true only if the conversion succeeded.
  */
-ZORBA_DLL_PUBLIC
 bool to_string( unicode::char_type const *in, unicode::size_type in_len,
                 storage_type **out, size_type *out_len = nullptr );
 
@@ -406,7 +403,6 @@
  * the UTF-8 string are put here.
  * @return Returns \c true only if the conversion succeeded.
  */
-ZORBA_DLL_PUBLIC
 bool to_string( wchar_t const *in, size_type in_len, storage_type **out,
                 size_type *out_len = nullptr );
 
@@ -476,7 +472,6 @@
  * the wchar_t string are put here.
  * @return Returns \c true only if the conversion succeeded.
  */
-ZORBA_DLL_PUBLIC
 bool to_wchar_t( storage_type const *in, size_type in_len, wchar_t **out,
                  unicode::size_type *out_len );
 

=== modified file 'src/util/utf8_util_base.h'
--- src/util/utf8_util_base.h	2011-07-17 20:05:49 +0000
+++ src/util/utf8_util_base.h	2011-11-30 01:29:26 +0000
@@ -21,8 +21,6 @@
 #include <iterator>
 #include <stdexcept>
 
-#include <zorba/config.h>
-
 #include "unicode_util.h"
 
 namespace zorba {
@@ -62,7 +60,6 @@
  * @param char_pos The character position.
  * @return Returns the corresponding byte position.
  */
-ZORBA_DLL_PUBLIC
 size_type byte_pos( storage_type const *s, size_type char_pos );
 
 /**
@@ -74,7 +71,6 @@
  * @return Returns the corresponding byte position or \c npos if the result >=
  * \a s_size.
  */
-ZORBA_DLL_PUBLIC
 size_type byte_pos( storage_type const *s, size_type s_size,
                     size_type char_pos );
 
@@ -85,7 +81,6 @@
  * @param p A pointer to somewhere within \a s.
  * @return Returns said offset.
  */
-ZORBA_DLL_PUBLIC
 size_type char_pos( storage_type const *s, storage_type const *p );
 
 /**
@@ -110,7 +105,6 @@
  * character.
  * @return Returns the number of bytes required to encode the character.
  */
-ZORBA_DLL_PUBLIC
 size_type encode( unicode::code_point c, storage_type **ps );
 
 /**
@@ -148,7 +142,6 @@
  * @return Returns the Unicode code-point of the next character.
  */
 template<class OctetIterator>
-ZORBA_DLL_PUBLIC
 unicode::code_point next_char( OctetIterator &i );
 
 /**
@@ -207,7 +200,6 @@
  * @return Returns a number in the range [1,6] if \a start is valid or 0 if
  * \a start is invalid.
  */
-ZORBA_DLL_PUBLIC
 size_type char_length( storage_type start );
 
 /**
@@ -217,7 +209,6 @@
  * @param s A pointer to the first byte of a NULL-terminated UTF-8 string.
  * @return Returns said number of characters.
  */
-ZORBA_DLL_PUBLIC
 size_type length( storage_type const *s );
 
 /**
@@ -229,7 +220,6 @@
  * sequence.
  * @return Returns said number of characters.
  */
-ZORBA_DLL_PUBLIC
 size_type length( storage_type const *begin, storage_type const *end );
 
 /**
@@ -294,7 +284,6 @@
  * @return Returns \c nullptr if the string is valid or a pointer to the first
  * invalid byte if invalid.
  */
-ZORBA_DLL_PUBLIC
 storage_type const* validate( storage_type const *s );
 
 /**
@@ -305,7 +294,6 @@
  * @return Returns \c nullptr if the string is valid or a pointer to the first
  * invalid byte if invalid.
  */
-ZORBA_DLL_PUBLIC
 storage_type const* validate( storage_type const *s, size_type s_size );
 
 ////////// iterator ///////////////////////////////////////////////////////////

=== modified file 'src/util/xml_util.h'
--- src/util/xml_util.h	2011-06-16 15:12:30 +0000
+++ src/util/xml_util.h	2011-11-30 01:29:26 +0000
@@ -191,7 +191,6 @@
  * @return If successful, returns the number of characters parsed; otherwise
  * returns -1.
  */
-ZORBA_DLL_PUBLIC
 int parse_entity( char const *ref, unicode::code_point *c );
 
 /**

=== modified file 'test/unit/CMakeLists.txt'
--- test/unit/CMakeLists.txt	2011-10-26 22:02:25 +0000
+++ test/unit/CMakeLists.txt	2011-11-30 01:29:26 +0000
@@ -73,10 +73,7 @@
   ext_in_opt.cpp
   collection.cpp
   test_audit.cpp
-  string_instantiate.cpp
   streamable_string.cpp
-  string_test.cpp
-  unique_ptr.cpp
   main_sequential.cpp
   datetime.cpp
   invoke.cpp
@@ -85,13 +82,6 @@
   staticcollectionmanager.cpp
 )
 
-IF (NOT ZORBA_NO_FULL_TEXT)
-  LIST(APPEND UNIT_TESTS_SRCS
-    stemmer.cpp
-    thesaurus.cpp
-    tokenizer.cpp)
-ENDIF (NOT ZORBA_NO_FULL_TEXT)
-
 # multithread_simple.cpp
 # multithread_stress_test.cpp
 
@@ -129,5 +119,14 @@
 ZORBA_GENERATE_EXE(LibUnitTest lib_unit_test.cpp "" "" "")
 
 # ADD NEW UNIT TESTS HERE
+ZORBA_ADD_TEST("test/libunit/string" LibUnitTest string)
 ZORBA_ADD_TEST("test/libunit/uri" LibUnitTest uri)
 EXPECTED_FAILURE(test/libunit/uri 3118348)
+ZORBA_ADD_TEST("test/libunit/unique_ptr" LibUnitTest unique_ptr)
+IF (NOT ZORBA_NO_FULL_TEXT)
+  ZORBA_ADD_TEST("test/libunit/stemmer" LibUnitTest stemmer)
+  ZORBA_ADD_TEST("test/libunit/thesaurus" LibUnitTest thesaurus)
+  ZORBA_ADD_TEST("test/libunit/tokenizer" LibUnitTest tokenizer)
+ENDIF (NOT ZORBA_NO_FULL_TEXT)
+
+# vim:set et sw=2 ts=2:


Follow ups