MCPcopy Create free account
hub / github.com/boostorg/filesystem / cpp_main

Function cpp_main

test/operations_test.cpp:2930–3071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2928//------------------------------------------------------------------------------------//
2929
2930int cpp_main(int argc, char* argv[])
2931{
2932// document state of critical macros
2933#ifdef BOOST_FILESYSTEM_POSIX_API
2934 cout << "BOOST_FILESYSTEM_POSIX_API is defined\n";
2935#endif
2936#ifdef BOOST_FILESYSTEM_WINDOWS_API
2937 cout << "BOOST_FILESYSTEM_WINDOWS_API is defined\n";
2938#endif
2939
2940 for (; argc > 1; --argc, ++argv)
2941 {
2942 if (*argv[1] == '-' && *(argv[1] + 1) == 't')
2943 report_throws = true;
2944 else if (*argv[1] == '-' && *(argv[1] + 1) == 'x')
2945 cleanup = false;
2946 else if (*argv[1] == '-' && *(argv[1] + 1) == 'w')
2947 skip_long_windows_tests = true;
2948 }
2949
2950 // The choice of platform to test is made at runtime rather than compile-time
2951 // so that compile errors for all platforms will be detected even though
2952 // only the current platform is runtime tested.
2953#if defined(BOOST_FILESYSTEM_POSIX_API)
2954 platform = "POSIX";
2955#elif defined(BOOST_FILESYSTEM_WINDOWS_API)
2956 platform = "Windows";
2957#else
2958#error neither BOOST_FILESYSTEM_POSIX_API nor BOOST_FILESYSTEM_WINDOWS_API is defined. See boost/system/api_config.hpp
2959#endif
2960 cout << "API is " << platform << endl;
2961 const fs::path ip = fs::initial_path();
2962 cout << "initial_path() is " << ip << endl;
2963 do_the_right_thing_tests(); // compile-only tests, but call anyhow to suppress warnings
2964
2965 for (fs::path::const_iterator it = ip.begin(); it != ip.end(); ++it)
2966 {
2967 if (it != ip.begin())
2968 cout << ", ";
2969 cout << *it;
2970 }
2971 cout << endl;
2972
2973 // Note: Use cacnonical form of the root path in all subsequent paths to make path comparisons more stable
2974 dir = canonicalize_root_path(ip / temp_dir);
2975
2976 if (fs::exists(dir))
2977 {
2978 cout << "remove residue from prior failed tests..." << endl;
2979 fs::remove_all(dir);
2980 }
2981 BOOST_TEST(!fs::exists(dir));
2982
2983 // several functions give unreasonable results if uintmax_t isn't 64-bits
2984 cout << "sizeof(boost::uintmax_t) = " << sizeof(boost::uintmax_t) << '\n';
2985 BOOST_TEST(sizeof(boost::uintmax_t) >= 8);
2986
2987 initial_tests();

Callers

nothing calls this directly

Calls 15

do_the_right_thing_testsFunction · 0.85
initial_testsFunction · 0.85
create_directory_testsFunction · 0.85
current_directory_testsFunction · 0.85
space_testsFunction · 0.85
directory_iterator_testsFunction · 0.85
create_directories_testsFunction · 0.85
equivalent_testsFunction · 0.85
create_hard_link_testsFunction · 0.85

Tested by

no test coverage detected