Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
367f5df3
Commit
367f5df3
authored
Mar 24, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
match_prefix -> mg_match_prefix
parent
f096138d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
28 deletions
+28
-28
unit_test.c
examples/unit_test.c
+28
-28
No files found.
examples/unit_test.c
View file @
367f5df3
...
...
@@ -166,34 +166,34 @@ static const char *test_should_keep_alive(void) {
}
static
const
char
*
test_match_prefix
(
void
)
{
ASSERT
(
match_prefix
(
"/api"
,
4
,
"/api"
)
==
4
);
ASSERT
(
match_prefix
(
"/a/"
,
3
,
"/a/b/c"
)
==
3
);
ASSERT
(
match_prefix
(
"/a/"
,
3
,
"/ab/c"
)
==
-
1
);
ASSERT
(
match_prefix
(
"/*/"
,
3
,
"/ab/c"
)
==
4
);
ASSERT
(
match_prefix
(
"**"
,
2
,
"/a/b/c"
)
==
6
);
ASSERT
(
match_prefix
(
"/*"
,
2
,
"/a/b/c"
)
==
2
);
ASSERT
(
match_prefix
(
"*/*"
,
3
,
"/a/b/c"
)
==
2
);
ASSERT
(
match_prefix
(
"**/"
,
3
,
"/a/b/c"
)
==
5
);
ASSERT
(
match_prefix
(
"**.foo|**.bar"
,
13
,
"a.bar"
)
==
5
);
ASSERT
(
match_prefix
(
"a|b|cd"
,
6
,
"cdef"
)
==
2
);
ASSERT
(
match_prefix
(
"a|b|c?"
,
6
,
"cdef"
)
==
2
);
ASSERT
(
match_prefix
(
"a|?|cd"
,
6
,
"cdef"
)
==
1
);
ASSERT
(
match_prefix
(
"/a/**.cgi"
,
9
,
"/foo/bar/x.cgi"
)
==
-
1
);
ASSERT
(
match_prefix
(
"/a/**.cgi"
,
9
,
"/a/bar/x.cgi"
)
==
12
);
ASSERT
(
match_prefix
(
"**/"
,
3
,
"/a/b/c"
)
==
5
);
ASSERT
(
match_prefix
(
"**/$"
,
4
,
"/a/b/c"
)
==
-
1
);
ASSERT
(
match_prefix
(
"**/$"
,
4
,
"/a/b/"
)
==
5
);
ASSERT
(
match_prefix
(
"$"
,
1
,
""
)
==
0
);
ASSERT
(
match_prefix
(
"$"
,
1
,
"x"
)
==
-
1
);
ASSERT
(
match_prefix
(
"*$"
,
2
,
"x"
)
==
1
);
ASSERT
(
match_prefix
(
"/$"
,
2
,
"/"
)
==
1
);
ASSERT
(
match_prefix
(
"**/$"
,
4
,
"/a/b/c"
)
==
-
1
);
ASSERT
(
match_prefix
(
"**/$"
,
4
,
"/a/b/"
)
==
5
);
ASSERT
(
match_prefix
(
"*"
,
1
,
"/hello/"
)
==
0
);
ASSERT
(
match_prefix
(
"**.a$|**.b$"
,
11
,
"/a/b.b/"
)
==
-
1
);
ASSERT
(
match_prefix
(
"**.a$|**.b$"
,
11
,
"/a/b.b"
)
==
6
);
ASSERT
(
match_prefix
(
"**.a$|**.b$"
,
11
,
"/a/B.A"
)
==
6
);
ASSERT
(
match_prefix
(
"**o$"
,
4
,
"HELLO"
)
==
5
);
ASSERT
(
m
g_m
atch_prefix
(
"/api"
,
4
,
"/api"
)
==
4
);
ASSERT
(
m
g_m
atch_prefix
(
"/a/"
,
3
,
"/a/b/c"
)
==
3
);
ASSERT
(
m
g_m
atch_prefix
(
"/a/"
,
3
,
"/ab/c"
)
==
-
1
);
ASSERT
(
m
g_m
atch_prefix
(
"/*/"
,
3
,
"/ab/c"
)
==
4
);
ASSERT
(
m
g_m
atch_prefix
(
"**"
,
2
,
"/a/b/c"
)
==
6
);
ASSERT
(
m
g_m
atch_prefix
(
"/*"
,
2
,
"/a/b/c"
)
==
2
);
ASSERT
(
m
g_m
atch_prefix
(
"*/*"
,
3
,
"/a/b/c"
)
==
2
);
ASSERT
(
m
g_m
atch_prefix
(
"**/"
,
3
,
"/a/b/c"
)
==
5
);
ASSERT
(
m
g_m
atch_prefix
(
"**.foo|**.bar"
,
13
,
"a.bar"
)
==
5
);
ASSERT
(
m
g_m
atch_prefix
(
"a|b|cd"
,
6
,
"cdef"
)
==
2
);
ASSERT
(
m
g_m
atch_prefix
(
"a|b|c?"
,
6
,
"cdef"
)
==
2
);
ASSERT
(
m
g_m
atch_prefix
(
"a|?|cd"
,
6
,
"cdef"
)
==
1
);
ASSERT
(
m
g_m
atch_prefix
(
"/a/**.cgi"
,
9
,
"/foo/bar/x.cgi"
)
==
-
1
);
ASSERT
(
m
g_m
atch_prefix
(
"/a/**.cgi"
,
9
,
"/a/bar/x.cgi"
)
==
12
);
ASSERT
(
m
g_m
atch_prefix
(
"**/"
,
3
,
"/a/b/c"
)
==
5
);
ASSERT
(
m
g_m
atch_prefix
(
"**/$"
,
4
,
"/a/b/c"
)
==
-
1
);
ASSERT
(
m
g_m
atch_prefix
(
"**/$"
,
4
,
"/a/b/"
)
==
5
);
ASSERT
(
m
g_m
atch_prefix
(
"$"
,
1
,
""
)
==
0
);
ASSERT
(
m
g_m
atch_prefix
(
"$"
,
1
,
"x"
)
==
-
1
);
ASSERT
(
m
g_m
atch_prefix
(
"*$"
,
2
,
"x"
)
==
1
);
ASSERT
(
m
g_m
atch_prefix
(
"/$"
,
2
,
"/"
)
==
1
);
ASSERT
(
m
g_m
atch_prefix
(
"**/$"
,
4
,
"/a/b/c"
)
==
-
1
);
ASSERT
(
m
g_m
atch_prefix
(
"**/$"
,
4
,
"/a/b/"
)
==
5
);
ASSERT
(
m
g_m
atch_prefix
(
"*"
,
1
,
"/hello/"
)
==
0
);
ASSERT
(
m
g_m
atch_prefix
(
"**.a$|**.b$"
,
11
,
"/a/b.b/"
)
==
-
1
);
ASSERT
(
m
g_m
atch_prefix
(
"**.a$|**.b$"
,
11
,
"/a/b.b"
)
==
6
);
ASSERT
(
m
g_m
atch_prefix
(
"**.a$|**.b$"
,
11
,
"/a/B.A"
)
==
6
);
ASSERT
(
m
g_m
atch_prefix
(
"**o$"
,
4
,
"HELLO"
)
==
5
);
return
NULL
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment