summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/experimental/filesystem/class.path
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/experimental/filesystem/class.path')
-rw-r--r--libcxx/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp35
-rw-r--r--libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp9
2 files changed, 10 insertions, 34 deletions
diff --git a/libcxx/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp b/libcxx/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp
index c5c46f68ac1..12330ebb5ca 100644
--- a/libcxx/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/class.path/path.itr/iterator.pass.cpp
@@ -24,8 +24,6 @@
#include <type_traits>
#include <cassert>
-#include <iostream>
-
#include "test_macros.h"
#include "filesystem_test_helper.hpp"
@@ -37,30 +35,6 @@ std::reverse_iterator<It> mkRev(It it) {
return std::reverse_iterator<It>(it);
}
-
-template <class Iter1, class Iter2>
-bool checkCollectionsEqualVerbose(
- Iter1 start1, Iter1 const end1
- , Iter2 start2, Iter2 const end2
- )
-{
- while (start1 != end1 && start2 != end2) {
- std::cout << "Got start1 = " << *start1 << "\n"
- << "Got start2 = " << *start2 << "\n";
- if (*start1 != *start2) {
- return false;
- }
- ++start1; ++start2;
- }
- if (start1 != end1) {
- std::cout << "Got start1 = " << *start1 << " but expected end1\n";
- }
- if (start2 != end2) {
- std::cout << "Got start2 = " << *start2 << " but expected end2\n";
- }
- return (start1 == end1 && start2 == end2);
-}
-
void checkIteratorConcepts() {
using namespace fs;
using It = path::iterator;
@@ -112,16 +86,15 @@ void checkBeginEndBasic() {
path p("//root_name//first_dir////second_dir");
const path expect[] = {"//root_name", "/", "first_dir", "second_dir"};
assert(checkCollectionsEqual(p.begin(), p.end(), std::begin(expect), std::end(expect)));
- assert(checkCollectionsEqualVerbose(mkRev(p.end()), mkRev(p.begin()),
- mkRev(std::end(expect)),
- mkRev(std::begin(expect))));
+ assert(checkCollectionsEqualBackwards(p.begin(), p.end(), std::begin(expect), std::end(expect)));
+
}
{
path p("////foo/bar/baz///");
const path expect[] = {"/", "foo", "bar", "baz", "."};
assert(checkCollectionsEqual(p.begin(), p.end(), std::begin(expect), std::end(expect)));
- assert(checkCollectionsEqual(mkRev(p.end()), mkRev(p.begin()),
- mkRev(std::end(expect)), mkRev(std::begin(expect))));
+ assert(checkCollectionsEqualBackwards(p.begin(), p.end(), std::begin(expect), std::end(expect)));
+
}
}
diff --git a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp
index a4039219d8c..e9832973500 100644
--- a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.native.obs/string_alloc.pass.cpp
@@ -30,7 +30,8 @@
namespace fs = std::experimental::filesystem;
-MultiStringType shortString = MKSTR("abc");
+// the SSO is always triggered for strings of size 2.
+MultiStringType shortString = MKSTR("a");
MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
template <class CharT>
@@ -43,8 +44,6 @@ void doShortStringTest(MultiStringType const& MS) {
const path p((const char*)MS);
{
DisableAllocationGuard g;
- if (!std::is_same<CharT, char>::value)
- g.release();
Str s = p.string<CharT>();
assert(s == value);
Str s2 = p.string<CharT>(Alloc{});
@@ -55,6 +54,7 @@ void doShortStringTest(MultiStringType const& MS) {
{
using Traits = std::char_traits<CharT>;
using AStr = std::basic_string<CharT, Traits, MAlloc>;
+ DisableAllocationGuard g;
AStr s = p.string<CharT, Traits, MAlloc>();
assert(s == value);
assert(MAlloc::alloc_count == 0);
@@ -64,6 +64,7 @@ void doShortStringTest(MultiStringType const& MS) {
{ // Other allocator - provided copy
using Traits = std::char_traits<CharT>;
using AStr = std::basic_string<CharT, Traits, MAlloc>;
+ DisableAllocationGuard g;
MAlloc a;
// don't allow another allocator to be default constructed.
MAlloc::disable_default_constructor = true;
@@ -94,6 +95,7 @@ void doLongStringTest(MultiStringType const& MS) {
{ // Other allocator - default construct
using Traits = std::char_traits<CharT>;
using AStr = std::basic_string<CharT, Traits, MAlloc>;
+ DisableAllocationGuard g;
AStr s = p.string<CharT, Traits, MAlloc>();
assert(s == value);
assert(MAlloc::alloc_count > 0);
@@ -103,6 +105,7 @@ void doLongStringTest(MultiStringType const& MS) {
{ // Other allocator - provided copy
using Traits = std::char_traits<CharT>;
using AStr = std::basic_string<CharT, Traits, MAlloc>;
+ DisableAllocationGuard g;
MAlloc a;
// don't allow another allocator to be default constructed.
MAlloc::disable_default_constructor = true;
OpenPOWER on IntegriCloud