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
e29933bc
Commit
e29933bc
authored
Nov 27, 2011
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a md5 computation test
parent
87636fed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
0 deletions
+69
-0
test/Makefile.am
test/Makefile.am
+3
-0
test/src/misc/md5.c
test/src/misc/md5.c
+66
-0
No files found.
test/Makefile.am
View file @
e29933bc
...
@@ -18,6 +18,7 @@ check_PROGRAMS = \
...
@@ -18,6 +18,7 @@ check_PROGRAMS = \
test_libvlc_media_list
\
test_libvlc_media_list
\
test_libvlc_media_player
\
test_libvlc_media_player
\
test_src_config_chain
\
test_src_config_chain
\
test_src_misc_md5
\
test_src_misc_variables
\
test_src_misc_variables
\
$(NULL)
$(NULL)
...
@@ -72,6 +73,8 @@ test_src_misc_variables_SOURCES = src/misc/variables.c
...
@@ -72,6 +73,8 @@ test_src_misc_variables_SOURCES = src/misc/variables.c
test_src_misc_variables_LDADD
=
$(LIBVLCCORE)
$(LIBVLC)
test_src_misc_variables_LDADD
=
$(LIBVLCCORE)
$(LIBVLC)
test_src_config_chain_SOURCES
=
src/config/chain.c
test_src_config_chain_SOURCES
=
src/config/chain.c
test_src_config_chain_LDADD
=
$(LIBVLCCORE)
test_src_config_chain_LDADD
=
$(LIBVLCCORE)
test_src_misc_md5_SOURCES
=
src/misc/md5.c
test_src_misc_md5_LDADD
=
$(LIBVLCCORE)
checkall
:
checkall
:
$(MAKE)
check_PROGRAMS
=
"
$(check_PROGRAMS)
$(EXTRA_PROGRAMS)
"
check
$(MAKE)
check_PROGRAMS
=
"
$(check_PROGRAMS)
$(EXTRA_PROGRAMS)
"
check
...
...
test/src/misc/md5.c
0 → 100644
View file @
e29933bc
/*****************************************************************************
* md5.c: test md5
*****************************************************************************
* Copyright (C) 2011 VideoLAN
* $Id$
*
* Authors: Jean-Bapstiste Kempf <jb@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <stdlib.h>
#include <string.h>
#include "../../libvlc/test.h"
#include <vlc_common.h>
#include <vlc_md5.h>
typedef
struct
{
const
char
*
psz_string
;
const
char
*
psz_md5
;
}
md5_sample_t
;
static
const
md5_sample_t
md5_samples
[]
=
{
{
"azertyuiop"
,
"7682fe272099ea26efe39c890b33675b"
},
{
NULL
,
NULL
}
};
static
void
test_config_StringEscape
()
{
for
(
int
i
=
0
;
md5_samples
[
i
].
psz_string
;
i
++
)
{
struct
md5_s
md5
;
InitMD5
(
&
md5
);
AddMD5
(
&
md5
,
md5_samples
[
i
].
psz_string
,
strlen
(
md5_samples
[
i
].
psz_string
)
);
EndMD5
(
&
md5
);
char
*
psz_hash
=
psz_md5_hash
(
&
md5
);
printf
(
"Output: %s, Expected: %s
\n
"
,
psz_hash
,
md5_samples
[
i
].
psz_md5
);
assert
(
!
strcmp
(
psz_hash
,
md5_samples
[
i
].
psz_md5
)
);
free
(
psz_hash
);
}
}
int
main
(
void
)
{
log
(
"Testing md5 calculation
\n
"
);
test_config_StringEscape
();
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