Functions
split_path_test.cc File Reference
#include "cetlib/split_path.h"
#include <cassert>

Go to the source code of this file.

Functions

void test_empty_path ()
 
void test_single_entry_path ()
 
void test_adjacent_colons ()
 
void test_leading_colon ()
 
void test_trailing_colon ()
 
void test_typical_use ()
 
int main ()
 

Function Documentation

int main ( void  )

Definition at line 82 of file split_path_test.cc.

83 {
90 }
void test_leading_colon()
void test_empty_path()
void test_typical_use()
void test_trailing_colon()
void test_single_entry_path()
void test_adjacent_colons()
void test_adjacent_colons ( )

Definition at line 27 of file split_path_test.cc.

28 {
29  vector<string> results;
30  string path("A::B");
31  split_path(path, results);
32  assert(results.size() == 3);
33  assert(results[0] == "A");
34  assert(results[1] == "");
35  assert(results[2] == "B");
36 }
void test_empty_path ( )

Definition at line 9 of file split_path_test.cc.

10 {
11  vector<string> results;
12  split_path("", results);
13  assert(results.empty());
14 }
void test_leading_colon ( )

Definition at line 39 of file split_path_test.cc.

40 {
41  vector<string> results;
42  string path(":BOO");
43  split_path(path, results);
44  assert(results.size() == 2);
45  assert(results[0].empty());
46  assert(results[1] == "BOO");
47 }
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
void test_single_entry_path ( )

Definition at line 17 of file split_path_test.cc.

18 {
19  vector<string> results;
20  string sole_entry("ABC_D/EFG/H");
21  split_path(sole_entry, results);
22  assert(results.size() == 1);
23  assert(results[0] == sole_entry);
24 }
void test_trailing_colon ( )

Definition at line 50 of file split_path_test.cc.

51 {
52  vector<string> results;
53  string path("A:");
54  split_path(path, results);
55  assert(results.size() == 2);
56  assert(results[0] == "A");
57  assert(results[1].empty());
58 }
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
void test_typical_use ( )

Definition at line 61 of file split_path_test.cc.

62 {
63  vector<string> results;
64  vector<string> path_elements;
65  path_elements.push_back("/p/gcc/v4_5_1/Linux64/lib64");
66  path_elements.push_back("/p/gcc/v4_5_1/Linux64/lib");
67  path_elements.push_back("/p/root/v5_26_00d/lib");
68  path_elements.push_back("/p/cmake/v2_6_4/.");
69  path_elements.push_back("/p/cppunit/v1_12_1/slf5.x86_64.a1/lib");
70  string path = path_elements[0];
71  for (size_t i = 1; i < path_elements.size(); ++i) {
72  path += ":";
73  path += path_elements[i];
74  }
75 
76  // Now do the test
77  split_path(path, results);
78  assert(results == path_elements);
79 }