Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Tobias Leibner
dune-common
Commits
9c74a9e3
Commit
9c74a9e3
authored
19 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Added test for additional functionality.
[[Imported from SVN: r1806]]
parent
e884fae0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/test/iteratortest.hh
+8
-1
8 additions, 1 deletion
common/test/iteratortest.hh
common/test/sllisttest.cc
+52
-1
52 additions, 1 deletion
common/test/sllisttest.cc
with
60 additions
and
2 deletions
common/test/iteratortest.hh
+
8
−
1
View file @
9c74a9e3
...
...
@@ -17,10 +17,17 @@ template<class Iter, class Opt>
int
testForwardIterator
(
Iter
begin
,
Iter
end
,
Opt
&
opt
)
{
//std::cout<< "forward: ";
Iter
tmp
=
begin
,
tmp1
(
begin
);
int
ret
=
0
;
if
(
tmp
!=
begin
||
tmp1
!=
begin
||
tmp
!=
tmp1
)
{
std
::
cerr
<<
" Copying iterator failed "
<<
__FILE__
<<
":"
<<
__LINE__
<<
std
::
endl
;
ret
=
1
;
}
for
(;
begin
!=
end
;
++
begin
)
opt
(
*
begin
);
//std::cout<< " OK "<<std::endl;
return
0
;
return
ret
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
common/test/sllisttest.cc
+
52
−
1
View file @
9c74a9e3
...
...
@@ -50,6 +50,41 @@ void randomizeListFront(Dune::SLList<T,A>& alist){
alist
.
push_back
((
range
*
(
rand
()
/
(
RAND_MAX
+
1.0
))));
}
int
testDeleteNext
()
{
typedef
Dune
::
SLList
<
int
,
Dune
::
PoolAllocator
<
int
,
8
*
1024
-
16
>
>
List
;
List
alist
;
alist
.
push_back
(
3
);
alist
.
push_back
(
4
);
alist
.
push_back
(
5
);
List
::
iterator
iter
=
alist
.
oneBeforeBegin
();
iter
.
deleteNext
();
List
::
iterator
iter1
=
iter
;
++
iter1
;
if
(
*
(
alist
.
begin
())
!=
4
)
{
std
::
cerr
<<
"delete next on position before head failed!"
<<
std
::
endl
;
return
1
;
}
if
(
*
iter1
!=
4
)
{
std
::
cerr
<<
"delete next failed"
<<
std
::
endl
;
return
1
;
}
++
iter
;
iter
.
deleteNext
();
++
iter
;
if
(
iter
!=
alist
.
end
())
{
std
::
cerr
<<
"delete next faild"
<<
std
::
endl
;
return
1
;
}
if
(
*
(
alist
.
tail
())
!=
4
)
{
std
::
cerr
<<
"delete before tail did not change tail!"
<<
std
::
endl
;
}
return
0
;
}
int
testInsertAfter
()
{
typedef
Dune
::
SLList
<
int
,
Dune
::
PoolAllocator
<
int
,
8
*
1024
-
16
>
>
List
;
...
...
@@ -77,6 +112,22 @@ int testInsertAfter()
std
::
cerr
<<
"Insertion failed!"
<<
std
::
endl
;
++
ret
;
}
if
(
*
(
alist
.
begin
())
!=
5
)
{
std
::
cerr
<<
"Insert after at onebeforeBegin did not change head!"
<<
std
::
endl
;
++
ret
;
}
iter
=
alist
.
tail
();
iter
.
insertAfter
(
20
);
++
iter
;
if
(
iter
==
alist
.
end
()
||
*
iter
!=
20
)
{
std
::
cerr
<<
"Insertion failed!"
<<
std
::
endl
;
++
ret
;
}
if
(
*
(
alist
.
tail
())
!=
20
)
{
std
::
cerr
<<
"tail was not changed!!"
<<
std
::
endl
;
++
ret
;
}
alist
.
clear
();
iter
=
alist
.
oneBeforeBegin
();
...
...
@@ -167,7 +218,7 @@ int main()
ret
+=
testPushPop
();
ret
+=
testOneBeforeBegin
(
list1
);
ret
+=
testInsertAfter
();
ret
+=
testDeleteNext
();
list
.
clear
();
list1
.
clear
();
...
...
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