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

Function space_tests

test/operations_test.cpp:2609–2638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2607// space_tests ---------------------------------------------------------------------//
2608
2609void space_tests()
2610{
2611 cout << "space_tests..." << endl;
2612
2613 // make some reasonable assuptions for testing purposes
2614 fs::space_info spi(fs::space(dir));
2615 BOOST_TEST(spi.capacity > 1000000);
2616 BOOST_TEST(spi.free > 1000);
2617 BOOST_TEST(spi.capacity > spi.free);
2618 BOOST_TEST(spi.free >= spi.available);
2619
2620 // it is convenient to display space, but older VC++ versions choke
2621#if !defined(BOOST_MSVC) || _MSC_VER >= 1300 // 1300 == VC++ 7.0
2622 cout << " capacity = " << spi.capacity << '\n';
2623 cout << " free = " << spi.free << '\n';
2624 cout << " available = " << spi.available << '\n';
2625#endif
2626
2627 // Test that we can specify path to file
2628 fs::path file = dir / "file";
2629 create_file(file);
2630
2631 fs::space_info spi_file(fs::space(file));
2632 BOOST_TEST_EQ(spi_file.capacity, spi.capacity);
2633
2634 fs::remove(file);
2635
2636 // Test that an error is indicated if a path to a non-existing file is passed
2637 BOOST_TEST(CHECK_EXCEPTION(bad_space, ENOENT));
2638}
2639
2640// equivalent_tests ----------------------------------------------------------------//
2641

Callers 1

cpp_mainFunction · 0.85

Calls 3

spaceFunction · 0.85
create_fileFunction · 0.70
removeFunction · 0.50

Tested by

no test coverage detected