Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
96f89675
Commit
96f89675
authored
Apr 01, 2015
by
Lukasz Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavu/dict: add more tests
Signed-off-by:
Lukasz Marek
<
lukasz.m.luki2@gmail.com
>
parent
a8c5b455
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
dict.c
libavutil/dict.c
+53
-0
No files found.
libavutil/dict.c
View file @
96f89675
...
...
@@ -276,6 +276,7 @@ static void test_separators(const AVDictionary *m, const char pair, const char v
int
main
(
void
)
{
AVDictionary
*
dict
=
NULL
;
AVDictionaryEntry
*
e
;
char
*
buffer
=
NULL
;
printf
(
"Testing av_dict_get_string() and av_dict_parse_string()
\n
"
);
...
...
@@ -303,6 +304,58 @@ int main(void)
test_separators
(
dict
,
'"'
,
'\''
);
av_dict_free
(
&
dict
);
printf
(
"
\n
Testing av_dict_set()
\n
"
);
av_dict_set
(
&
dict
,
"a"
,
"a"
,
0
);
av_dict_set
(
&
dict
,
"b"
,
av_strdup
(
"b"
),
AV_DICT_DONT_STRDUP_VAL
);
av_dict_set
(
&
dict
,
av_strdup
(
"c"
),
"c"
,
AV_DICT_DONT_STRDUP_KEY
);
av_dict_set
(
&
dict
,
av_strdup
(
"d"
),
av_strdup
(
"d"
),
AV_DICT_DONT_STRDUP_KEY
|
AV_DICT_DONT_STRDUP_VAL
);
av_dict_set
(
&
dict
,
"e"
,
"e"
,
AV_DICT_DONT_OVERWRITE
);
av_dict_set
(
&
dict
,
"e"
,
"f"
,
AV_DICT_DONT_OVERWRITE
);
av_dict_set
(
&
dict
,
"f"
,
"f"
,
0
);
av_dict_set
(
&
dict
,
"f"
,
NULL
,
0
);
av_dict_set
(
&
dict
,
"ff"
,
"f"
,
0
);
av_dict_set
(
&
dict
,
"ff"
,
"f"
,
AV_DICT_APPEND
);
e
=
NULL
;
while
((
e
=
av_dict_get
(
dict
,
""
,
e
,
AV_DICT_IGNORE_SUFFIX
)))
printf
(
"%s %s
\n
"
,
e
->
key
,
e
->
value
);
av_dict_free
(
&
dict
);
av_dict_set
(
&
dict
,
NULL
,
"a"
,
0
);
av_dict_set
(
&
dict
,
NULL
,
"b"
,
0
);
av_dict_get
(
dict
,
NULL
,
NULL
,
0
);
e
=
NULL
;
while
((
e
=
av_dict_get
(
dict
,
""
,
e
,
AV_DICT_IGNORE_SUFFIX
)))
printf
(
"'%s' '%s'
\n
"
,
e
->
key
,
e
->
value
);
av_dict_free
(
&
dict
);
//valgrind sensible test
printf
(
"
\n
Testing av_dict_set_int()
\n
"
);
av_dict_set_int
(
&
dict
,
"1"
,
1
,
AV_DICT_DONT_STRDUP_VAL
);
av_dict_set_int
(
&
dict
,
av_strdup
(
"2"
),
2
,
AV_DICT_DONT_STRDUP_KEY
);
av_dict_set_int
(
&
dict
,
av_strdup
(
"3"
),
3
,
AV_DICT_DONT_STRDUP_KEY
|
AV_DICT_DONT_STRDUP_VAL
);
av_dict_set_int
(
&
dict
,
"4"
,
4
,
0
);
av_dict_set_int
(
&
dict
,
"5"
,
5
,
AV_DICT_DONT_OVERWRITE
);
av_dict_set_int
(
&
dict
,
"5"
,
6
,
AV_DICT_DONT_OVERWRITE
);
av_dict_set_int
(
&
dict
,
"12"
,
1
,
0
);
av_dict_set_int
(
&
dict
,
"12"
,
2
,
AV_DICT_APPEND
);
e
=
NULL
;
while
((
e
=
av_dict_get
(
dict
,
""
,
e
,
AV_DICT_IGNORE_SUFFIX
)))
printf
(
"%s %s
\n
"
,
e
->
key
,
e
->
value
);
av_dict_free
(
&
dict
);
//valgrind sensible test
printf
(
"
\n
Testing av_dict_set() with existing AVDictionaryEntry.key as key
\n
"
);
av_dict_set
(
&
dict
,
"key"
,
"old"
,
0
);
e
=
av_dict_get
(
dict
,
"key"
,
NULL
,
0
);
av_dict_set
(
&
dict
,
e
->
key
,
"new val OK"
,
0
);
e
=
av_dict_get
(
dict
,
"key"
,
NULL
,
0
);
printf
(
"%s
\n
"
,
e
->
value
);
av_dict_set
(
&
dict
,
e
->
key
,
e
->
value
,
0
);
e
=
av_dict_get
(
dict
,
"key"
,
NULL
,
0
);
printf
(
"%s
\n
"
,
e
->
value
);
av_dict_free
(
&
dict
);
return
0
;
}
#endif
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