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

Function test_decompositions

test/path_unit_test.cpp:792–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

790// test_decompositions -------------------------------------------------------------//
791
792void test_decompositions()
793{
794 std::cout << "testing decompositions..." << std::endl;
795
796 CHECK(path("").root_name().string() == "");
797 CHECK(path("foo").root_name().string() == "");
798 CHECK(path("/").root_name().string() == "");
799 CHECK(path("/foo").root_name().string() == "");
800 CHECK(path("//netname").root_name().string() == "//netname");
801 CHECK(path("//netname/foo").root_name().string() == "//netname");
802
803 CHECK(path("").root_directory().string() == "");
804 CHECK(path("foo").root_directory().string() == "");
805 CHECK(path("/").root_directory().string() == "/");
806 CHECK(path("/foo").root_directory().string() == "/");
807 CHECK(path("//netname").root_directory().string() == "");
808 CHECK(path("//netname/foo").root_directory().string() == "/");
809
810 CHECK(path("").root_path().string() == "");
811 CHECK(path("/").root_path().string() == "/");
812 CHECK(path("/foo").root_path().string() == "/");
813 CHECK(path("//netname").root_path().string() == "//netname");
814 CHECK(path("//netname/foo").root_path().string() == "//netname/");
815
816#ifdef BOOST_FILESYSTEM_WINDOWS_API
817 CHECK(path("c:/foo").root_path().string() == "c:/");
818#endif
819
820 CHECK(path("").relative_path().string() == "");
821 CHECK(path("/").relative_path().string() == "");
822 CHECK(path("/foo").relative_path().string() == "foo");
823
824 CHECK(path("").parent_path().string() == "");
825 CHECK(path("/").parent_path().string() == "");
826 CHECK(path("/foo").parent_path().string() == "/");
827 CHECK(path("/foo/bar").parent_path().string() == "/foo");
828
829 CHECK(path("/foo/bar/baz.zoo").filename().string() == "baz.zoo");
830
831 CHECK(path("/foo/bar/baz.zoo").stem().string() == "baz");
832 CHECK(path("/foo/bar.woo/baz").stem().string() == "baz");
833
834 CHECK(path("foo.bar.baz.tar.bz2").extension().string() == ".bz2");
835 CHECK(path("/foo/bar/baz.zoo").extension().string() == ".zoo");
836 CHECK(path("/foo/bar.woo/baz").extension().string() == "");
837}
838
839// test_queries --------------------------------------------------------------------//
840

Callers 1

test_mainFunction · 0.85

Calls 10

stringMethod · 0.80
root_nameMethod · 0.80
root_directoryMethod · 0.80
root_pathMethod · 0.80
relative_pathMethod · 0.80
parent_pathMethod · 0.80
filenameMethod · 0.80
stemMethod · 0.80
extensionMethod · 0.80
pathFunction · 0.70

Tested by

no test coverage detected