Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
f7eb2b69
Commit
f7eb2b69
authored
Jan 27, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test/test_icy_parser: unit test for IcyMetaDataParser.cxx
parent
da67260c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
0 deletions
+81
-0
Makefile.am
Makefile.am
+11
-0
test_icy_parser.cxx
test/test_icy_parser.cxx
+70
-0
No files found.
Makefile.am
View file @
f7eb2b69
...
...
@@ -1061,6 +1061,7 @@ C_TESTS = \
test
/test_util
\
test
/test_byte_reverse
\
test
/test_mixramp
\
test
/test_icy_parser
\
test
/test_pcm
\
test
/test_queue_priority
...
...
@@ -1496,6 +1497,16 @@ test_test_mixramp_LDADD = \
$(GLIB_LIBS)
\
$(CPPUNIT_LIBS)
test_test_icy_parser_SOURCES
=
\
src/Log.cxx
\
test
/test_icy_parser.cxx
test_test_icy_parser_CPPFLAGS
=
$(AM_CPPFLAGS)
$(CPPUNIT_CFLAGS)
-DCPPUNIT_HAVE_RTTI
=
0
test_test_icy_parser_CXXFLAGS
=
$(AM_CXXFLAGS)
-Wno-error
=
deprecated-declarations
test_test_icy_parser_LDADD
=
\
libtag.a
\
$(GLIB_LIBS)
\
$(CPPUNIT_LIBS)
test_test_pcm_SOURCES
=
\
test
/test_pcm_util.hxx
\
test
/test_pcm_dither.cxx
\
...
...
test/test_icy_parser.cxx
0 → 100644
View file @
f7eb2b69
/*
* Unit tests for class IcyMetaDataParser.
*/
#include "config.h"
/* include the .cxx file to get access to internal functions */
#include "IcyMetaDataParser.cxx"
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <string>
static
void
CompareTagTitle
(
const
Tag
&
tag
,
const
std
::
string
&
title
)
{
CPPUNIT_ASSERT_EQUAL
(
1u
,
tag
.
num_items
);
const
TagItem
&
item
=
*
tag
.
items
[
0
];
CPPUNIT_ASSERT_EQUAL
(
TAG_TITLE
,
item
.
type
);
CPPUNIT_ASSERT_EQUAL
(
title
,
std
::
string
(
item
.
value
));
}
static
void
TestIcyParserTitle
(
const
char
*
input
,
const
char
*
title
)
{
Tag
*
tag
=
icy_parse_tag
(
input
);
CompareTagTitle
(
*
tag
,
title
);
delete
tag
;
}
static
void
TestIcyParserEmpty
(
const
char
*
input
)
{
Tag
*
tag
=
icy_parse_tag
(
input
);
CPPUNIT_ASSERT_EQUAL
(
0u
,
tag
->
num_items
);
delete
tag
;
}
class
IcyTest
:
public
CppUnit
::
TestFixture
{
CPPUNIT_TEST_SUITE
(
IcyTest
);
CPPUNIT_TEST
(
TestIcyMetadataParser
);
CPPUNIT_TEST_SUITE_END
();
public
:
void
TestIcyMetadataParser
()
{
TestIcyParserEmpty
(
"foo=bar;"
);
TestIcyParserTitle
(
"StreamTitle='foo bar'"
,
"foo bar"
);
TestIcyParserTitle
(
"StreamTitle='foo bar';"
,
"foo bar"
);
TestIcyParserTitle
(
"StreamTitle='foo
\"
bar';"
,
"foo
\"
bar"
);
TestIcyParserTitle
(
"a=b;StreamTitle='foo';"
,
"foo"
);
TestIcyParserTitle
(
"a=;StreamTitle='foo';"
,
"foo"
);
TestIcyParserTitle
(
"a=b;StreamTitle='foo';c=d"
,
"foo"
);
TestIcyParserTitle
(
"a=b;StreamTitle='foo'"
,
"foo"
);
}
};
CPPUNIT_TEST_SUITE_REGISTRATION
(
IcyTest
);
int
main
(
gcc_unused
int
argc
,
gcc_unused
char
**
argv
)
{
CppUnit
::
TextUi
::
TestRunner
runner
;
auto
&
registry
=
CppUnit
::
TestFactoryRegistry
::
getRegistry
();
runner
.
addTest
(
registry
.
makeTest
());
return
runner
.
run
()
?
EXIT_SUCCESS
:
EXIT_FAILURE
;
}
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