Macros | Typedefs | Functions
split_by_regex_test.cc File Reference
#include "boost/test/unit_test.hpp"
#include "cetlib/split_by_regex.h"
#include <string>
#include <vector>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (split_by_regex test)
 

Typedefs

using string_vector = std::vector< std::string >
 

Functions

 BOOST_AUTO_TEST_CASE (empty_string_test)
 
 BOOST_AUTO_TEST_CASE (a_string_test)
 
 BOOST_AUTO_TEST_CASE (a1_string_test)
 
 BOOST_AUTO_TEST_CASE (boo_string_test)
 
 BOOST_AUTO_TEST_CASE (ab_string_test)
 
 BOOST_AUTO_TEST_CASE (ab1_string_test)
 
 BOOST_AUTO_TEST_CASE (split_test_1)
 
 BOOST_AUTO_TEST_CASE (split_test_2)
 
 BOOST_AUTO_TEST_CASE (variable_subscript)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (split_by_regex test)

Definition at line 7 of file split_by_regex_test.cc.

Typedef Documentation

Definition at line 15 of file split_by_regex_test.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( empty_string_test  )

Definition at line 19 of file split_by_regex_test.cc.

20 {
21  string_vector const v = split_by_regex("", ":");
22  BOOST_TEST(v.size() == 1ul);
23 }
std::vector< std::string > split_by_regex(std::string const &str, std::regex const &reDelimSet)
std::vector< std::string > string_vector
BOOST_AUTO_TEST_CASE ( a_string_test  )

Definition at line 25 of file split_by_regex_test.cc.

26 {
27  string_vector const v = split_by_regex("a", ":");
28  BOOST_TEST(v.size() == 1ul);
29  BOOST_TEST(v[0] == "a");
30 }
std::vector< std::string > split_by_regex(std::string const &str, std::regex const &reDelimSet)
std::vector< std::string > string_vector
BOOST_AUTO_TEST_CASE ( a1_string_test  )

Definition at line 32 of file split_by_regex_test.cc.

33 {
34  string_vector const v = split_by_regex("a:", ":");
35  BOOST_TEST(v.size() == 1ul);
36  BOOST_TEST(v[0] == "a");
37 }
std::vector< std::string > split_by_regex(std::string const &str, std::regex const &reDelimSet)
std::vector< std::string > string_vector
BOOST_AUTO_TEST_CASE ( boo_string_test  )

Definition at line 39 of file split_by_regex_test.cc.

40 {
41  string_vector const v = split_by_regex(":boo", ":");
42  string_vector const expected{"", "boo"};
43  BOOST_TEST(v == expected);
44 }
const char expected[]
Definition: Exception_t.cc:22
std::vector< std::string > split_by_regex(std::string const &str, std::regex const &reDelimSet)
std::vector< std::string > string_vector
BOOST_AUTO_TEST_CASE ( ab_string_test  )

Definition at line 46 of file split_by_regex_test.cc.

47 {
48  string_vector const v = split_by_regex("a:b", ":");
49  string_vector const expected{"a", "b"};
50  BOOST_TEST(v == expected);
51 }
const char expected[]
Definition: Exception_t.cc:22
std::vector< std::string > split_by_regex(std::string const &str, std::regex const &reDelimSet)
std::vector< std::string > string_vector
BOOST_AUTO_TEST_CASE ( ab1_string_test  )

Definition at line 53 of file split_by_regex_test.cc.

54 {
55  string_vector const v = split_by_regex("a::b", ":");
56  string_vector const expected{"a", "", "b"};
57  BOOST_TEST(v == expected);
58 }
const char expected[]
Definition: Exception_t.cc:22
std::vector< std::string > split_by_regex(std::string const &str, std::regex const &reDelimSet)
std::vector< std::string > string_vector
BOOST_AUTO_TEST_CASE ( split_test_1  )

Definition at line 60 of file split_by_regex_test.cc.

61 {
62  string_vector const v = split_by_regex("abc:d:ef:", ":");
63  string_vector const expected{"abc", "d", "ef"};
64  BOOST_TEST(v == expected);
65 }
const char expected[]
Definition: Exception_t.cc:22
std::vector< std::string > split_by_regex(std::string const &str, std::regex const &reDelimSet)
std::vector< std::string > string_vector
BOOST_AUTO_TEST_CASE ( split_test_2  )

Definition at line 67 of file split_by_regex_test.cc.

68 {
69  string_vector const v = split_by_regex(
70  "namespace::class::static_function().value", R"((::|\(\)\.))");
71  string_vector const expected{
72  "namespace", "class", "static_function", "value"};
73  BOOST_TEST(v == expected);
74 }
const char expected[]
Definition: Exception_t.cc:22
std::vector< std::string > split_by_regex(std::string const &str, std::regex const &reDelimSet)
std::vector< std::string > string_vector
BOOST_AUTO_TEST_CASE ( variable_subscript  )

Definition at line 76 of file split_by_regex_test.cc.

77 {
78  string_vector const v = split_by_regex("v[0][1][2]", R"((\]\[|\[|\]))");
79  string_vector const expected{"v", "0", "1", "2"};
80  BOOST_TEST(v == expected);
81 }
const char expected[]
Definition: Exception_t.cc:22
std::vector< std::string > split_by_regex(std::string const &str, std::regex const &reDelimSet)
std::vector< std::string > string_vector