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