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
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Timo Koch
dune-common
Commits
f100fed0
Commit
f100fed0
authored
9 years ago
by
Ansgar Burchardt
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for stringutility.hh
parent
f529d23f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/common/test/CMakeLists.txt
+4
-0
4 additions, 0 deletions
dune/common/test/CMakeLists.txt
dune/common/test/Makefile.am
+3
-0
3 additions, 0 deletions
dune/common/test/Makefile.am
dune/common/test/stringutilitytest.cc
+58
-0
58 additions, 0 deletions
dune/common/test/stringutilitytest.cc
with
65 additions
and
0 deletions
dune/common/test/CMakeLists.txt
+
4
−
0
View file @
f100fed0
...
...
@@ -31,6 +31,7 @@ set(TESTS
shared_ptrtest_config
singletontest
streamtest
stringutilitytest
testfloatcmp
tuplestest
tupleutilitytest
...
...
@@ -144,6 +145,9 @@ add_executable("sllisttest" EXCLUDE_FROM_ALL sllisttest.cc)
add_executable
(
"streamtest"
streamtest.cc
)
target_link_libraries
(
"streamtest"
"dunecommon"
)
add_executable
(
"stringutilitytest"
stringutilitytest.cc
)
target_link_libraries
(
"stringutilitytest"
"dunecommon"
)
add_executable
(
"testdebugallocator"
testdebugallocator.cc
)
target_link_libraries
(
testdebugallocator dunecommon
)
add_executable
(
"testdebugallocator_fail1"
testdebugallocator.cc
)
...
...
This diff is collapsed.
Click to expand it.
dune/common/test/Makefile.am
+
3
−
0
View file @
f100fed0
...
...
@@ -32,6 +32,7 @@ TESTPROGS = \
shared_ptrtest_config
\
singletontest
\
streamtest
\
stringutilitytest
\
testdebugallocator
\
testdebugallocator_fail1
\
testdebugallocator_fail2
\
...
...
@@ -176,6 +177,8 @@ sourcescheck_NOSOURCES = timing.cc
streamtest_SOURCES
=
streamtest.cc
stringutilitytest_SOURCES
=
stringutilitytest.cc
testdebugallocator_SOURCES
=
testdebugallocator.cc
testdebugallocator_CPPFLAGS
=
$(
AM_CPPFLAGS
)
...
...
This diff is collapsed.
Click to expand it.
dune/common/test/stringutilitytest.cc
0 → 100644
+
58
−
0
View file @
f100fed0
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include
<string>
#include
<dune/common/stringutility.hh>
namespace
{
const
std
::
string
hello_world
(
"hello world"
);
}
/* namespace */
bool
test_hasPrefix
()
{
bool
pass
=
true
;
using
Dune
::
hasPrefix
;
pass
&=
hasPrefix
(
hello_world
,
"hello"
);
pass
&=
!
hasPrefix
(
hello_world
,
"world"
);
return
pass
;
}
bool
test_hasSuffix
()
{
bool
pass
=
true
;
using
Dune
::
hasSuffix
;
pass
&=
hasSuffix
(
hello_world
,
"world"
);
pass
&=
!
hasSuffix
(
hello_world
,
"hello"
);
return
pass
;
}
bool
test_formatString
()
{
bool
pass
=
true
;
const
int
one
=
1
;
const
static
std
::
string
format
(
"hello %i"
);
const
static
std
::
string
expected
(
"hello 1"
);
using
Dune
::
formatString
;
const
std
::
string
s
=
formatString
(
format
,
one
);
pass
&=
(
s
==
expected
);
return
pass
;
}
int
main
()
{
bool
pass
=
true
;
pass
&=
test_hasPrefix
();
pass
&=
test_hasSuffix
();
pass
&=
test_formatString
();
return
pass
?
0
:
1
;
}
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