Macros | Functions
lpad_test.cc File Reference
#include "boost/test/unit_test.hpp"
#include "cetlib/lpad.h"
#include <string>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (lpad test)
 

Functions

 BOOST_AUTO_TEST_CASE (dont_pad_test)
 
 BOOST_AUTO_TEST_CASE (do_pad_test)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (lpad test)

Definition at line 1 of file lpad_test.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( dont_pad_test  )

Definition at line 9 of file lpad_test.cc.

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 }
std::string string
Definition: nybbler.cc:12
std::string lpad(std::string const &pad_me, std::string::size_type wanted_size, char char_to_pad_with= ' ')
Definition: lpad.cc:10
BOOST_AUTO_TEST_CASE ( do_pad_test  )

Definition at line 26 of file lpad_test.cc.

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 }
std::string string
Definition: nybbler.cc:12
std::string lpad(std::string const &pad_me, std::string::size_type wanted_size, char char_to_pad_with= ' ')
Definition: lpad.cc:10