113498266Sopenharmony_ci/*************************************************************************** 213498266Sopenharmony_ci * _ _ ____ _ 313498266Sopenharmony_ci * Project ___| | | | _ \| | 413498266Sopenharmony_ci * / __| | | | |_) | | 513498266Sopenharmony_ci * | (__| |_| | _ <| |___ 613498266Sopenharmony_ci * \___|\___/|_| \_\_____| 713498266Sopenharmony_ci * 813498266Sopenharmony_ci * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 913498266Sopenharmony_ci * 1013498266Sopenharmony_ci * This software is licensed as described in the file COPYING, which 1113498266Sopenharmony_ci * you should have received as part of this distribution. The terms 1213498266Sopenharmony_ci * are also available at https://curl.se/docs/copyright.html. 1313498266Sopenharmony_ci * 1413498266Sopenharmony_ci * You may opt to use, copy, modify, merge, publish, distribute and/or sell 1513498266Sopenharmony_ci * copies of the Software, and permit persons to whom the Software is 1613498266Sopenharmony_ci * furnished to do so, under the terms of the COPYING file. 1713498266Sopenharmony_ci * 1813498266Sopenharmony_ci * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 1913498266Sopenharmony_ci * KIND, either express or implied. 2013498266Sopenharmony_ci * 2113498266Sopenharmony_ci * SPDX-License-Identifier: curl 2213498266Sopenharmony_ci * 2313498266Sopenharmony_ci ***************************************************************************/ 2413498266Sopenharmony_ci#include "curlcheck.h" 2513498266Sopenharmony_ci 2613498266Sopenharmony_ci#include "curl_fnmatch.h" 2713498266Sopenharmony_ci 2813498266Sopenharmony_cistatic CURLcode unit_setup(void) 2913498266Sopenharmony_ci{ 3013498266Sopenharmony_ci return CURLE_OK; 3113498266Sopenharmony_ci} 3213498266Sopenharmony_ci 3313498266Sopenharmony_cistatic void unit_stop(void) 3413498266Sopenharmony_ci{ 3513498266Sopenharmony_ci} 3613498266Sopenharmony_ci 3713498266Sopenharmony_ci#ifndef CURL_DISABLE_FTP 3813498266Sopenharmony_ci 3913498266Sopenharmony_ci/* 4013498266Sopenharmony_ci CURL_FNMATCH_MATCH 0 4113498266Sopenharmony_ci CURL_FNMATCH_NOMATCH 1 4213498266Sopenharmony_ci CURL_FNMATCH_FAIL 2 4313498266Sopenharmony_ci */ 4413498266Sopenharmony_ci 4513498266Sopenharmony_ci#define MATCH CURL_FNMATCH_MATCH 4613498266Sopenharmony_ci#define NOMATCH CURL_FNMATCH_NOMATCH 4713498266Sopenharmony_ci 4813498266Sopenharmony_ci#define LINUX_DIFFER 0x80 4913498266Sopenharmony_ci#define LINUX_SHIFT 8 5013498266Sopenharmony_ci#define LINUX_MATCH ((CURL_FNMATCH_MATCH << LINUX_SHIFT) | LINUX_DIFFER) 5113498266Sopenharmony_ci#define LINUX_NOMATCH ((CURL_FNMATCH_NOMATCH << LINUX_SHIFT) | LINUX_DIFFER) 5213498266Sopenharmony_ci#define LINUX_FAIL ((CURL_FNMATCH_FAIL << LINUX_SHIFT) | LINUX_DIFFER) 5313498266Sopenharmony_ci 5413498266Sopenharmony_ci#define MAC_DIFFER 0x40 5513498266Sopenharmony_ci#define MAC_SHIFT 16 5613498266Sopenharmony_ci#define MAC_MATCH ((CURL_FNMATCH_MATCH << MAC_SHIFT) | MAC_DIFFER) 5713498266Sopenharmony_ci#define MAC_NOMATCH ((CURL_FNMATCH_NOMATCH << MAC_SHIFT) | MAC_DIFFER) 5813498266Sopenharmony_ci#define MAC_FAIL ((CURL_FNMATCH_FAIL << MAC_SHIFT) | MAC_DIFFER) 5913498266Sopenharmony_ci 6013498266Sopenharmony_cistruct testcase { 6113498266Sopenharmony_ci const char *pattern; 6213498266Sopenharmony_ci const char *string; 6313498266Sopenharmony_ci int result; 6413498266Sopenharmony_ci}; 6513498266Sopenharmony_ci 6613498266Sopenharmony_cistatic const struct testcase tests[] = { 6713498266Sopenharmony_ci /* brackets syntax */ 6813498266Sopenharmony_ci {"*[*[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[" 6913498266Sopenharmony_ci "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[" 7013498266Sopenharmony_ci "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\001\177[[[[[[[[[[[[[[[[[[[[[", 7113498266Sopenharmony_ci "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[" 7213498266Sopenharmony_ci "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[" 7313498266Sopenharmony_ci "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[", 7413498266Sopenharmony_ci NOMATCH|MAC_FAIL}, 7513498266Sopenharmony_ci 7613498266Sopenharmony_ci { "\\[", "[", MATCH }, 7713498266Sopenharmony_ci { "[", "[", NOMATCH|LINUX_MATCH|MAC_FAIL}, 7813498266Sopenharmony_ci { "[]", "[]", NOMATCH|LINUX_MATCH|MAC_FAIL}, 7913498266Sopenharmony_ci { "[][]", "[", MATCH }, 8013498266Sopenharmony_ci { "[][]", "]", MATCH }, 8113498266Sopenharmony_ci { "[[]", "[", MATCH }, 8213498266Sopenharmony_ci { "[[[]", "[", MATCH }, 8313498266Sopenharmony_ci { "[[[[]", "[", MATCH }, 8413498266Sopenharmony_ci { "[[[[]", "[", MATCH }, 8513498266Sopenharmony_ci 8613498266Sopenharmony_ci { "[][[]", "]", MATCH }, 8713498266Sopenharmony_ci { "[][[[]", "[", MATCH }, 8813498266Sopenharmony_ci { "[[]", "]", NOMATCH }, 8913498266Sopenharmony_ci 9013498266Sopenharmony_ci { "[a@]", "a", MATCH }, 9113498266Sopenharmony_ci 9213498266Sopenharmony_ci { "[a-z]", "a", MATCH }, 9313498266Sopenharmony_ci { "[a-z]", "A", NOMATCH }, 9413498266Sopenharmony_ci { "?[a-z]", "?Z", NOMATCH }, 9513498266Sopenharmony_ci { "[A-Z]", "C", MATCH }, 9613498266Sopenharmony_ci { "[A-Z]", "c", NOMATCH }, 9713498266Sopenharmony_ci { "[0-9]", "7", MATCH }, 9813498266Sopenharmony_ci { "[7-8]", "7", MATCH }, 9913498266Sopenharmony_ci { "[7-]", "7", MATCH }, 10013498266Sopenharmony_ci { "[7-]", "-", MATCH }, 10113498266Sopenharmony_ci { "[7-]", "[", NOMATCH }, 10213498266Sopenharmony_ci { "[a-bA-F]", "F", MATCH }, 10313498266Sopenharmony_ci { "[a-bA-B9]", "9", MATCH }, 10413498266Sopenharmony_ci { "[a-bA-B98]", "8", MATCH }, 10513498266Sopenharmony_ci { "[a-bA-B98]", "C", NOMATCH }, 10613498266Sopenharmony_ci { "[a-bA-Z9]", "F", MATCH }, 10713498266Sopenharmony_ci { "[a-bA-Z9]ero*", "Zero chance.", MATCH }, 10813498266Sopenharmony_ci { "S[a-][x]opho*", "Saxophone", MATCH }, 10913498266Sopenharmony_ci { "S[a-][x]opho*", "SaXophone", NOMATCH }, 11013498266Sopenharmony_ci { "S[a-][x]*.txt", "S-x.txt", MATCH }, 11113498266Sopenharmony_ci { "[\\a-\\b]", "a", MATCH }, 11213498266Sopenharmony_ci { "[\\a-\\b]", "b", MATCH }, 11313498266Sopenharmony_ci { "[?*[][?*[][?*[]", "?*[", MATCH }, 11413498266Sopenharmony_ci { "[][?*-]", "]", MATCH }, 11513498266Sopenharmony_ci { "[][?*-]", "[", MATCH }, 11613498266Sopenharmony_ci { "[][?*-]", "?", MATCH }, 11713498266Sopenharmony_ci { "[][?*-]", "*", MATCH }, 11813498266Sopenharmony_ci { "[][?*-]", "-", MATCH }, 11913498266Sopenharmony_ci { "[]?*-]", "-", MATCH }, 12013498266Sopenharmony_ci { "[\xFF]", "\xFF", MATCH|LINUX_FAIL|MAC_FAIL}, 12113498266Sopenharmony_ci { "?/b/c", "a/b/c", MATCH }, 12213498266Sopenharmony_ci { "^_{}~", "^_{}~", MATCH }, 12313498266Sopenharmony_ci { "!#%+,-./01234567889", "!#%+,-./01234567889", MATCH }, 12413498266Sopenharmony_ci { "PQRSTUVWXYZ]abcdefg", "PQRSTUVWXYZ]abcdefg", MATCH }, 12513498266Sopenharmony_ci { ":;=@ABCDEFGHIJKLMNO", ":;=@ABCDEFGHIJKLMNO", MATCH }, 12613498266Sopenharmony_ci 12713498266Sopenharmony_ci /* negate */ 12813498266Sopenharmony_ci { "[!a]", "b", MATCH }, 12913498266Sopenharmony_ci { "[!a]", "a", NOMATCH }, 13013498266Sopenharmony_ci { "[^a]", "b", MATCH }, 13113498266Sopenharmony_ci { "[^a]", "a", NOMATCH }, 13213498266Sopenharmony_ci { "[^a-z0-9A-Z]", "a", NOMATCH }, 13313498266Sopenharmony_ci { "[^a-z0-9A-Z]", "-", MATCH }, 13413498266Sopenharmony_ci { "curl[!a-z]lib", "curl lib", MATCH }, 13513498266Sopenharmony_ci { "curl[! ]lib", "curl lib", NOMATCH }, 13613498266Sopenharmony_ci { "[! ][ ]", " ", NOMATCH }, 13713498266Sopenharmony_ci { "[! ][ ]", "a ", MATCH }, 13813498266Sopenharmony_ci { "*[^a].t?t", "a.txt", NOMATCH }, 13913498266Sopenharmony_ci { "*[^a].t?t", "ba.txt", NOMATCH }, 14013498266Sopenharmony_ci { "*[^a].t?t", "ab.txt", MATCH }, 14113498266Sopenharmony_ci { "*[^a]", "", NOMATCH }, 14213498266Sopenharmony_ci { "[!\xFF]", "", NOMATCH|LINUX_FAIL}, 14313498266Sopenharmony_ci { "[!\xFF]", "\xFF", NOMATCH|LINUX_FAIL|MAC_FAIL}, 14413498266Sopenharmony_ci { "[!\xFF]", "a", MATCH|LINUX_FAIL|MAC_FAIL}, 14513498266Sopenharmony_ci { "[!?*[]", "?", NOMATCH }, 14613498266Sopenharmony_ci { "[!!]", "!", NOMATCH }, 14713498266Sopenharmony_ci { "[!!]", "x", MATCH }, 14813498266Sopenharmony_ci 14913498266Sopenharmony_ci { "[[:alpha:]]", "a", MATCH }, 15013498266Sopenharmony_ci { "[[:alpha:]]", "9", NOMATCH }, 15113498266Sopenharmony_ci { "[[:alnum:]]", "a", MATCH }, 15213498266Sopenharmony_ci { "[[:alnum:]]", "[", NOMATCH }, 15313498266Sopenharmony_ci { "[[:alnum:]]", "]", NOMATCH }, 15413498266Sopenharmony_ci { "[[:alnum:]]", "9", MATCH }, 15513498266Sopenharmony_ci { "[[:digit:]]", "9", MATCH }, 15613498266Sopenharmony_ci { "[[:xdigit:]]", "9", MATCH }, 15713498266Sopenharmony_ci { "[[:xdigit:]]", "F", MATCH }, 15813498266Sopenharmony_ci { "[[:xdigit:]]", "G", NOMATCH }, 15913498266Sopenharmony_ci { "[[:upper:]]", "U", MATCH }, 16013498266Sopenharmony_ci { "[[:upper:]]", "u", NOMATCH }, 16113498266Sopenharmony_ci { "[[:lower:]]", "l", MATCH }, 16213498266Sopenharmony_ci { "[[:lower:]]", "L", NOMATCH }, 16313498266Sopenharmony_ci { "[[:print:]]", "L", MATCH }, 16413498266Sopenharmony_ci { "[[:print:]]", "\10", NOMATCH }, 16513498266Sopenharmony_ci { "[[:print:]]", "\10", NOMATCH }, 16613498266Sopenharmony_ci { "[[:space:]]", " ", MATCH }, 16713498266Sopenharmony_ci { "[[:space:]]", "x", NOMATCH }, 16813498266Sopenharmony_ci { "[[:graph:]]", " ", NOMATCH }, 16913498266Sopenharmony_ci { "[[:graph:]]", "x", MATCH }, 17013498266Sopenharmony_ci { "[[:blank:]]", "\t", MATCH }, 17113498266Sopenharmony_ci { "[[:blank:]]", " ", MATCH }, 17213498266Sopenharmony_ci { "[[:blank:]]", "\r", NOMATCH }, 17313498266Sopenharmony_ci { "[^[:blank:]]", "\t", NOMATCH }, 17413498266Sopenharmony_ci { "[^[:print:]]", "\10", MATCH }, 17513498266Sopenharmony_ci { "[[:lower:]][[:lower:]]", "ll", MATCH }, 17613498266Sopenharmony_ci { "[[:foo:]]", "bar", NOMATCH|MAC_FAIL}, 17713498266Sopenharmony_ci { "[[:foo:]]", "f]", MATCH|LINUX_NOMATCH|MAC_FAIL}, 17813498266Sopenharmony_ci 17913498266Sopenharmony_ci { "Curl[[:blank:]];-)", "Curl ;-)", MATCH }, 18013498266Sopenharmony_ci { "*[[:blank:]]*", " ", MATCH }, 18113498266Sopenharmony_ci { "*[[:blank:]]*", "", NOMATCH }, 18213498266Sopenharmony_ci { "*[[:blank:]]*", "hi, im_Pavel", MATCH }, 18313498266Sopenharmony_ci 18413498266Sopenharmony_ci /* common using */ 18513498266Sopenharmony_ci { "filename.dat", "filename.dat", MATCH }, 18613498266Sopenharmony_ci { "*curl*", "lets use curl!!", MATCH }, 18713498266Sopenharmony_ci { "filename.txt", "filename.dat", NOMATCH }, 18813498266Sopenharmony_ci { "*.txt", "text.txt", MATCH }, 18913498266Sopenharmony_ci { "*.txt", "a.txt", MATCH }, 19013498266Sopenharmony_ci { "*.txt", ".txt", MATCH }, 19113498266Sopenharmony_ci { "*.txt", "txt", NOMATCH }, 19213498266Sopenharmony_ci { "??.txt", "99.txt", MATCH }, 19313498266Sopenharmony_ci { "??.txt", "a99.txt", NOMATCH }, 19413498266Sopenharmony_ci { "?.???", "a.txt", MATCH }, 19513498266Sopenharmony_ci { "*.???", "somefile.dat", MATCH }, 19613498266Sopenharmony_ci { "*.???", "photo.jpeg", NOMATCH }, 19713498266Sopenharmony_ci { ".*", ".htaccess", MATCH }, 19813498266Sopenharmony_ci { ".*", ".", MATCH }, 19913498266Sopenharmony_ci { ".*", "..", MATCH }, 20013498266Sopenharmony_ci 20113498266Sopenharmony_ci /* many stars => one star */ 20213498266Sopenharmony_ci { "**.txt", "text.txt", MATCH }, 20313498266Sopenharmony_ci { "***.txt", "t.txt", MATCH }, 20413498266Sopenharmony_ci { "****.txt", ".txt", MATCH }, 20513498266Sopenharmony_ci 20613498266Sopenharmony_ci /* empty string or pattern */ 20713498266Sopenharmony_ci { "", "", MATCH }, 20813498266Sopenharmony_ci { "", "hello", NOMATCH }, 20913498266Sopenharmony_ci { "file", "", NOMATCH }, 21013498266Sopenharmony_ci { "?", "", NOMATCH }, 21113498266Sopenharmony_ci { "*", "", MATCH }, 21213498266Sopenharmony_ci { "x", "", NOMATCH }, 21313498266Sopenharmony_ci 21413498266Sopenharmony_ci /* backslash */ 21513498266Sopenharmony_ci { "\\", "\\", MATCH|LINUX_NOMATCH}, 21613498266Sopenharmony_ci { "\\\\", "\\", MATCH }, 21713498266Sopenharmony_ci { "\\\\", "\\\\", NOMATCH }, 21813498266Sopenharmony_ci { "\\?", "?", MATCH }, 21913498266Sopenharmony_ci { "\\*", "*", MATCH }, 22013498266Sopenharmony_ci { "?.txt", "?.txt", MATCH }, 22113498266Sopenharmony_ci { "*.txt", "*.txt", MATCH }, 22213498266Sopenharmony_ci { "\\?.txt", "?.txt", MATCH }, 22313498266Sopenharmony_ci { "\\*.txt", "*.txt", MATCH }, 22413498266Sopenharmony_ci { "\\?.txt", "x.txt", NOMATCH }, 22513498266Sopenharmony_ci { "\\*.txt", "x.txt", NOMATCH }, 22613498266Sopenharmony_ci { "\\*\\\\.txt", "*\\.txt", MATCH }, 22713498266Sopenharmony_ci { "*\\**\\?*\\\\*", "cc*cc?cccc", NOMATCH }, 22813498266Sopenharmony_ci { "*\\?*\\**", "cc?cc", NOMATCH }, 22913498266Sopenharmony_ci { "\\\"\\$\\&\\'\\(\\)", "\"$&'()", MATCH }, 23013498266Sopenharmony_ci { "\\*\\?\\[\\\\\\`\\|", "*?[\\`|", MATCH }, 23113498266Sopenharmony_ci { "[\\a\\b]c", "ac", MATCH }, 23213498266Sopenharmony_ci { "[\\a\\b]c", "bc", MATCH }, 23313498266Sopenharmony_ci { "[\\a\\b]d", "bc", NOMATCH }, 23413498266Sopenharmony_ci { "[a-bA-B\\?]", "?", MATCH }, 23513498266Sopenharmony_ci { "cu[a-ab-b\\r]l", "curl", MATCH }, 23613498266Sopenharmony_ci { "[\\a-z]", "c", MATCH }, 23713498266Sopenharmony_ci 23813498266Sopenharmony_ci { "?*?*?.*?*", "abc.c", MATCH }, 23913498266Sopenharmony_ci { "?*?*?.*?*", "abcc", NOMATCH }, 24013498266Sopenharmony_ci { "?*?*?.*?*", "abc.", NOMATCH }, 24113498266Sopenharmony_ci { "?*?*?.*?*", "abc.c++", MATCH }, 24213498266Sopenharmony_ci { "?*?*?.*?*", "abcdef.c++", MATCH }, 24313498266Sopenharmony_ci { "?*?*?.?", "abcdef.c", MATCH }, 24413498266Sopenharmony_ci { "?*?*?.?", "abcdef.cd", NOMATCH }, 24513498266Sopenharmony_ci 24613498266Sopenharmony_ci { "Lindmätarv", "Lindmätarv", MATCH }, 24713498266Sopenharmony_ci 24813498266Sopenharmony_ci { "", "", MATCH}, 24913498266Sopenharmony_ci {"**]*[*[\x13]**[*\x13)]*]*[**[*\x13~r-]*]**[.*]*[\xe3\xe3\xe3\xe3\xe3\xe3" 25013498266Sopenharmony_ci "\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3\xe3" 25113498266Sopenharmony_ci "\xe3\xe3\xe3\xe3\xe3*[\x13]**[*\x13)]*]*[*[\x13]*[~r]*]*\xba\x13\xa6~b-]*", 25213498266Sopenharmony_ci "a", NOMATCH|LINUX_FAIL} 25313498266Sopenharmony_ci}; 25413498266Sopenharmony_ci 25513498266Sopenharmony_cistatic const char *ret2name(int i) 25613498266Sopenharmony_ci{ 25713498266Sopenharmony_ci switch(i) { 25813498266Sopenharmony_ci case 0: 25913498266Sopenharmony_ci return "MATCH"; 26013498266Sopenharmony_ci case 1: 26113498266Sopenharmony_ci return "NOMATCH"; 26213498266Sopenharmony_ci case 2: 26313498266Sopenharmony_ci return "FAIL"; 26413498266Sopenharmony_ci default: 26513498266Sopenharmony_ci return "unknown"; 26613498266Sopenharmony_ci } 26713498266Sopenharmony_ci /* not reached */ 26813498266Sopenharmony_ci} 26913498266Sopenharmony_ci 27013498266Sopenharmony_cienum system { 27113498266Sopenharmony_ci SYSTEM_CUSTOM, 27213498266Sopenharmony_ci SYSTEM_LINUX, 27313498266Sopenharmony_ci SYSTEM_MACOS 27413498266Sopenharmony_ci}; 27513498266Sopenharmony_ci 27613498266Sopenharmony_ciUNITTEST_START 27713498266Sopenharmony_ci{ 27813498266Sopenharmony_ci int testnum = sizeof(tests) / sizeof(struct testcase); 27913498266Sopenharmony_ci int i; 28013498266Sopenharmony_ci enum system machine; 28113498266Sopenharmony_ci 28213498266Sopenharmony_ci#ifdef HAVE_FNMATCH 28313498266Sopenharmony_ci if(strstr(OS, "apple") || strstr(OS, "darwin")) { 28413498266Sopenharmony_ci machine = SYSTEM_MACOS; 28513498266Sopenharmony_ci } 28613498266Sopenharmony_ci else 28713498266Sopenharmony_ci machine = SYSTEM_LINUX; 28813498266Sopenharmony_ci printf("Tested with system fnmatch(), %s-style\n", 28913498266Sopenharmony_ci machine == SYSTEM_LINUX ? "linux" : "mac"); 29013498266Sopenharmony_ci#else 29113498266Sopenharmony_ci printf("Tested with custom fnmatch()\n"); 29213498266Sopenharmony_ci machine = SYSTEM_CUSTOM; 29313498266Sopenharmony_ci#endif 29413498266Sopenharmony_ci 29513498266Sopenharmony_ci for(i = 0; i < testnum; i++) { 29613498266Sopenharmony_ci int result = tests[i].result; 29713498266Sopenharmony_ci int rc = Curl_fnmatch(NULL, tests[i].pattern, tests[i].string); 29813498266Sopenharmony_ci if(result & (LINUX_DIFFER|MAC_DIFFER)) { 29913498266Sopenharmony_ci if((result & LINUX_DIFFER) && (machine == SYSTEM_LINUX)) 30013498266Sopenharmony_ci result >>= LINUX_SHIFT; 30113498266Sopenharmony_ci else if((result & MAC_DIFFER) && (machine == SYSTEM_MACOS)) 30213498266Sopenharmony_ci result >>= MAC_SHIFT; 30313498266Sopenharmony_ci result &= 0x03; /* filter off all high bits */ 30413498266Sopenharmony_ci } 30513498266Sopenharmony_ci if(rc != result) { 30613498266Sopenharmony_ci printf("Curl_fnmatch(\"%s\", \"%s\") should return %s (returns %s)" 30713498266Sopenharmony_ci " [%d]\n", 30813498266Sopenharmony_ci tests[i].pattern, tests[i].string, ret2name(result), 30913498266Sopenharmony_ci ret2name(rc), i); 31013498266Sopenharmony_ci fail("pattern mismatch"); 31113498266Sopenharmony_ci } 31213498266Sopenharmony_ci } 31313498266Sopenharmony_ci} 31413498266Sopenharmony_ciUNITTEST_STOP 31513498266Sopenharmony_ci 31613498266Sopenharmony_ci#else 31713498266Sopenharmony_ci 31813498266Sopenharmony_ciUNITTEST_START 31913498266Sopenharmony_ciUNITTEST_STOP 32013498266Sopenharmony_ci 32113498266Sopenharmony_ci#endif 322