-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy path_test_match.cpp
More file actions
74 lines (68 loc) · 1.26 KB
/
_test_match.cpp
File metadata and controls
74 lines (68 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* @file _test_match.cpp
* @brief
*
* @author Yonhgwhan, Roh (somma@somma.kr)
* @date 11/12/2023 created.
* @copyright All rights reserved by Yonghwan, Roh.
**/
#include "stdafx.h"
#include "_MyLib/src/match.h"
bool test_match()
{
_mem_check_begin
{
struct ss
{
const char* text;
const char* pattern;
bool expected;
} ss_list [] = {
{
"https://www.naver.com",
"htt?://*.naver.com",
false
},
{
"https://www.naver.com",
"h*://?.naver.com",
false
},
{
"https://www.naver.com",
"h*://*.naver.com",
true
},
{
"https://tivan.naver.com/sc2/12/",
"http*://*.naver.com",
false
},
{
"https://tivan.naver.com/sc2/12/",
"http?://*.naver.com/*",
true
},
{
"https://tivan.naver.com/sc2/12/",
"http?://*.naver.com/*",
true
},
{
"https://www.naver.com",
"http*://*.*.naver.com",
false
}
};
for (int i = 0; i < sizeof(ss_list) / sizeof(struct ss); ++i)
{
fprintf(stdout,
"test=%s, match=%s, expected=%s, result=%s \n",
ss_list[i].text, ss_list[i].pattern,
ss_list[i].expected == true ? "O" : "X",
true == match_string(ss_list[i].text, ss_list[i].pattern) ? "O" : "X");
}
}
_mem_check_end;
return true;
}