| 97 | } |
| 98 | |
| 99 | void testPathMatcherIteratorPrune() |
| 100 | { |
| 101 | vector<InternedString> root; |
| 102 | vector<InternedString> abc = { "a", "b", "c" }; |
| 103 | |
| 104 | // Prune an empty iterator range. |
| 105 | PathMatcher m; |
| 106 | PathMatcher::Iterator it = m.begin(); |
| 107 | IECORETEST_ASSERT( it == m.end() ); |
| 108 | it.prune(); |
| 109 | IECORETEST_ASSERT( it == m.end() ); |
| 110 | |
| 111 | // Prune the root iterator itself. |
| 112 | m.addPath( root ); |
| 113 | it = m.begin(); |
| 114 | IECORETEST_ASSERT( *it == root ); |
| 115 | IECORETEST_ASSERT( it != m.end() ); |
| 116 | it.prune(); |
| 117 | IECORETEST_ASSERT( *it == root ); |
| 118 | IECORETEST_ASSERT( it != m.end() ); |
| 119 | ++it; |
| 120 | IECORETEST_ASSERT( it == m.end() ); |
| 121 | |
| 122 | // As above, but actually with some |
| 123 | // descendants to be pruned. |
| 124 | m.addPath( abc ); |
| 125 | it = m.begin(); |
| 126 | IECORETEST_ASSERT( *it == root ); |
| 127 | IECORETEST_ASSERT( it != m.end() ); |
| 128 | it.prune(); |
| 129 | IECORETEST_ASSERT( *it == root ); |
| 130 | IECORETEST_ASSERT( it != m.end() ); |
| 131 | ++it; |
| 132 | IECORETEST_ASSERT( it == m.end() ); |
| 133 | |
| 134 | } |
| 135 | |
| 136 | void testPathMatcherFind() |
| 137 | { |