Home | History | Annotate | Download | only in directory_iterator.members
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // UNSUPPORTED: c++98, c++03
     11 
     12 // <experimental/filesystem>
     13 
     14 // class directory_iterator
     15 
     16 // directory_iterator(directory_iterator const&);
     17 
     18 #include <experimental/filesystem>
     19 #include <type_traits>
     20 #include <set>
     21 #include <cassert>
     22 
     23 #include "test_macros.h"
     24 #include "rapid-cxx-test.hpp"
     25 #include "filesystem_test_helper.hpp"
     26 
     27 using namespace std::experimental::filesystem;
     28 
     29 TEST_SUITE(directory_iterator_copy_construct_tests)
     30 
     31 TEST_CASE(test_constructor_signature)
     32 {
     33     using D = directory_iterator;
     34     static_assert(std::is_copy_constructible<D>::value, "");
     35 }
     36 
     37 TEST_CASE(test_copy_end_iterator)
     38 {
     39     const directory_iterator endIt;
     40     directory_iterator it(endIt);
     41     TEST_CHECK(it == endIt);
     42 }
     43 
     44 TEST_CASE(test_copy_valid_iterator)
     45 {
     46     const path testDir = StaticEnv::Dir;
     47     const directory_iterator endIt{};
     48 
     49     const directory_iterator it(testDir);
     50     TEST_REQUIRE(it != endIt);
     51     const path entry = *it;
     52 
     53     const directory_iterator it2(it);
     54     TEST_REQUIRE(it2 == it);
     55     TEST_CHECK(*it2 == entry);
     56     TEST_CHECK(*it == entry);
     57 }
     58 
     59 TEST_SUITE_END()
     60