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
8549e2b0
Commit
8549e2b0
authored
Apr 11, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additionnal unit test for decode_URI
parent
55687512
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
20 deletions
+35
-20
src/test/url.c
src/test/url.c
+35
-20
No files found.
src/test/url.c
View file @
8549e2b0
...
...
@@ -22,29 +22,44 @@
#include <vlc/vlc.h>
#include "vlc_url.h"
#undef NDEBUG
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
void
test_decode
(
const
char
*
in
,
const
char
*
out
)
{
char
*
res
;
printf
(
"
\"
%s
\"
->
\"
%s
\"
?
\n
"
,
in
,
out
);
res
=
decode_URI_duplicate
(
in
);
if
(
res
==
NULL
)
exit
(
1
);
if
(
strcmp
(
res
,
out
))
exit
(
2
);
free
(
res
);
}
int
main
(
void
)
{
const
char
url1
[]
=
"this_should_not_be_modified_1234"
;
const
char
url2
[]
=
"This+should+be+modified+1234!"
;
const
char
url3
[]
=
"This%20should%20be%20modified%201234!"
;
char
*
durl
=
decode_URI_duplicate
(
url1
);
assert
(
durl
!=
NULL
);
assert
(
!
strcmp
(
durl
,
url1
));
free
(
durl
);
durl
=
decode_URI_duplicate
(
url2
);
assert
(
durl
!=
NULL
);
assert
(
!
strcmp
(
durl
,
"This should be modified 1234!"
)
);
free
(
durl
);
durl
=
decode_URI_duplicate
(
url3
);
assert
(
durl
!=
NULL
);
assert
(
!
strcmp
(
durl
,
"This should be modified 1234!"
)
);
free
(
durl
);
(
void
)
setvbuf
(
stdout
,
NULL
,
_IONBF
,
0
)
;
test_decode
(
"this_should_not_be_modified_1234"
,
"this_should_not_be_modified_1234"
)
;
test_decode
(
"This+should+be+modified+1234!"
,
"This should be modified 1234!"
);
test_decode
(
"This%20should%20be%20modified%201234!"
,
"This should be modified 1234!"
);
/* tests with invalid input */
test_decode
(
"%"
,
"%"
);
test_decode
(
"%2"
,
"%2"
);
test_decode
(
"%0000"
,
""
);
/* UTF-8 tests */
test_decode
(
"T%C3%a9l%c3%A9vision"
,
"Télévision"
);
test_decode
(
"T%E9l%E9vision"
,
"T?l?vision"
);
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