| 2607 | // space_tests ---------------------------------------------------------------------// |
| 2608 | |
| 2609 | void 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 |
no test coverage detected