diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-14 10:26:32 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-14 10:26:32 +0200 |
commit | 5b9b8d3dadf8471ff3a722fe714bd0900fc6c7ba (patch) | |
tree | 9bd7aa37f3ea121eb8f90e47d9b686c6455a35ea /tests/path | |
parent | 80b4ee65c55c896f12109c338ba9aa386b5719c6 (diff) |
Add path iterator range constructor
Diffstat (limited to 'tests/path')
-rw-r--r-- | tests/path/driver.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/path/driver.cxx b/tests/path/driver.cxx index c83fd12..302968d 100644 --- a/tests/path/driver.cxx +++ b/tests/path/driver.cxx @@ -112,12 +112,48 @@ main () assert (++i != p.end () && *i == "bar"); assert (++i == p.end ()); } +#ifndef _WIN32 { path p ("/"); path::iterator i (p.begin ()); assert (i != p.end () && *i == ""); assert (++i == p.end ()); } +#endif + + // iterator range construction + // + { + path p; + assert (path (p.begin (), p.end ()) == p); + } + { + path p ("foo"); + assert (path (p.begin (), p.end ()) == p); + assert (path (p.begin ()++, p.end ()) == path ()); + } + { + path p ("foo/bar"); + assert (path (p.begin (), p.end ()) == p); + assert (path (p.begin ()++, p.end ()) == path ("bar")); + assert (path (p.begin (), p.begin ()++) == path ("foo")); + } + { + path p ("/foo/bar"); + assert (path (p.begin (), p.end ()) == p); + assert (path (p.begin ()++, p.end ()) == path ("foo/bar")); + assert (path ((p.begin ()++)++, p.end ()) == path ("bar")); + assert (path (p.begin (), p.begin ()++) == path ("/")); + assert (path (p.begin ()++, (p.begin ()++)++) == path ("foo")); + assert (path ((p.begin ()++)++, ((p.begin ()++)++)++) == path ("bar")); + } +#ifndef _WIN32 + { + path p ("/"); + assert (path (p.begin (), p.end ()) == p); + assert (path (p.begin ()++, p.end ()) == path ()); + } +#endif // operator/ // |