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 // bool status_known(file_status s) noexcept; 15 16 #include <experimental/filesystem> 17 #include <type_traits> 18 #include <cassert> 19 20 #include "test_macros.h" 21 #include "rapid-cxx-test.hpp" 22 #include "filesystem_test_helper.hpp" 23 24 using namespace std::experimental::filesystem; 25 26 TEST_SUITE(status_known_test_suite) 27 28 TEST_CASE(signature_test) 29 { 30 file_status s; ((void)s); 31 ASSERT_SAME_TYPE(decltype(status_known(s)), bool); 32 ASSERT_NOEXCEPT(status_known(s)); 33 } 34 35 TEST_CASE(status_known_test) 36 { 37 struct TestCase { 38 file_type type; 39 bool expect; 40 }; 41 const TestCase testCases[] = { 42 {file_type::none, false}, 43 {file_type::not_found, true}, 44 {file_type::regular, true}, 45 {file_type::directory, true}, 46 {file_type::symlink, true}, 47 {file_type::block, true}, 48 {file_type::character, true}, 49 {file_type::fifo, true}, 50 {file_type::socket, true}, 51 {file_type::unknown, true} 52 }; 53 for (auto& TC : testCases) { 54 file_status s(TC.type); 55 TEST_CHECK(status_known(s) == TC.expect); 56 } 57 } 58 59 TEST_SUITE_END() 60