Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
cetlib
cetlib
test
rpad_test.cc
Go to the documentation of this file.
1
#define BOOST_TEST_MODULE (rpad test)
2
3
#include "boost/test/unit_test.hpp"
4
#include "
cetlib/rpad.h
"
5
#include <string>
6
7
BOOST_AUTO_TEST_SUITE(rpad_test)
8
9
BOOST_AUTO_TEST_CASE
(dont_pad_test)
10
{
11
std::string
const
s0(
"abc"
);
12
13
std::string
s1 =
cet::rpad
(s0, 0,
'*'
);
14
BOOST_TEST(s1 == s0);
15
16
std::string
s2 =
cet::rpad
(s0, 1,
'*'
);
17
BOOST_TEST(s2 == s0);
18
19
std::string
s3 =
cet::rpad
(s0, 2,
'*'
);
20
BOOST_TEST(s3 == s0);
21
22
std::string
s4 =
cet::rpad
(s0, 3,
'*'
);
23
BOOST_TEST(s4 == s0);
24
}
25
26
BOOST_AUTO_TEST_CASE
(do_pad_test)
27
{
28
std::string
const
s0(
"abc"
);
29
30
std::string
s1 =
cet::rpad
(s0, 4);
31
BOOST_TEST(s1 == s0 +
' '
);
32
33
std::string
s2 =
cet::rpad
(s0, 5,
'*'
);
34
BOOST_TEST(s2 == s0 +
std::string
(2,
'*'
));
35
}
36
37
BOOST_AUTO_TEST_SUITE_END()
string
std::string string
Definition:
nybbler.cc:12
cet::rpad
std::string rpad(std::string const &pad_me, std::string::size_type wanted_size, char char_to_pad_with= ' ')
Definition:
rpad.cc:10
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(dont_pad_test)
Definition:
rpad_test.cc:9
rpad.h
Generated by
1.8.11