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

Function cpp_main

test/operations_unit_test.cpp:343–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341//--------------------------------------------------------------------------------------//
342
343int cpp_main(int argc, char* argv[])
344{
345// document state of critical macros
346#ifdef BOOST_FILESYSTEM_POSIX_API
347 cout << "BOOST_FILESYSTEM_POSIX_API is defined\n";
348#endif
349#ifdef BOOST_FILESYSTEM_WINDOWS_API
350 cout << "BOOST_FILESYSTEM_WINDOWS_API is defined\n";
351#endif
352 cout << "BOOST_FILESYSTEM_DECL" << BOOST_STRINGIZE(=BOOST_FILESYSTEM_DECL) << "\n";
353 cout << "BOOST_SYMBOL_VISIBLE" << BOOST_STRINGIZE(=BOOST_SYMBOL_VISIBLE) << "\n";
354
355 cout << "current_path() is " << current_path().string() << endl;
356
357 if (argc >= 2)
358 {
359 cout << "argv[1] is '" << argv[1] << "', changing current_path() to it" << endl;
360
361 error_code ec;
362 current_path(argv[1], ec);
363
364 if (ec)
365 {
366 cout << "current_path('" << argv[1] << "') failed: " << ec << ": " << ec.message() << endl;
367 }
368
369 cout << "current_path() is " << current_path().string() << endl;
370 }
371
372 const path temp_dir(current_path() / ".." / unique_path("op-unit_test-%%%%-%%%%-%%%%"));
373 cout << "temp_dir is " << temp_dir.string() << endl;
374
375 create_directory(temp_dir);
376
377 file_status_test();
378 query_test();
379 directory_iterator_test();
380 recursive_directory_iterator_test();
381 operations_test();
382 directory_entry_test(temp_dir);
383 directory_entry_overload_test();
384 error_handling_test();
385
386 cout << unique_path() << endl;
387 cout << unique_path("foo-%%%%%-%%%%%-bar") << endl;
388 cout << unique_path("foo-%%%%%-%%%%%-%%%%%-%%%%%-%%%%%-%%%%%-%%%%%-%%%%-bar") << endl;
389 cout << unique_path("foo-%%%%%-%%%%%-%%%%%-%%%%%-%%%%%-%%%%%-%%%%%-%%%%%-bar") << endl;
390
391 cout << "testing complete" << endl;
392
393 // post-test cleanup
394 if (cleanup)
395 {
396 cout << "post-test removal of " << temp_dir << endl;
397 BOOST_TEST(remove_all(temp_dir) != 0);
398 // above was added just to simplify testing, but it ended up detecting
399 // a bug (failure to close an internal search handle).
400 cout << "post-test removal complete" << endl;

Callers

nothing calls this directly

Calls 14

file_status_testFunction · 0.85
query_testFunction · 0.85
directory_iterator_testFunction · 0.85
operations_testFunction · 0.85
directory_entry_testFunction · 0.85
error_handling_testFunction · 0.85
stringMethod · 0.80
current_pathFunction · 0.50
unique_pathFunction · 0.50
create_directoryFunction · 0.50

Tested by

no test coverage detected