#include "wx/cppunit.h"
#include <stdexcept>
-#ifdef __DMC__
- #include <locale.h>
-#endif
-
using namespace std;
using namespace CppUnit;
///////////////////////////////////////////////////////////////////////////////
// Test suite
-//
-// In a non-unicode build the regex is affected by the current locale, so
-// this derived TestSuite is used. It sets the locale in it's run() method
-// for the duration of the regex tests.
class RegExTestSuite : public TestSuite
{
public:
- RegExTestSuite(string name);
- void run(TestResult *result);
+ RegExTestSuite(string name) : TestSuite(name) { }
void add(const char *mode, const char *id, const char *flags,
const char *pattern, const char *data, const char *expected, ...);
};
-// constructor, sets the locale so that it is set when the tests are added
-//
-RegExTestSuite::RegExTestSuite(string name) : TestSuite(name)
-{
- setlocale(LC_ALL, "");
-}
-
-// run the test suite, sets the locale again since it may have been changed
-// by another test since this suite was crated
-//
-void RegExTestSuite::run(TestResult *result)
-{
- setlocale(LC_ALL, "");
- TestSuite::run(result);
-}
-
// Add a testcase to the suite
//
void RegExTestSuite::add(
/*
* Test data for wxRegEx (UTF-8 encoded)
*
- * Generated Tue Apr 20 20:35:05 2004 by regex.pl from the following files:
+ * Generated Sun Apr 25 15:30:23 2004 by regex.pl from the following files:
*
* reg.test: Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
* wxreg.test: Copyright (c) 2004 Mike Wetherell.
{
RegExTestSuite *suite = new regextest_wx_2;
- suite->add("m", "1", "&", "[^[:alpha:]]", "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ!", "!", NULL);
- suite->add("m", "2", "&", "[[:alpha:]]", " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷X", "X", NULL);
- suite->add("m", "3", "&", "[^[:lower:]]", "ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ!", "!", NULL);
- suite->add("m", "4", "&", "[[:lower:]]", " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞ÷x", "x", NULL);
- suite->add("m", "5", "&", "[^[:upper:]]", "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ!", "!", NULL);
- suite->add("m", "6", "&", "[[:upper:]]", " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×ßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿX", "X", NULL);
+ suite->add("m", "1", "&*", "[^[:alpha:]]", "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ!", "!", NULL);
+ suite->add("m", "2", "&*", "[[:alpha:]]", " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷X", "X", NULL);
+ suite->add("m", "3", "&*", "[^[:lower:]]", "ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ!", "!", NULL);
+ suite->add("m", "4", "&*", "[[:lower:]]", " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞ÷x", "x", NULL);
+ suite->add("m", "5", "&*", "[^[:upper:]]", "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ!", "!", NULL);
+ suite->add("m", "6", "&*", "[[:upper:]]", " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×ßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿX", "X", NULL);
suite->add("i", "7", "&i*", "ÀáÂãÄåÆçÈéÊëÌíÎïÐñÒóÔõÖøÙúÛüÝþ", "àÁâÃäÅæÇèÉêËìÍîÏðÑòÓôÕöØùÚûÜýÞ", "0 29", NULL);
return suite;
{
RegExTestSuite *suite = new regextest_wx_3;
- suite->add("m", "1", "&", "[^[:alpha:]]", "ёЁюабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ!", "!", NULL);
- suite->add("m", "2", "&", "[^[:lower:]]", "ёюабцдефгхийклмнопярстужвьызшэщчъ!", "!", NULL);
- suite->add("m", "3", "&", "[[:lower:]]", "ЁЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪx", "x", NULL);
- suite->add("m", "4", "&", "[^[:upper:]]", "ЁЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ!", "!", NULL);
- suite->add("m", "5", "&", "[[:upper:]]", "ёюабцдефгхийклмнопярстужвьызшэщчъX", "X", NULL);
+ suite->add("m", "1", "&*", "[^[:alpha:]]", "ёЁюабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ!", "!", NULL);
+ suite->add("m", "2", "&*", "[^[:lower:]]", "ёюабцдефгхийклмнопярстужвьызшэщчъ!", "!", NULL);
+ suite->add("m", "3", "&*", "[[:lower:]]", "ЁЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪx", "x", NULL);
+ suite->add("m", "4", "&*", "[^[:upper:]]", "ЁЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ!", "!", NULL);
+ suite->add("m", "5", "&*", "[[:upper:]]", "ёюабцдефгхийклмнопярстужвьызшэщчъX", "X", NULL);
suite->add("i", "6", "&i*", "ЁюАбЦдЕфГхИйКлМнОпЯрСтУжВьЫзШэЩчЪ", "ёЮаБцДеФгХиЙкЛмНоПяРсТуЖвЬыЗшЭщЧъ", "0 32", NULL);
return suite;
#
# The layout of this file is the same as reg.test. See the comments in that
# file for full details. The encoding used in here is UTF-8.
-#
-# These tests test the character classifications over the ascii range pretty
+
+# wx_1 tests the character classifications over the ascii range pretty
# thoroughly, since hopefully these will be similar for all platforms and
# locales where wxWidgets runs.
-#
-# Also does some tests involving western european and cyrillic characters.
+
+# wx_2 & wx_3 do some tests involving western european and cyrillic characters.
# In Unicode mode, all these tests should succeed, which verifies that the
# classifications aren't limited to a single 8-bit character set.
-#
-# In non-unicode mode, if the test can't be translated into the character
-# encoding of the current locale, the test will be skipped. So either may
-# succeed or be skipped.
+
+# In non-unicode mode wx_2 and wx_3 are skipped since they depend on the
+# behaviour of the runtime library's 'is' functions (isalpha, isdigit, etc.),
+# which are not consistent enough between implementations to allow testing.
#
doing wx_1 "character classification: ascii"
i 23 &i "AbCdEfGhIjKlMnOpQrStUvWxYz" "aBcDeFgHiJkLmNoPqRsTuVwXyZ" "0 25"
doing wx_2 "character classification: western european"
-m 1 & {[^[:alpha:]]} "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ!" "!"
-m 2 & {[[:alpha:]]} " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷X" "X"
-m 3 & {[^[:lower:]]} "ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ!" "!"
-m 4 & {[[:lower:]]} " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞ÷x" "x"
-m 5 & {[^[:upper:]]} "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ!" "!"
-m 6 & {[[:upper:]]} " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×ßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿX" "X"
+m 1 &* {[^[:alpha:]]} "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ!" "!"
+m 2 &* {[[:alpha:]]} " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×÷X" "X"
+m 3 &* {[^[:lower:]]} "ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ!" "!"
+m 4 &* {[[:lower:]]} " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞ÷x" "x"
+m 5 &* {[^[:upper:]]} "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ!" "!"
+m 6 &* {[[:upper:]]} " ¡¢£¤¥¦§¨©«¬®¯°±²³´¶·¸¹»¼½¾¿×ßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿX" "X"
i 7 &i* "ÀáÂãÄåÆçÈéÊëÌíÎïÐñÒóÔõÖøÙúÛüÝþ" "àÁâÃäÅæÇèÉêËìÍîÏðÑòÓôÕöØùÚûÜýÞ" "0 29"
doing wx_3 "character classification: cyrillic"
-m 1 & {[^[:alpha:]]} "ёЁюабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ!" "!"
-m 2 & {[^[:lower:]]} "ёюабцдефгхийклмнопярстужвьызшэщчъ!" "!"
-m 3 & {[[:lower:]]} "ЁЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪx" "x"
-m 4 & {[^[:upper:]]} "ЁЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ!" "!"
-m 5 & {[[:upper:]]} "ёюабцдефгхийклмнопярстужвьызшэщчъX" "X"
+m 1 &* {[^[:alpha:]]} "ёЁюабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ!" "!"
+m 2 &* {[^[:lower:]]} "ёюабцдефгхийклмнопярстужвьызшэщчъ!" "!"
+m 3 &* {[[:lower:]]} "ЁЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪx" "x"
+m 4 &* {[^[:upper:]]} "ЁЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ!" "!"
+m 5 &* {[[:upper:]]} "ёюабцдефгхийклмнопярстужвьызшэщчъX" "X"
i 6 &i* "ЁюАбЦдЕфГхИйКлМнОпЯрСтУжВьЫзШэЩчЪ" "ёЮаБцДеФгХиЙкЛмНоПяРсТуЖвЬыЗшЭщЧъ" "0 32"
#doing bugs "known bugs"