trim_test.cc
Go to the documentation of this file.
1 #define BOOST_TEST_MODULE (trim test)
2 
3 #include "boost/test/unit_test.hpp"
4 #include "cetlib/trim.h"
5 
6 using cet::trim;
7 using cet::trim_left;
8 using cet::trim_right;
9 
10 using cet::trim_copy;
13 
14 using std::string;
15 
16 BOOST_AUTO_TEST_SUITE(trim_test)
17 
18 BOOST_AUTO_TEST_CASE(trimmed_test)
19 {
20  string s1("Hello.");
21 
22  {
23  string s2(s1);
24  BOOST_TEST(trim_left(s2) == s1);
25  }
26  {
27  string s2(s1);
28  BOOST_TEST(trim_right(s2) == s1);
29  }
30  {
31  string s2(s1);
32  BOOST_TEST(trim(s2) == s1);
33  }
34 
35  {
36  string s2(s1);
37  BOOST_TEST(trim_left_copy(s2) == s1);
38  }
39  {
40  string s2(s1);
41  BOOST_TEST(trim_right_copy(s2) == s1);
42  }
43  {
44  string s2(s1);
45  BOOST_TEST(trim_copy(s2) == s1);
46  }
47 }
48 
49 BOOST_AUTO_TEST_SUITE_END()
static std::string trim(const std::string &str, const std::string &whitespace=" \t")
Definition: doxyindexer.cpp:47
std::string & trim(std::string &source, std::string const &t=" ")
Definition: trim.h:45
std::string string
Definition: nybbler.cc:12
std::string & trim_right(std::string &source, std::string const &t=" ")
Definition: trim.h:33
std::string trim_copy(std::string source, std::string const &t=" ")
Definition: trim.h:66
std::string trim_right_copy(std::string source, std::string const &t=" ")
Definition: trim.h:54
BOOST_AUTO_TEST_CASE(trimmed_test)
Definition: trim_test.cc:18
std::string & trim_left(std::string &source, std::string const &t=" ")
Definition: trim.h:39
std::string trim_left_copy(std::string source, std::string const &t=" ")
Definition: trim.h:60