1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-09-28 19:05:55 +08:00

add UHTTP::getUserAuthentication()

This commit is contained in:
stefanocasazza 2017-09-17 17:26:15 +02:00
parent b7610d4088
commit 4522e58477
3 changed files with 258 additions and 244 deletions

View File

@ -541,6 +541,9 @@ public:
static UString* htpasswd;
static UString* htdigest;
static bool digest_authentication; // authentication method (digest|basic)
static UString* user_authentication;
static UString getUserAuthentication() { return *user_authentication; }
#ifdef USE_LIBSSL
static UString* uri_protected_mask;

View File

@ -98,6 +98,7 @@ UString* UHTTP::cache_avoid_mask;
UString* UHTTP::cache_file_store;
UString* UHTTP::cgi_cookie_option;
UString* UHTTP::set_cookie_option;
UString* UHTTP::user_authentication;
UString* UHTTP::string_HTTP_Variables;
uint32_t UHTTP::range_size;
uint32_t UHTTP::range_start;
@ -841,6 +842,7 @@ void UHTTP::init()
U_INTERNAL_ASSERT_EQUALS(set_cookie, U_NULLPTR)
U_INTERNAL_ASSERT_EQUALS(form_name_value, U_NULLPTR)
U_INTERNAL_ASSERT_EQUALS(set_cookie_option, U_NULLPTR)
U_INTERNAL_ASSERT_EQUALS(user_authentication, U_NULLPTR)
U_INTERNAL_ASSERT_EQUALS(string_HTTP_Variables, U_NULLPTR)
U_NEW(UFile, file, UFile);
@ -858,6 +860,7 @@ void UHTTP::init()
U_NEW(UString, upload_dir, UString);
U_NEW(UString, set_cookie, UString);
U_NEW(UString, set_cookie_option, UString(200U));
U_NEW(UString, user_authentication, UString(100U));
U_NEW(UString, string_HTTP_Variables, UString(U_CAPACITY));
if (cgi_cookie_option == U_NULLPTR) U_NEW(UString, cgi_cookie_option, U_STRING_FROM_CONSTANT("[\"\" 0]"));
@ -1420,6 +1423,7 @@ void UHTTP::dtor()
delete cache_avoid_mask;
delete cgi_cookie_option;
delete set_cookie_option;
delete user_authentication;
if (htpasswd) delete htpasswd;
if (htdigest) delete htdigest;
@ -4067,9 +4071,7 @@ int UHTTP::handlerREAD()
if (isGETorHEAD() == false)
{
U_http_flag |= HTTP_IS_NOCACHE_FILE | HTTP_IS_REQUEST_NOSTAT;
U_INTERNAL_DUMP("U_http_is_nocache_file = %b U_http_is_request_nostat = %b U_http_version = %C", U_http_is_nocache_file, U_http_is_request_nostat, U_http_version)
U_http_flag |= HTTP_IS_NOCACHE_FILE;
# ifndef U_SERVER_CAPTIVE_PORTAL
if (U_http_info.clength ||
@ -4265,8 +4267,6 @@ set_uri: U_http_info.uri = alias->data();
# ifdef DEBUG
if (UClientImage_Base::request_uri->findWhiteSpace(0) != U_NOT_FOUND) U_ERROR("request URI has space: %V", UClientImage_Base::request_uri->rep);
U_INTERNAL_DUMP("U_http_is_request_nostat = %b", U_http_is_request_nostat)
# endif
}
}
@ -4293,15 +4293,23 @@ set_uri: U_http_info.uri = alias->data();
pathname->setBuffer(u_cwd_len + U_http_info.uri_len);
U_INTERNAL_DUMP("U_http_is_request_nostat = %b", U_http_is_request_nostat)
if ((old_path_len = U_http_info.uri_len-1) == 0)
{
file_data = U_NULLPTR;
}
else if (checkFileInCache(U_http_info.uri+1, old_path_len))
else
# ifdef U_ALIAS
if (U_http_is_request_nostat == false)
# endif
{
UClientImage_Base::setRequestInFileCache();
if (checkFileInCache(U_http_info.uri+1, old_path_len))
{
UClientImage_Base::setRequestInFileCache();
goto file_in_cache;
goto file_in_cache;
}
}
setPathName();
@ -7060,13 +7068,15 @@ U_NO_EXPORT bool UHTTP::processAuthorization(const char* request, uint32_t sz, c
{
U_TRACE(0, "UHTTP::processAuthorization(%.*S,%u,%.*S,%u)", sz, request, sz, len, pattern, len)
user_authentication->setBuffer(100U);
if (sz == 0) request = UClientImage_Base::getRequestUri(sz);
UTokenizer t;
const char* ptr;
uint32_t pos = 0;
bool result = false, bpass = false;
UString buffer(100U), fpasswd, content, tmp, user(100U);
UString buffer(100U), fpasswd, content, tmp;
if (pattern)
{
@ -7168,9 +7178,9 @@ U_NO_EXPORT bool UHTTP::processAuthorization(const char* request, uint32_t sz, c
{
if (name.equal(U_CONSTANT_TO_PARAM("username")))
{
U_ASSERT(user.empty())
U_ASSERT(user_authentication->empty())
user = value;
*user_authentication = value;
}
else if (name.equal(U_CONSTANT_TO_PARAM("uri")))
{
@ -7280,7 +7290,7 @@ U_NO_EXPORT bool UHTTP::processAuthorization(const char* request, uint32_t sz, c
// MD5(user : realm : password)
buffer.snprintf(U_CONSTANT_TO_PARAM("%v:%v:"), user.rep, realm.rep);
buffer.snprintf(U_CONSTANT_TO_PARAM("%v:%v:"), user_authentication->rep, realm.rep);
// s.casazza:Protected Area:b9ee2af50be37...........\n
@ -7327,14 +7337,14 @@ U_NO_EXPORT bool UHTTP::processAuthorization(const char* request, uint32_t sz, c
UString password(100U);
if (t.next(user, (bool*)U_NULLPTR) &&
t.next(password, (bool*)U_NULLPTR))
if (t.next(*user_authentication, (bool*)U_NULLPTR) &&
t.next(password, (bool*)U_NULLPTR))
{
UString line(100U), output(100U);
UServices::generateDigest(U_HASH_SHA1, 0, password, output, true);
line.snprintf(U_CONSTANT_TO_PARAM("%v:{SHA}%v\n"), user.rep, output.rep);
line.snprintf(U_CONSTANT_TO_PARAM("%v:{SHA}%v\n"), user_authentication->rep, output.rep);
// s.casazza:{SHA}Lkii1ZE7k.....\n
@ -7343,7 +7353,7 @@ U_NO_EXPORT bool UHTTP::processAuthorization(const char* request, uint32_t sz, c
}
}
end: U_SRV_LOG("%srequest authorization for user %V %s", result ? "" : "WARNING: ", user.rep, result ? "success" : "failed");
end: U_SRV_LOG("%srequest authorization for user %V %s", result ? "" : "WARNING: ", user_authentication->rep, result ? "success" : "failed");
}
if (result == false)
@ -8708,6 +8718,7 @@ U_NO_EXPORT void UHTTP::checkPathName()
U_INTERNAL_DUMP("pathname(%u) = %V", pathname->size(), pathname->rep)
U_INTERNAL_ASSERT(pathname->isNullTerminated())
U_ASSERT(UClientImage_Base::isRequestNotFound())
const char* ptr = pathname->data();
uint32_t len = pathname->size(), len1 = u_canonicalize_pathname((char*)ptr, len);
@ -8734,12 +8745,7 @@ U_NO_EXPORT void UHTTP::checkPathName()
{
U_INTERNAL_ASSERT_EQUALS(file_data, U_NULLPTR)
if (U_http_is_request_nostat)
{
U_ClientImage_request = 0; // we set to UClientImage_Base::NOT_FOUND...
return;
}
if (U_http_is_request_nostat) return;
# ifdef U_ALIAS
if (virtual_host == false)
@ -8789,8 +8795,6 @@ U_NO_EXPORT void UHTTP::checkPathName()
{
U_http_flag |= HTTP_IS_NOCACHE_FILE | HTTP_IS_REQUEST_NOSTAT;
U_ClientImage_request = 0; // we set to UClientImage_Base::NOT_FOUND...
return;
}
}

View File

@ -22,253 +22,260 @@
#define FNM_LEADING_DIR FNM_PERIOD
#endif
static int compare_str(const void* str1, const void* str2) { return u_strnatcmp(*(const char**)str1, *(const char**)str2); }
static void check_match_true(bPFpcupcud pfn_match, const char* restrict s, uint32_t n1, const char* restrict pattern, uint32_t n2, int flags)
{
U_INTERNAL_TRACE("check_match_true(%p,%.*s,%u,%.*s,%u,%d)", pfn_match, U_min(n1,128), s, n1, n2, pattern, n2, flags)
U_INTERNAL_ASSERT( pfn_match(s, n1, pattern, n2, flags))
U_INTERNAL_ASSERT_EQUALS(pfn_match(s, n1, pattern, n2, flags | FNM_INVERT), false)
}
static void check_match_false(bPFpcupcud pfn_match, const char* restrict s, uint32_t n1, const char* restrict pattern, uint32_t n2, int flags)
{
U_INTERNAL_TRACE("check_match_false(%p,%.*s,%u,%.*s,%u,%d)", pfn_match, U_min(n1,128), s, n1, n2, pattern, n2, flags)
U_INTERNAL_ASSERT_EQUALS(pfn_match(s, n1, pattern, n2, flags), false)
U_INTERNAL_ASSERT( pfn_match(s, n1, pattern, n2, flags | FNM_INVERT))
}
static void check_match1(bPFpcupcud pfn_match)
{
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("01000000002345"),
U_CONSTANT_TO_PARAM("01*2345"), 0) )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("01000000002345"),
U_CONSTANT_TO_PARAM("01*2?46"), 0) == false )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("01000000002345"),
U_CONSTANT_TO_PARAM("010000000 2?45"), 0) == false )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("01000000002345"),
U_CONSTANT_TO_PARAM("01*2?4?"), 0) )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("01000000002345"),
U_CONSTANT_TO_PARAM("01*00*00*2?46"), 0) == false )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("01000000002345"),
U_CONSTANT_TO_PARAM("01*2?46?????????????????????"), 0) == false )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("01000000002345"),
U_CONSTANT_TO_PARAM("*****01*2?46?????????????????????"), 0) == false )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("aaAA4b334"),
U_CONSTANT_TO_PARAM("aaAA?b*4"), 0) )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("aaAA4b334"),
U_CONSTANT_TO_PARAM("aaaa?b*4"), FNM_CASEFOLD) )
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("01000000002345"), U_CONSTANT_TO_PARAM("01*2345"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("01000000002345"), U_CONSTANT_TO_PARAM("01*2?46"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("01000000002345"), U_CONSTANT_TO_PARAM("010000000 2?45"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("01000000002345"), U_CONSTANT_TO_PARAM("01*2?4?"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("01000000002345"), U_CONSTANT_TO_PARAM("01*00*00*2?46"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("01000000002345"), U_CONSTANT_TO_PARAM("01*2?46?????????????????????"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("01000000002345"), U_CONSTANT_TO_PARAM("*****01*2?46?????????????????????"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("aaAA4b334"), U_CONSTANT_TO_PARAM("aaAA?b*4"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("aaAA4b334"), U_CONSTANT_TO_PARAM("aaaa?b*4"), FNM_CASEFOLD);
}
static void check_match2(bPFpcupcud pfn_match)
{
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("pluto.au"), U_CONSTANT_TO_PARAM("*.jpg|*.gif|*.mp3"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("pippo.gif"), U_CONSTANT_TO_PARAM("*.jpg|*.gif|*.mp3"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("workflow"), U_CONSTANT_TO_PARAM("??/??/????|??:??:??|workflow"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("index.shtml"), U_CONSTANT_TO_PARAM("*.css|*.js|*.*html|*.png|*.gif|*.jpg"), 0))
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("pluto.au"), U_CONSTANT_TO_PARAM("*.jpg|*.gif|*.mp3"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("pippo.gif"), U_CONSTANT_TO_PARAM("*.jpg|*.gif|*.mp3"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("workflow"), U_CONSTANT_TO_PARAM("??/??/????|??:??:??|workflow"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("index.shtml"), U_CONSTANT_TO_PARAM("*.css|*.js|*.*html|*.png|*.gif|*.jpg"), 0);
}
static void check_match3(bPFpcupcud pfn_match)
{
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("pluto.au"), U_CONSTANT_TO_PARAM("*.jpg|*.gif|*.mp3"), FNM_INVERT))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("pippo.gif"), U_CONSTANT_TO_PARAM("*.jpg|*.gif|*.mp3"), FNM_INVERT) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("workflow"), U_CONSTANT_TO_PARAM("??/??/????|??:??:??|workflow"), FNM_INVERT) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("index.shtml"), U_CONSTANT_TO_PARAM("*.css|*.js|*.*html|*.png|*.gif|*.jpg"), FNM_INVERT) == false)
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("pluto.au"), U_CONSTANT_TO_PARAM("*.jpg|*.gif|*.mp3"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("pippo.gif"), U_CONSTANT_TO_PARAM("*.jpg|*.gif|*.mp3"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("workflow"), U_CONSTANT_TO_PARAM("??/??/????|??:??:??|workflow"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("index.shtml"), U_CONSTANT_TO_PARAM("*.css|*.js|*.*html|*.png|*.gif|*.jpg"), 0);
}
static void check_match4(bPFpcupcud pfn_match)
{
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("abbb/xy"), U_CONSTANT_TO_PARAM("a*b/*"), FNM_PATHNAME | FNM_PERIOD))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("!#%+,-./01234567889"), U_CONSTANT_TO_PARAM("!#%+,-./01234567889"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM(":;=@ABCDEFGHIJKLMNO"), U_CONSTANT_TO_PARAM(":;=@ABCDEFGHIJKLMNO"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("PQRSTUVWXYZ]abcdefg"), U_CONSTANT_TO_PARAM("PQRSTUVWXYZ]abcdefg"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("hijklmnopqrstuvwxyz"), U_CONSTANT_TO_PARAM("hijklmnopqrstuvwxyz"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("^_{}~"), U_CONSTANT_TO_PARAM("^_{}~"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("\"$&'()"), U_CONSTANT_TO_PARAM("\\\"\\$\\&\\'\\(\\)"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("*?[\\`|"), U_CONSTANT_TO_PARAM("\\*\\?\\[\\\\\\`\\|"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("<>"), U_CONSTANT_TO_PARAM("\\<\\>"), 0) )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("?*["), U_CONSTANT_TO_PARAM("[?*[][?*[][?*[]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a/b"), U_CONSTANT_TO_PARAM("?/b"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a/b"), U_CONSTANT_TO_PARAM("a?b"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a/b"), U_CONSTANT_TO_PARAM("a/?"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("aa/b"), U_CONSTANT_TO_PARAM("?/b"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("aa/b"), U_CONSTANT_TO_PARAM("a?b"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a/bb"), U_CONSTANT_TO_PARAM("a/?"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("abc"), U_CONSTANT_TO_PARAM("[abc]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("[abc]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[abc]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("["), U_CONSTANT_TO_PARAM("[[abc]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("xyz"), U_CONSTANT_TO_PARAM("[!abc]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("abc]"), U_CONSTANT_TO_PARAM("[][abc]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[!]]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("aa]"), U_CONSTANT_TO_PARAM("[!]a]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[a-c]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[a-c]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[a-c]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[b-c]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("d"), U_CONSTANT_TO_PARAM("[b-c]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("B"), U_CONSTANT_TO_PARAM("[a-c]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[A-C]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("as"), U_CONSTANT_TO_PARAM("[a-ca-z]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[a-c0-9]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("d"), U_CONSTANT_TO_PARAM("[a-c0-9]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("B"), U_CONSTANT_TO_PARAM("[a-c0-9]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[-a]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[-b]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[!-b]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[a-c-0-9]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[a-c-0-9]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a:"), U_CONSTANT_TO_PARAM("a[0-9-a]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a:"), U_CONSTANT_TO_PARAM("a[09-a]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asd/sdf"), U_CONSTANT_TO_PARAM("*"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("as"), U_CONSTANT_TO_PARAM("[a-c][a-z]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("as"), U_CONSTANT_TO_PARAM("??"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asd/sdf"), U_CONSTANT_TO_PARAM("as*df"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asd/sdf"), U_CONSTANT_TO_PARAM("as*"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asd/sdf"), U_CONSTANT_TO_PARAM("*df"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asd/sdf"), U_CONSTANT_TO_PARAM("as*dg"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("as*df"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("as*df?"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("as*??"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("a*???"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("*????"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("????*"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("??*?"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("/"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("/*"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("*/"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("/?"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("?/"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("?"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("."), U_CONSTANT_TO_PARAM("?"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("/"), FNM_PATHNAME))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("//"), U_CONSTANT_TO_PARAM("//"), FNM_PATHNAME))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/.a"), U_CONSTANT_TO_PARAM("/*"), FNM_PATHNAME))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/.a"), U_CONSTANT_TO_PARAM("/?a"), FNM_PATHNAME))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/.a/.b"), U_CONSTANT_TO_PARAM("/*/?b"), FNM_PATHNAME))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/$"), U_CONSTANT_TO_PARAM("\\/\\$"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/["), U_CONSTANT_TO_PARAM("\\/\\["), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/\\$"), U_CONSTANT_TO_PARAM("\\/\\$"), FNM_NOESCAPE) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM(".asd"), U_CONSTANT_TO_PARAM(".*"), FNM_PERIOD))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/.asd"), U_CONSTANT_TO_PARAM("*"), FNM_PERIOD))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/as/.df"), U_CONSTANT_TO_PARAM("*/?*f"), FNM_PERIOD))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM(".asd"), U_CONSTANT_TO_PARAM("[!a-z]*"), FNM_PERIOD) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("/."), FNM_PATHNAME|FNM_PERIOD))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/.a./.b."), U_CONSTANT_TO_PARAM("/.*/.*"), FNM_PATHNAME|FNM_PERIOD))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("foobar"), U_CONSTANT_TO_PARAM("foo*[abc]z"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("foobaz"), U_CONSTANT_TO_PARAM("foo*[abc][xyz]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("foobaz"), U_CONSTANT_TO_PARAM("foo?*[abc][xyz]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("foobaz"), U_CONSTANT_TO_PARAM("foo?*[abc][x/yz]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("foobaz"), U_CONSTANT_TO_PARAM("foo?*[abc]/[xyz]"), FNM_PATHNAME) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("a/"), FNM_PATHNAME) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a/"), U_CONSTANT_TO_PARAM("a"), FNM_PATHNAME) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("//a"), U_CONSTANT_TO_PARAM("/a"), FNM_PATHNAME) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/a"), U_CONSTANT_TO_PARAM("//a"), FNM_PATHNAME) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("cz"), U_CONSTANT_TO_PARAM("[ab-]z"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("az"), U_CONSTANT_TO_PARAM("[-a]z"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("bz"), U_CONSTANT_TO_PARAM("[-ab]z"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("cz"), U_CONSTANT_TO_PARAM("[-ab]z"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-z"), U_CONSTANT_TO_PARAM("[-ab]z"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[\\\\-a]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[\\\\-a]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[\\]-a]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[\\]-a]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[\\]-a]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("_"), U_CONSTANT_TO_PARAM("[!\\\\-a]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[!\\\\-a]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("!"), U_CONSTANT_TO_PARAM("[\\!-]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[\\!-]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[\\!-]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("Z"), U_CONSTANT_TO_PARAM("[Z-\\\\]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("["), U_CONSTANT_TO_PARAM("[Z-\\\\]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[Z-\\\\]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[Z-\\\\]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[Z-\\]]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("x"), FNM_PATHNAME|FNM_LEADING_DIR) )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("*"), FNM_PATHNAME|FNM_LEADING_DIR) )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("*x"), FNM_PATHNAME|FNM_LEADING_DIR) )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("x*"), FNM_PATHNAME|FNM_LEADING_DIR) )
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("a"), FNM_PATHNAME|FNM_LEADING_DIR) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("x/y"), FNM_PATHNAME|FNM_LEADING_DIR) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("x?y"), FNM_PATHNAME|FNM_LEADING_DIR) == false)
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("abbb/xy"), U_CONSTANT_TO_PARAM("a*b/*"), FNM_PATHNAME | FNM_PERIOD);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("!#%+,-./01234567889"), U_CONSTANT_TO_PARAM("!#%+,-./01234567889"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM(":;=@ABCDEFGHIJKLMNO"), U_CONSTANT_TO_PARAM(":;=@ABCDEFGHIJKLMNO"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("PQRSTUVWXYZ]abcdefg"), U_CONSTANT_TO_PARAM("PQRSTUVWXYZ]abcdefg"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("hijklmnopqrstuvwxyz"), U_CONSTANT_TO_PARAM("hijklmnopqrstuvwxyz"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("^_{}~"), U_CONSTANT_TO_PARAM("^_{}~"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("\"$&'()"), U_CONSTANT_TO_PARAM("\\\"\\$\\&\\'\\(\\)"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("*?[\\`|"), U_CONSTANT_TO_PARAM("\\*\\?\\[\\\\\\`\\|"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("<>"), U_CONSTANT_TO_PARAM("\\<\\>"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("?*["), U_CONSTANT_TO_PARAM("[?*[][?*[][?*[]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a/b"), U_CONSTANT_TO_PARAM("?/b"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a/b"), U_CONSTANT_TO_PARAM("a?b"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a/b"), U_CONSTANT_TO_PARAM("a/?"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("aa/b"), U_CONSTANT_TO_PARAM("?/b"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("aa/b"), U_CONSTANT_TO_PARAM("a?b"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a/bb"), U_CONSTANT_TO_PARAM("a/?"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("abc"), U_CONSTANT_TO_PARAM("[abc]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("[abc]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[abc]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("["), U_CONSTANT_TO_PARAM("[[abc]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("xyz"), U_CONSTANT_TO_PARAM("[!abc]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("abc]"), U_CONSTANT_TO_PARAM("[][abc]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[!]]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("aa]"), U_CONSTANT_TO_PARAM("[!]a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[a-c]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[a-c]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[a-c]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[b-c]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("d"), U_CONSTANT_TO_PARAM("[b-c]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("B"), U_CONSTANT_TO_PARAM("[a-c]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[A-C]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("as"), U_CONSTANT_TO_PARAM("[a-ca-z]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[a-c0-9]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("d"), U_CONSTANT_TO_PARAM("[a-c0-9]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("B"), U_CONSTANT_TO_PARAM("[a-c0-9]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[-a]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[-b]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[!-b]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[a-c-0-9]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[a-c-0-9]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a:"), U_CONSTANT_TO_PARAM("a[0-9-a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a:"), U_CONSTANT_TO_PARAM("a[09-a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("asd/sdf"), U_CONSTANT_TO_PARAM("*"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("as"), U_CONSTANT_TO_PARAM("[a-c][a-z]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("as"), U_CONSTANT_TO_PARAM("??"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("asd/sdf"), U_CONSTANT_TO_PARAM("as*df"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("asd/sdf"), U_CONSTANT_TO_PARAM("as*"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("asd/sdf"), U_CONSTANT_TO_PARAM("*df"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("asd/sdf"), U_CONSTANT_TO_PARAM("as*dg"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("as*df"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("as*df?"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("as*??"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("a*???"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("*????"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("????*"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("asdf"), U_CONSTANT_TO_PARAM("??*?"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("/"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("/*"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("*/"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("/?"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("?/"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("?"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("."), U_CONSTANT_TO_PARAM("?"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("/"), FNM_PATHNAME);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("//"), U_CONSTANT_TO_PARAM("//"), FNM_PATHNAME);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/.a"), U_CONSTANT_TO_PARAM("/*"), FNM_PATHNAME);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/.a"), U_CONSTANT_TO_PARAM("/?a"), FNM_PATHNAME);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/.a/.b"), U_CONSTANT_TO_PARAM("/*/?b"), FNM_PATHNAME);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/$"), U_CONSTANT_TO_PARAM("\\/\\$"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/["), U_CONSTANT_TO_PARAM("\\/\\["), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/\\$"), U_CONSTANT_TO_PARAM("\\/\\$"), FNM_NOESCAPE);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM(".asd"), U_CONSTANT_TO_PARAM(".*"), FNM_PERIOD);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/.asd"), U_CONSTANT_TO_PARAM("*"), FNM_PERIOD);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/as/.df"), U_CONSTANT_TO_PARAM("*/?*f"), FNM_PERIOD);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM(".asd"), U_CONSTANT_TO_PARAM("[!a-z]*"), FNM_PERIOD);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("/."), FNM_PATHNAME|FNM_PERIOD);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/.a./.b."), U_CONSTANT_TO_PARAM("/.*/.*"), FNM_PATHNAME|FNM_PERIOD);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("foobar"), U_CONSTANT_TO_PARAM("foo*[abc]z"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("foobaz"), U_CONSTANT_TO_PARAM("foo*[abc][xyz]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("foobaz"), U_CONSTANT_TO_PARAM("foo?*[abc][xyz]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("foobaz"), U_CONSTANT_TO_PARAM("foo?*[abc][x/yz]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("foobaz"), U_CONSTANT_TO_PARAM("foo?*[abc]/[xyz]"), FNM_PATHNAME);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("a/"), FNM_PATHNAME);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a/"), U_CONSTANT_TO_PARAM("a"), FNM_PATHNAME);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("//a"), U_CONSTANT_TO_PARAM("/a"), FNM_PATHNAME);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/a"), U_CONSTANT_TO_PARAM("//a"), FNM_PATHNAME);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("cz"), U_CONSTANT_TO_PARAM("[ab-]z"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("az"), U_CONSTANT_TO_PARAM("[-a]z"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("bz"), U_CONSTANT_TO_PARAM("[-ab]z"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("cz"), U_CONSTANT_TO_PARAM("[-ab]z"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("-z"), U_CONSTANT_TO_PARAM("[-ab]z"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[\\\\-a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[\\\\-a]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[\\]-a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[\\]-a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[\\]-a]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("_"), U_CONSTANT_TO_PARAM("[!\\\\-a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[!\\\\-a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("!"), U_CONSTANT_TO_PARAM("[\\!-]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[\\!-]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[\\!-]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("Z"), U_CONSTANT_TO_PARAM("[Z-\\\\]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("["), U_CONSTANT_TO_PARAM("[Z-\\\\]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[Z-\\\\]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[Z-\\\\]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[Z-\\]]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("x"), FNM_PATHNAME|FNM_LEADING_DIR);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("*"), FNM_PATHNAME|FNM_LEADING_DIR);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("*x"), FNM_PATHNAME|FNM_LEADING_DIR);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("x*"), FNM_PATHNAME|FNM_LEADING_DIR);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("a"), FNM_PATHNAME|FNM_LEADING_DIR);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("x/y"), FNM_PATHNAME|FNM_LEADING_DIR);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("x?y"), FNM_PATHNAME|FNM_LEADING_DIR);
}
/* Tests for fnmatch function */
static void check_match5(bPFpcupcud pfn_match)
{
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.a.]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[[.-.]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[[.-.][.].]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[[.].][.-.]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[[.-.][=u=]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[![.a.]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.b.]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.b.][.c.]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.b.][=b=]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[=a=]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[[=a=]b]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[[=a=][=b=]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[=a=][=b=]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[=a=][.b.]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("="), U_CONSTANT_TO_PARAM("[[=a=]b]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[[=a=]b]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[=b=][=c=]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[=b=][.].]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.a.]-c]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[a-[.c.]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.a.]-[.c.]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[[.a.]-c]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[a-[.c.]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[[.a.]-[.c.]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[[.a.]-c]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[a-[.c.]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[[.a.]-[.c.]]"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("d"), U_CONSTANT_TO_PARAM("[[.a.]-c]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("d"), U_CONSTANT_TO_PARAM("[a-[.c.]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("d"), U_CONSTANT_TO_PARAM("[[.a.]-[.c.]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.c.]-a]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[c-[.a.]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.c.]-[.a.]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[[.c.]-a]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[c-[.a.]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[[.c.]-[.a.]]"), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("??"), 0))
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/["), U_CONSTANT_TO_PARAM("\\/["), 0) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("*"), FNM_PATHNAME|FNM_PERIOD) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("/*"), FNM_PATHNAME|FNM_PERIOD) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("/?"), FNM_PATHNAME|FNM_PERIOD) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("/[!a-z]"), FNM_PATHNAME|FNM_PERIOD) == false)
// U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("abbb/.x"), U_CONSTANT_TO_PARAM("a*b/*"), FNM_PATHNAME | FNM_PERIOD) == false)
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.a.]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[[.-.]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[[.-.][.].]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[[.].][.-.]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[[.-.][=u=]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[![.a.]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.b.]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.b.][.c.]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.b.][=b=]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[=a=]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[[=a=]b]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[[=a=][=b=]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[=a=][=b=]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[=a=][.b.]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("="), U_CONSTANT_TO_PARAM("[[=a=]b]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[[=a=]b]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[=b=][=c=]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[=b=][.].]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.a.]-c]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[a-[.c.]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.a.]-[.c.]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[[.a.]-c]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[a-[.c.]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("b"), U_CONSTANT_TO_PARAM("[[.a.]-[.c.]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[[.a.]-c]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[a-[.c.]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[[.a.]-[.c.]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("d"), U_CONSTANT_TO_PARAM("[[.a.]-c]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("d"), U_CONSTANT_TO_PARAM("[a-[.c.]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("d"), U_CONSTANT_TO_PARAM("[[.a.]-[.c.]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.c.]-a]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[c-[.a.]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[[.c.]-[.a.]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[[.c.]-a]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[c-[.a.]]"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[[.c.]-[.a.]]"), 0);
// check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("??"), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/["), U_CONSTANT_TO_PARAM("\\/["), 0);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("*"), FNM_PATHNAME|FNM_PERIOD);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("/*"), FNM_PATHNAME|FNM_PERIOD);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("/?"), FNM_PATHNAME|FNM_PERIOD);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/."), U_CONSTANT_TO_PARAM("/[!a-z]"), FNM_PATHNAME|FNM_PERIOD);
// check_match_false(pfn_match, U_CONSTANT_TO_PARAM("abbb/.x"), U_CONSTANT_TO_PARAM("a*b/*"), FNM_PATHNAME | FNM_PERIOD);
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a]"), U_CONSTANT_TO_PARAM("[]a]]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("[]abc"), U_CONSTANT_TO_PARAM("[][]abc"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[!abc]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[][abc]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("[!abc]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[][abc]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[!a]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("]]"), U_CONSTANT_TO_PARAM("[!a]]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[c-a]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[c-a]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[!-a]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("[!a-c]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("."), U_CONSTANT_TO_PARAM("[!a-c]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/.a"), U_CONSTANT_TO_PARAM("/[!a-z]a"), FNM_PATHNAME))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/$"), U_CONSTANT_TO_PARAM("\\/\\$"), FNM_NOESCAPE) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("\\/\\$"), U_CONSTANT_TO_PARAM("\\/\\$"), FNM_NOESCAPE))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("..asd"), U_CONSTANT_TO_PARAM(".[!a-z]*"), FNM_PERIOD))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM(".asd"), U_CONSTANT_TO_PARAM("*"), FNM_PERIOD) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM(".asd"), U_CONSTANT_TO_PARAM("?asd"), FNM_PERIOD) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("az"), U_CONSTANT_TO_PARAM("[a-]z"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("bz"), U_CONSTANT_TO_PARAM("[ab-]z"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-z"), U_CONSTANT_TO_PARAM("[ab-]z"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("_"), U_CONSTANT_TO_PARAM("[\\\\-a]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[\\\\-a]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("_"), U_CONSTANT_TO_PARAM("[\\]-a]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[\\]-a]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[!\\\\-a]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[!\\\\-a]"), 0) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("Z"), U_CONSTANT_TO_PARAM("[Z-\\]]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("["), U_CONSTANT_TO_PARAM("[Z-\\]]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[Z-\\]]"), 0))
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[Z-\\]]"), 0))
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a]"), U_CONSTANT_TO_PARAM("[]a]]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("[]abc"), U_CONSTANT_TO_PARAM("[][]abc"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[!abc]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[][abc]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("x"), U_CONSTANT_TO_PARAM("[!abc]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[][abc]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[!a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("]]"), U_CONSTANT_TO_PARAM("[!a]]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[c-a]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("c"), U_CONSTANT_TO_PARAM("[c-a]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[!-a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("[!a-c]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("."), U_CONSTANT_TO_PARAM("[!a-c]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("/.a"), U_CONSTANT_TO_PARAM("/[!a-z]a"), FNM_PATHNAME);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/$"), U_CONSTANT_TO_PARAM("\\/\\$"), FNM_NOESCAPE);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("\\/\\$"), U_CONSTANT_TO_PARAM("\\/\\$"), FNM_NOESCAPE);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("..asd"), U_CONSTANT_TO_PARAM(".[!a-z]*"), FNM_PERIOD);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM(".asd"), U_CONSTANT_TO_PARAM("*"), FNM_PERIOD);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM(".asd"), U_CONSTANT_TO_PARAM("?asd"), FNM_PERIOD);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("az"), U_CONSTANT_TO_PARAM("[a-]z"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("bz"), U_CONSTANT_TO_PARAM("[ab-]z"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("-z"), U_CONSTANT_TO_PARAM("[ab-]z"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("_"), U_CONSTANT_TO_PARAM("[\\\\-a]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[\\\\-a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("_"), U_CONSTANT_TO_PARAM("[\\]-a]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("-"), U_CONSTANT_TO_PARAM("[\\]-a]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[!\\\\-a]"), 0);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a"), U_CONSTANT_TO_PARAM("[!\\\\-a]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("Z"), U_CONSTANT_TO_PARAM("[Z-\\]]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("["), U_CONSTANT_TO_PARAM("[Z-\\]]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("\\"), U_CONSTANT_TO_PARAM("[Z-\\]]"), 0);
check_match_true( pfn_match, U_CONSTANT_TO_PARAM("]"), U_CONSTANT_TO_PARAM("[Z-\\]]"), 0);
#ifndef __MINGW32__
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("?"), FNM_PATHNAME) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("*"), FNM_PATHNAME) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("a/b"), U_CONSTANT_TO_PARAM("a?b"), FNM_PATHNAME) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/.a/.b"), U_CONSTANT_TO_PARAM("/*b"), FNM_PATHNAME) == false)
U_INTERNAL_ASSERT( pfn_match(U_CONSTANT_TO_PARAM("/a./.b."), U_CONSTANT_TO_PARAM("/*/*"), FNM_PATHNAME|FNM_PERIOD) == false)
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("?"), FNM_PATHNAME);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/"), U_CONSTANT_TO_PARAM("*"), FNM_PATHNAME);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("a/b"), U_CONSTANT_TO_PARAM("a?b"), FNM_PATHNAME);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/.a/.b"), U_CONSTANT_TO_PARAM("/*b"), FNM_PATHNAME);
check_match_false(pfn_match, U_CONSTANT_TO_PARAM("/a./.b."), U_CONSTANT_TO_PARAM("/*/*"), FNM_PATHNAME|FNM_PERIOD);
#endif
}
static int compare_str(const void* str1, const void* str2) { return u_strnatcmp(*(const char**)str1, *(const char**)str2); }
#define U_TESTO_SEMPLICE "testosemplicetxt" /* no _.:?! */
int main(int argc, char* argv[])