// // Copyright (c) 2020 Alexander Grund // // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include #include #include #include "test.hpp" #include #include #ifdef __has_include #if __has_include() #include #endif #endif #ifdef __cpp_lib_string_view #include #define BOOST_NOWIDE_TEST_STD_STRINGVIEW #endif // Exclude apple as support there is target level specific -.- #if defined(__cpp_lib_filesystem) && !defined(__APPLE__) #include #define BOOST_NOWIDE_TEST_STD_PATH #endif #if defined(__cpp_lib_experimental_filesystem) #ifndef _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #endif #include #define BOOST_NOWIDE_TEST_STD_EXPERIMENTAL_PATH #endif #ifdef BOOST_NOWIDE_TEST_BFS_PATH #if defined(__GNUC__) && __GNUC__ >= 7 #pragma GCC diagnostic ignored "-Wattributes" #endif #if defined(_MSC_VER) #pragma warning(disable : 4714) // function marked as __forceinline not inlined #endif #include #endif template struct has_open : std::false_type {}; using boost::nowide::detail::void_t; template struct has_open().open(std::declval(), std::ios_base::openmode{}))>> : std::true_type {}; using boost::nowide::detail::is_string_container; static_assert(is_string_container::value, "!"); static_assert(is_string_container::value, "!"); static_assert(is_string_container::value, "!"); static_assert(is_string_container::value, "!"); static_assert(!is_string_container::value, "!"); static_assert(!is_string_container::value, "!"); using boost::nowide::detail::get_data_width; static_assert(get_data_width::value == sizeof(char), "!"); static_assert(get_data_width::value == sizeof(wchar_t), "!"); static_assert(get_data_width::value == sizeof(char16_t), "!"); static_assert(get_data_width::value == sizeof(char32_t), "!"); // coverity[root_function] void test_main(int, char**, char**) { #ifdef BOOST_NOWIDE_TEST_STD_STRINGVIEW std::cout << "Testing string_view" << std::endl; static_assert(is_string_container::value, "!"); static_assert(is_string_container::value, "!"); static_assert(is_string_container::value, "!"); static_assert(is_string_container::value, "!"); #endif #ifdef BOOST_NOWIDE_TEST_STD_PATH std::cout << "Testing std::filesystem::path" << std::endl; using fs_path = std::filesystem::path; static_assert(boost::nowide::detail::is_path::value, "!"); #if BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT static_assert(has_open::value, "!"); #endif static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); #endif #ifdef BOOST_NOWIDE_TEST_STD_EXPERIMENTAL_PATH std::cout << "Testing std::experimental::filesystem::path" << std::endl; using exfs_path = std::experimental::filesystem::path; static_assert(boost::nowide::detail::is_path::value, "!"); #if BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT static_assert(has_open::value, "!"); #endif static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); #endif #ifdef BOOST_NOWIDE_TEST_BFS_PATH std::cout << "Testing boost::filesystem::path" << std::endl; using bfs_path = boost::filesystem::path; static_assert(boost::nowide::detail::is_path::value, "!"); #if BOOST_NOWIDE_USE_FILEBUF_REPLACEMENT static_assert(has_open::value, "!"); #endif static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(has_open::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); static_assert(std::is_constructible::value, "!"); #endif }