Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
c639abd7
Commit
c639abd7
authored
Mar 10, 2015
by
Hugo Beauzée-Luyssen
Committed by
Rémi Denis-Courmont
Mar 10, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add vlc_UrlParse tests
Signed-off-by:
Rémi Denis-Courmont
<
remi@remlab.net
>
parent
65b5f88f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
src/test/url.c
src/test/url.c
+26
-0
No files found.
src/test/url.c
View file @
c639abd7
...
...
@@ -87,6 +87,26 @@ static inline void test_current_directory_path (const char *in, const char *cwd,
test
(
make_URI_def
,
in
,
expected_result
);
}
static
void
test_url_parse
(
const
char
*
in
,
const
char
*
protocol
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
host
,
unsigned
i_port
,
const
char
*
path
,
const
char
*
option
)
{
#define CHECK( a, b ) assert(((a == NULL) && (b == NULL)) || !strcmp((a), (b)))
vlc_url_t
url
;
vlc_UrlParse
(
&
url
,
in
,
'?'
);
CHECK
(
url
.
psz_protocol
,
protocol
);
CHECK
(
url
.
psz_username
,
user
);
CHECK
(
url
.
psz_password
,
pass
);
CHECK
(
url
.
psz_host
,
host
);
CHECK
(
url
.
psz_path
,
path
);
assert
(
url
.
i_port
==
i_port
);
CHECK
(
url
.
psz_option
,
option
);
vlc_UrlClean
(
&
url
);
#undef CHECK
}
int
main
(
void
)
{
int
val
;
...
...
@@ -156,5 +176,11 @@ int main (void)
test
(
"fd://12345"
,
"/dev/fd/12345"
);
#undef test
test_url_parse
(
"http://test.com"
,
"http"
,
NULL
,
NULL
,
"test.com"
,
0
,
NULL
,
NULL
);
test_url_parse
(
"http://test.com/"
,
"http"
,
NULL
,
NULL
,
"test.com"
,
0
,
"/"
,
NULL
);
test_url_parse
(
"protocol://john:doe@1.2.3.4:567"
,
"protocol"
,
"john"
,
"doe"
,
"1.2.3.4"
,
567
,
NULL
,
NULL
);
test_url_parse
(
"http://a.b/?opt=val"
,
"http"
,
NULL
,
NULL
,
"a.b"
,
0
,
"/"
,
"opt=val"
);
test_url_parse
(
"p://u:p@host:123/a/b/c?o=v"
,
"p"
,
"u"
,
"p"
,
"host"
,
123
,
"/a/b/c"
,
"o=v"
);
return
0
;
}
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