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
74b86375
Commit
74b86375
authored
14 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
#6109: Fix history manager unit tests
parent
fdca9599
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/history-sample.tpl
+5
-2
5 additions, 2 deletions
sflphone-common/test/history-sample.tpl
sflphone-common/test/historytest.cpp
+11
-10
11 additions, 10 deletions
sflphone-common/test/historytest.cpp
with
16 additions
and
12 deletions
sflphone-common/test/history-sample.tpl
+
5
−
2
View file @
74b86375
...
@@ -2,20 +2,23 @@
...
@@ -2,20 +2,23 @@
accountid=
accountid=
name=Savoir-faire Linux
name=Savoir-faire Linux
number=514-276-5468
number=514-276-5468
recordfile=
timestamp_stop=144562458
timestamp_stop=144562458
type=0
type=0
[747638685]
[747638685]
accountid=
Account:1239059899
accountid=
name=Emmanuel Milou
name=Emmanuel Milou
number=136
number=136
recordfile=
timestamp_stop=747638765
timestamp_stop=747638765
type=2
type=2
[775354456]
[775354456]
accountid=
Account:43789459478
accountid=
name=
name=
number=5143848557
number=5143848557
recordfile=
timestamp_stop=775354987
timestamp_stop=775354987
type=1
type=1
This diff is collapsed.
Click to expand it.
sflphone-common/test/historytest.cpp
+
11
−
10
View file @
74b86375
...
@@ -137,17 +137,18 @@ void HistoryTest::test_get_history_serialized()
...
@@ -137,17 +137,18 @@ void HistoryTest::test_get_history_serialized()
res
=
history
->
get_history_serialized
();
res
=
history
->
get_history_serialized
();
CPPUNIT_ASSERT
(
res
.
size
()
==
HISTORY_SAMPLE_SIZE
);
CPPUNIT_ASSERT
(
res
.
size
()
==
HISTORY_SAMPLE_SIZE
);
// Warning - If you change the history-sample file, you must change the following lines also so that the tests could work
// Warning - If you change the history-sample file, you must change the following lines also so that the tests could work
// The reference here is the file history-sample in this test directory
// The reference here is the file history-sample in this test directory
// The serialized form is: calltype%to%from%callid
// The serialized form is: calltype%to%from%callid
// Check the first
// Check the first
tmp
=
"0|514-276-5468|Savoir-faire Linux|144562458|empty"
;
tmp
=
"0|514-276-5468|Savoir-faire Linux|144562458|empty
|
"
;
std
::
cout
<<
res
[
"144562436"
]
<<
std
::
endl
;
std
::
cout
<<
res
[
"144562436"
]
<<
std
::
endl
;
CPPUNIT_ASSERT
(
Validator
::
isEqual
(
tmp
,
res
[
"144562436"
]));
CPPUNIT_ASSERT
(
Validator
::
isEqual
(
tmp
,
res
[
"144562436"
]));
// the account ID does not correspond to a loaded account
// the account ID does not correspond to a loaded account
tmp
=
"1|5143848557|empty|775354987|empty"
;
tmp
=
"1|5143848557|empty|775354987|empty
|
"
;
CPPUNIT_ASSERT
(
Validator
::
isEqual
(
tmp
,
res
[
"775354456"
]));
CPPUNIT_ASSERT
(
Validator
::
isEqual
(
tmp
,
res
[
"775354456"
]));
}
}
...
@@ -160,9 +161,9 @@ void HistoryTest::test_set_serialized_history()
...
@@ -160,9 +161,9 @@ void HistoryTest::test_set_serialized_history()
std
::
string
tmp
;
std
::
string
tmp
;
Conf
::
ConfigTree
history_list
;
Conf
::
ConfigTree
history_list
;
map_test
[
"144562436"
]
=
"0|514-276-5468|Savoir-faire Linux|144562458|empty"
;
map_test
[
"144562436"
]
=
"0|514-276-5468|Savoir-faire Linux|144562458|empty
|
"
;
map_test
[
"747638685"
]
=
"2|136|Emmanuel Milou|747638765|Account:1239059899"
;
map_test
[
"747638685"
]
=
"2|136|Emmanuel Milou|747638765|Account:1239059899
|
"
;
map_test
[
"775354456"
]
=
"1|5143848557|empty|775354987|Account:43789459478"
;
map_test
[
"775354456"
]
=
"1|5143848557|empty|775354987|Account:43789459478
|
"
;
CPPUNIT_ASSERT
(
history
->
load_history
(
HUGE_HISTORY_LIMIT
,
HISTORY_SAMPLE
)
==
HISTORY_SAMPLE_SIZE
);
CPPUNIT_ASSERT
(
history
->
load_history
(
HUGE_HISTORY_LIMIT
,
HISTORY_SAMPLE
)
==
HISTORY_SAMPLE_SIZE
);
// We use a large history limit to be able to interpret results
// We use a large history limit to be able to interpret results
...
@@ -174,11 +175,11 @@ void HistoryTest::test_set_serialized_history()
...
@@ -174,11 +175,11 @@ void HistoryTest::test_set_serialized_history()
CPPUNIT_ASSERT
(
map_test
.
size
()
==
3
);
CPPUNIT_ASSERT
(
map_test
.
size
()
==
3
);
// Check the first
// Check the first
tmp
=
"0|514-276-5468|Savoir-faire Linux|144562458|empty"
;
tmp
=
"0|514-276-5468|Savoir-faire Linux|144562458|empty
|
"
;
CPPUNIT_ASSERT
(
Validator
::
isEqual
(
tmp
,
map_test
[
"144562436"
]));
CPPUNIT_ASSERT
(
Validator
::
isEqual
(
tmp
,
map_test
[
"144562436"
]));
// the account ID does not correspond to a loaded account
// the account ID does not correspond to a loaded account
tmp
=
"1|5143848557|empty|775354987|empty"
;
tmp
=
"1|5143848557|empty|775354987|empty
|
"
;
CPPUNIT_ASSERT
(
Validator
::
isEqual
(
tmp
,
map_test
[
"775354456"
]));
CPPUNIT_ASSERT
(
Validator
::
isEqual
(
tmp
,
map_test
[
"775354456"
]));
history
->
save_history_items_map
(
&
history_list
);
history
->
save_history_items_map
(
&
history_list
);
...
@@ -202,11 +203,11 @@ void HistoryTest::test_set_serialized_history_with_limit()
...
@@ -202,11 +203,11 @@ void HistoryTest::test_set_serialized_history_with_limit()
current_3
<<
(
current
-
11
*
day
)
<<
std
::
endl
;
current_3
<<
(
current
-
11
*
day
)
<<
std
::
endl
;
map_test
[
current_1
.
str
()
]
map_test
[
current_1
.
str
()
]
=
"0|514-276-5468|Savoir-faire Linux|144562458|empty"
;
=
"0|514-276-5468|Savoir-faire Linux|144562458|empty
|
"
;
map_test
[
current_2
.
str
()
]
map_test
[
current_2
.
str
()
]
=
"2|136|Emmanuel Milou|747638765|Account:1239059899"
;
=
"2|136|Emmanuel Milou|747638765|Account:1239059899
|
"
;
map_test
[
current_3
.
str
()
]
map_test
[
current_3
.
str
()
]
=
"1|5143848557|empty|775354987|Account:43789459478"
;
=
"1|5143848557|empty|775354987|Account:43789459478
|
"
;
CPPUNIT_ASSERT
(
history
->
load_history
(
HUGE_HISTORY_LIMIT
,
HISTORY_SAMPLE
)
==
HISTORY_SAMPLE_SIZE
);
CPPUNIT_ASSERT
(
history
->
load_history
(
HUGE_HISTORY_LIMIT
,
HISTORY_SAMPLE
)
==
HISTORY_SAMPLE_SIZE
);
// We use different value of history limit
// We use different value of history limit
...
...
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