Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
50b3798b
Commit
50b3798b
authored
14 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
[#3647] Unit test the yaml parser
parent
3fd35272
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
sflphone-common/test/configurationtest.cpp
+62
-3
62 additions, 3 deletions
sflphone-common/test/configurationtest.cpp
sflphone-common/test/configurationtest.h
+10
-6
10 additions, 6 deletions
sflphone-common/test/configurationtest.h
with
72 additions
and
9 deletions
sflphone-common/test/configurationtest.cpp
100644 → 100755
+
62
−
3
View file @
50b3798b
...
...
@@ -154,9 +154,68 @@ void ConfigurationTest::testInitAudioDriver() {
void
ConfigurationTest
::
testYamlParser
()
{
YamlParser
*
parser
=
new
YamlParser
();
Conf
::
YamlParser
*
parser
;
try
{
parser
=
new
Conf
::
YamlParser
(
"sequence.yml"
);
}
catch
(
Conf
::
YamlParserException
&
e
)
{
_error
(
"ConfigTree: %s"
,
e
.
what
());
}
try
{
parser
->
serializeEvents
();
}
catch
(
Conf
::
YamlParserException
&
e
)
{
_error
(
"ConfigTree: %s"
,
e
.
what
());
}
try
{
parser
->
composeEvents
();
}
catch
(
Conf
::
YamlParserException
&
e
)
{
_error
(
"ConfigTree: %s"
,
e
.
what
());
}
try
{
delete
parser
;
parser
=
NULL
;
}
catch
(
Conf
::
YamlParserException
&
e
)
{
_error
(
"ConfigTree: %s"
,
e
.
what
());
}
}
void
ConfigurationTest
::
testYamlComposition
()
{
Conf
::
SequenceNode
*
seq
=
new
Conf
::
SequenceNode
();
Conf
::
MappingNode
*
map
=
new
Conf
::
MappingNode
();
Conf
::
ScalarNode
*
sclr
=
new
Conf
::
ScalarNode
();
CPPUNIT_ASSERT
(
seq
->
getType
()
==
Conf
::
SEQUENCE
);
CPPUNIT_ASSERT
(
map
->
getType
()
==
Conf
::
MAPPING
);
CPPUNIT_ASSERT
(
sclr
->
getType
()
==
Conf
::
SCALAR
);
seq
->
addNode
(
map
);
seq
->
addNode
(
sclr
);
Conf
::
Key
key
(
"username"
);
Conf
::
ScalarNode
*
val
=
new
Conf
::
ScalarNode
(
"alexandre"
);
map
->
setKeyValue
(
key
,
val
);
Conf
::
YamlNode
*
node
=
map
->
getValue
(
key
);
CPPUNIT_ASSERT
(
node
->
getType
()
==
Conf
::
SCALAR
);
delete
val
;
delete
seq
;
delete
map
;
delete
sclr
;
}
This diff is collapsed.
Click to expand it.
sflphone-common/test/configurationtest.h
100644 → 100755
+
10
−
6
View file @
50b3798b
...
...
@@ -51,6 +51,7 @@
#include
"global.h"
#include
"user_cfg.h"
#include
"config/yamlparser.h"
#include
"config/yamlnode.h"
class
ConfigurationTest
:
public
CppUnit
::
TestFixture
{
...
...
@@ -58,12 +59,13 @@ class ConfigurationTest: public CppUnit::TestFixture {
* Use cppunit library macros to add unit test the factory
*/
CPPUNIT_TEST_SUITE
(
ConfigurationTest
);
CPPUNIT_TEST
(
testInitVolume
);
CPPUNIT_TEST
(
testDefaultValueAudio
);
CPPUNIT_TEST
(
testDefaultValuePreferences
);
CPPUNIT_TEST
(
testDefaultValueSignalisation
);
CPPUNIT_TEST
(
testInitAudioDriver
);
//
CPPUNIT_TEST( testInitVolume );
//
CPPUNIT_TEST( testDefaultValueAudio );
//
CPPUNIT_TEST( testDefaultValuePreferences );
//
CPPUNIT_TEST( testDefaultValueSignalisation );
//
CPPUNIT_TEST( testInitAudioDriver );
CPPUNIT_TEST
(
testYamlParser
);
CPPUNIT_TEST
(
testYamlComposition
);
CPPUNIT_TEST_SUITE_END
();
public:
...
...
@@ -95,6 +97,8 @@ public:
void
testInitAudioDriver
();
void
testYamlParser
();
void
testYamlComposition
();
};
/* Register our test module */
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
ConfigurationTest
,
"ConfigurationTest"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment