File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,6 +105,20 @@ bool create(const std::filesystem::path& file_path) NOEXCEPT;
105105bool exists (const std::filesystem::path& file_path) NOEXCEPT;
106106bool remove (const std::filesystem::path& file_path) NOEXCEPT;
107107
108+ struct directory_setup_fixture
109+ {
110+ DELETE_COPY_MOVE (directory_setup_fixture);
111+
112+ directory_setup_fixture () NOEXCEPT
113+ {
114+ BOOST_REQUIRE (clear (directory));
115+ }
116+ ~directory_setup_fixture () NOEXCEPT
117+ {
118+ BOOST_REQUIRE (clear (directory));
119+ }
120+ };
121+
108122// Utility to convert a const reference instance to moveable.
109123template <typename Type>
110124Type move_copy (const Type& instance) NOEXCEPT
Original file line number Diff line number Diff line change 1818 */
1919#include " ../../test.hpp"
2020
21- struct ifstream_tests_setup_fixture
22- {
23- ifstream_tests_setup_fixture ()
24- {
25- test::remove (TEST_NAME);
26- }
27-
28- ~ifstream_tests_setup_fixture ()
29- {
30- test::remove (TEST_NAME);
31- }
32- };
33-
34- BOOST_FIXTURE_TEST_SUITE (ifstream_tests, ifstream_tests_setup_fixture)
21+ BOOST_FIXTURE_TEST_SUITE (ifstream_tests, test::directory_setup_fixture)
3522
3623BOOST_AUTO_TEST_CASE(ifstream__construct__valid_path__round_trip)
3724{
38- ofstream out (TEST_NAME , std::ofstream::out);
25+ ofstream out (TEST_PATH , std::ofstream::out);
3926 BOOST_REQUIRE (out.good ());
4027 BOOST_REQUIRE (!out.bad ());
4128
@@ -46,7 +33,7 @@ BOOST_AUTO_TEST_CASE(ifstream__construct__valid_path__round_trip)
4633 out.close ();
4734 BOOST_REQUIRE (out.good ());
4835
49- ifstream in (TEST_NAME );
36+ ifstream in (TEST_PATH );
5037 BOOST_REQUIRE (in.good ());
5138
5239 std::string line;
Original file line number Diff line number Diff line change 1818 */
1919#include " ../../test.hpp"
2020
21- struct ofstream_tests_setup_fixture
22- {
23- ofstream_tests_setup_fixture ()
24- {
25- test::remove (TEST_NAME);
26- }
27-
28- ~ofstream_tests_setup_fixture ()
29- {
30- test::remove (TEST_NAME);
31- }
32- };
33-
34- BOOST_FIXTURE_TEST_SUITE (ofstream_tests, ofstream_tests_setup_fixture)
21+ BOOST_FIXTURE_TEST_SUITE (ofstream_tests, test::directory_setup_fixture)
3522
3623BOOST_AUTO_TEST_CASE(ofstream__construct__valid_path__round_trip)
3724{
38- ofstream out (TEST_NAME , std::ofstream::out);
25+ ofstream out (TEST_PATH , std::ofstream::out);
3926 BOOST_REQUIRE (out.good ());
4027 BOOST_REQUIRE (!out.bad ());
4128
@@ -46,7 +33,7 @@ BOOST_AUTO_TEST_CASE(ofstream__construct__valid_path__round_trip)
4633 out.close ();
4734 BOOST_REQUIRE (out.good ());
4835
49- ifstream in (TEST_NAME );
36+ ifstream in (TEST_PATH );
5037 BOOST_REQUIRE (in.good ());
5138
5239 std::string line;
You can’t perform that action at this time.
0 commit comments