[libc++][test] Removes rapid-cxx-test.h.
authorMark de Wever <koraq@xs4all.nl>
Sat, 21 Jan 2023 12:35:30 +0000 (13:35 +0100)
committerMark de Wever <koraq@xs4all.nl>
Sat, 18 Feb 2023 11:51:53 +0000 (12:51 +0100)
Depends on D142808

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D143383

78 files changed:
libcxx/test/libcxx/containers/sequences/deque/spare_block_handling.pass.cpp
libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy_assign.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move_assign.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/path.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/assign.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/refresh.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/replace_filename.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/status.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp
libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/c_str.pass.cpp
libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp
libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp
libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp
libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp
libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp
libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp
libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp
libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp
libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy/copy.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_other/is_other.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove/remove.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status/status.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status_known/status_known.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
libcxx/test/support/assert_macros.h
libcxx/test/support/filesystem_test_helper.h
libcxx/test/support/rapid-cxx-test.h [deleted file]

index 3b90464..e9e0034 100644 (file)
 // resizes or shrinks at the correct time.
 
 #include <deque>
+#include <cassert>
 #include <cstdio>
 #include <memory>
 #include <queue>
 #include <stack>
+#include <string>
 
 #include "min_allocator.h"
-#include "rapid-cxx-test.h"
+#include "assert_macros.h"
 
 template <class Adaptor>
 struct ContainerAdaptor : public Adaptor {
@@ -56,22 +58,15 @@ const auto& AllocBytes = malloc_allocator_base::outstanding_bytes;
 template <class Deque>
 struct PrintOnFailure {
    explicit PrintOnFailure(Deque const& deque) : deque_(&deque) {}
-
-  ~PrintOnFailure() {
-    if (::rapid_cxx_test::get_reporter().current_failure().type
-        != ::rapid_cxx_test::failure_type::none) {
-      print(*deque_);
-    }
-  }
+   void operator()() const { print(*deque_); }
 private:
   const Deque* deque_;
 
   PrintOnFailure(PrintOnFailure const&) = delete;
 };
 
-TEST_SUITE(deque_spare_tests)
 
-TEST_CASE(push_back) {
+static void push_back() {
   const auto BS = BlockSize<LargeT>::value;
   std::unique_ptr<Deque<LargeT>> dp(new Deque<LargeT>);
   auto& d = *dp;
@@ -79,126 +74,126 @@ TEST_CASE(push_back) {
 
   // Test nothing is allocated after default construction.
   {
-    TEST_REQUIRE(d.size() == 0);
-    TEST_REQUIRE(d.__capacity() == 0);
-    TEST_REQUIRE(d.__block_count() == 0);
+    TEST_REQUIRE(d.size() == 0, on_fail);
+    TEST_REQUIRE(d.__capacity() == 0, on_fail);
+    TEST_REQUIRE(d.__block_count() == 0, on_fail);
   }
   // First push back allocates one block.
   d.push_back({});
   {
-    TEST_REQUIRE(d.size() == 1);
-    TEST_REQUIRE(d.__front_spare() == 0);
-    TEST_REQUIRE(d.__back_spare() == 14);
-    TEST_REQUIRE(d.__back_spare_blocks() == 0);
-    TEST_REQUIRE(d.__capacity() == BS - 1);
-    TEST_REQUIRE(d.__block_count() == 1);
+    TEST_REQUIRE(d.size() == 1, on_fail);
+    TEST_REQUIRE(d.__front_spare() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 14, on_fail);
+    TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail);
+    TEST_REQUIRE(d.__capacity() == BS - 1, on_fail);
+    TEST_REQUIRE(d.__block_count() == 1, on_fail);
   }
 
   d.push_back({});
   {
-    TEST_REQUIRE(d.size() == 2);
-    TEST_REQUIRE(d.__front_spare() == 0);
-    TEST_REQUIRE(d.__back_spare() == 13);
-    TEST_REQUIRE(d.__back_spare_blocks() == 0);
+    TEST_REQUIRE(d.size() == 2, on_fail);
+    TEST_REQUIRE(d.__front_spare() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 13, on_fail);
+    TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail);
   }
   // Push back until we need a new block.
   for (int RemainingCap = d.__capacity() - d.size(); RemainingCap >= 0; --RemainingCap)
     d.push_back({});
   {
-    TEST_REQUIRE(d.__block_count() == 2);
-    TEST_REQUIRE(d.__front_spare_blocks() == 0);
-    TEST_REQUIRE(d.__back_spare_blocks() == 0);
-    TEST_REQUIRE(d.__back_spare() == 15);
+    TEST_REQUIRE(d.__block_count() == 2, on_fail);
+    TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 15, on_fail);
   }
 
   // Remove the only element in the new block. Test that we keep the empty
   // block as a spare.
   d.pop_back();
   {
-    TEST_REQUIRE(d.__block_count() == 2);
-    TEST_REQUIRE(d.__front_spare_blocks() == 0);
-    TEST_REQUIRE(d.__back_spare_blocks() == 1);
-    TEST_REQUIRE(d.__back_spare() == 16);
+    TEST_REQUIRE(d.__block_count() == 2, on_fail);
+    TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare_blocks() == 1, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 16, on_fail);
   }
 
   // Pop back again, keep the spare.
   d.pop_back();
   {
-    TEST_REQUIRE(d.__block_count() == 2);
-    TEST_REQUIRE(d.__front_spare() == 0);
-    TEST_REQUIRE(d.__back_spare() == 17);
-    TEST_REQUIRE(d.__back_spare_blocks() == 1);
+    TEST_REQUIRE(d.__block_count() == 2, on_fail);
+    TEST_REQUIRE(d.__front_spare() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 17, on_fail);
+    TEST_REQUIRE(d.__back_spare_blocks() == 1, on_fail);
   }
 
   dp.reset();
-  TEST_REQUIRE(AllocBytes == 0);
+  TEST_REQUIRE(AllocBytes == 0, on_fail);
 }
 
-TEST_CASE(push_front) {
+static void push_front() {
   std::unique_ptr<Deque<LargeT>> dp(new Deque<LargeT>);
   auto& d = *dp;
   PrintOnFailure<Deque<LargeT>> on_fail(d);
 
   // Test nothing is allocated after default construction.
   {
-    TEST_REQUIRE(d.size() == 0);
-    TEST_REQUIRE(d.__capacity() == 0);
-    TEST_REQUIRE(d.__block_count() == 0);
+    TEST_REQUIRE(d.size() == 0, on_fail);
+    TEST_REQUIRE(d.__capacity() == 0, on_fail);
+    TEST_REQUIRE(d.__block_count() == 0, on_fail);
   }
   // First push front allocates one block, and we start the sequence in the
   // middle.
   d.push_front({});
   {
-    TEST_REQUIRE(d.size() == 1);
-    TEST_REQUIRE(d.__front_spare() == 7);
-    TEST_REQUIRE(d.__back_spare() == 7);
-    TEST_REQUIRE(d.__front_spare_blocks() == 0);
-    TEST_REQUIRE(d.__back_spare_blocks() == 0);
-    TEST_REQUIRE(d.__block_count() == 1);
+    TEST_REQUIRE(d.size() == 1, on_fail);
+    TEST_REQUIRE(d.__front_spare() == 7, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 7, on_fail);
+    TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail);
+    TEST_REQUIRE(d.__block_count() == 1, on_fail);
   }
 
   d.push_front({});
   {
-    TEST_REQUIRE(d.size() == 2);
-    TEST_REQUIRE(d.__front_spare() == 6);
-    TEST_REQUIRE(d.__back_spare() == 7);
-    TEST_REQUIRE(d.__front_spare_blocks() == 0);
-    TEST_REQUIRE(d.__back_spare_blocks() == 0);
+    TEST_REQUIRE(d.size() == 2, on_fail);
+    TEST_REQUIRE(d.__front_spare() == 6, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 7, on_fail);
+    TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail);
   }
   // Push front until we need a new block.
   for (int RemainingCap = d.__front_spare(); RemainingCap >= 0; --RemainingCap)
     d.push_front({});
   {
-    TEST_REQUIRE(d.__block_count() == 2);
-    TEST_REQUIRE(d.__front_spare() == 15);
-    TEST_REQUIRE(d.__back_spare() == 7);
-    TEST_REQUIRE(d.__front_spare_blocks() == 0);
-    TEST_REQUIRE(d.__back_spare_blocks() == 0);
+    TEST_REQUIRE(d.__block_count() == 2, on_fail);
+    TEST_REQUIRE(d.__front_spare() == 15, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 7, on_fail);
+    TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail);
   }
 
   // Remove the only element in the new block. Test that we keep the empty
   // block as a spare.
   d.pop_front();
   {
-    TEST_REQUIRE(d.__block_count() == 2);
-    TEST_REQUIRE(d.__front_spare_blocks() == 1);
-    TEST_REQUIRE(d.__back_spare_blocks() == 0);
-    TEST_REQUIRE(d.__back_spare() == 7);
+    TEST_REQUIRE(d.__block_count() == 2, on_fail);
+    TEST_REQUIRE(d.__front_spare_blocks() == 1, on_fail);
+    TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 7, on_fail);
   }
 
   // Pop back again, keep the spare.
   d.pop_front();
   {
-    TEST_REQUIRE(d.__block_count() == 2);
-    TEST_REQUIRE(d.__front_spare_blocks() == 1);
-    TEST_REQUIRE(d.__back_spare() == 7);
+    TEST_REQUIRE(d.__block_count() == 2, on_fail);
+    TEST_REQUIRE(d.__front_spare_blocks() == 1, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 7, on_fail);
   }
 
   dp.reset();
-  TEST_REQUIRE(AllocBytes == 0);
+  TEST_REQUIRE(AllocBytes == 0, on_fail);
 }
 
-TEST_CASE(std_queue) {
+static void std_queue() {
   using D = Deque<LargeT>;
   using Queue = std::queue<LargeT, D>;
   ContainerAdaptor<Queue> CA;
@@ -209,24 +204,24 @@ TEST_CASE(std_queue) {
   while (d.__block_count() < 4)
     q.push({});
   {
-    TEST_REQUIRE(d.__block_count() == 4);
-    TEST_REQUIRE(d.__front_spare() == 0);
-    TEST_REQUIRE(d.__back_spare() == 15);
-    TEST_REQUIRE(d.__back_spare_blocks() == 0);
+    TEST_REQUIRE(d.__block_count() == 4, on_fail);
+    TEST_REQUIRE(d.__front_spare() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 15, on_fail);
+    TEST_REQUIRE(d.__back_spare_blocks() == 0, on_fail);
   }
   while (d.__back_spare()) {
     q.push({});
   }
   {
-    TEST_REQUIRE(d.__block_count() == 4);
-    TEST_REQUIRE(d.__front_spare() == 0);
-    TEST_REQUIRE(d.__back_spare() == 0);
+    TEST_REQUIRE(d.__block_count() == 4, on_fail);
+    TEST_REQUIRE(d.__front_spare() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 0, on_fail);
   }
   q.pop();
   {
-    TEST_REQUIRE(d.__block_count() == 4);
-    TEST_REQUIRE(d.__front_spare() == 1);
-    TEST_REQUIRE(d.__back_spare() == 0);
+    TEST_REQUIRE(d.__block_count() == 4, on_fail);
+    TEST_REQUIRE(d.__front_spare() == 1, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 0, on_fail);
   }
 
   // Pop until we create a spare block at the front.
@@ -234,35 +229,35 @@ TEST_CASE(std_queue) {
     q.pop();
 
   {
-    TEST_REQUIRE(d.__block_count() == 4);
-    TEST_REQUIRE(d.__front_spare_blocks() == 1);
-    TEST_REQUIRE(d.__front_spare() == 16);
-    TEST_REQUIRE(d.__back_spare() == 0);
+    TEST_REQUIRE(d.__block_count() == 4, on_fail);
+    TEST_REQUIRE(d.__front_spare_blocks() == 1, on_fail);
+    TEST_REQUIRE(d.__front_spare() == 16, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 0, on_fail);
   }
 
   // Push at the end -- should re-use new spare block at front
   q.push({});
 
   {
-    TEST_REQUIRE(d.__block_count() == 4);
-    TEST_REQUIRE(d.__front_spare_blocks() == 0);
-    TEST_REQUIRE(d.__front_spare() == 0);
-    TEST_REQUIRE(d.__back_spare() == 15);
+    TEST_REQUIRE(d.__block_count() == 4, on_fail);
+    TEST_REQUIRE(d.__front_spare_blocks() == 0, on_fail);
+    TEST_REQUIRE(d.__front_spare() == 0, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 15, on_fail);
   }
   while (!q.empty()) {
     q.pop();
-    TEST_REQUIRE(d.__front_spare_blocks() + d.__back_spare_blocks() <= 2);
+    TEST_REQUIRE(d.__front_spare_blocks() + d.__back_spare_blocks() <= 2, on_fail);
   }
 
   // The empty state has two blocks
   {
-    TEST_REQUIRE(d.__front_spare() == 16);
-    TEST_REQUIRE(d.__back_spare() == 15);
-    TEST_REQUIRE(d.__capacity() == 31);
+    TEST_REQUIRE(d.__front_spare() == 16, on_fail);
+    TEST_REQUIRE(d.__back_spare() == 15, on_fail);
+    TEST_REQUIRE(d.__capacity() == 31, on_fail);
   }
 }
 
-TEST_CASE(pop_front_push_back) {
+static void pop_front_push_back() {
   Deque<char> d(32 * 1024, 'a');
   bool take_from_front = true;
   while (d.size() > 0) {
@@ -279,4 +274,11 @@ TEST_CASE(pop_front_push_back) {
   }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  push_back();
+  push_front();
+  std_queue();
+  pop_front_push_back();
+
+  return 0;
+}
index 9a19c46..4c6ac40 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 #include "filesystem_common.h"
 
 using namespace fs::detail;
 
-TEST_SUITE(directory_entry_mods_suite)
-
-TEST_CASE(last_write_time_not_representable_error) {
+static void last_write_time_not_representable_error() {
   using namespace fs;
   using namespace std::chrono;
   scoped_test_env env;
@@ -55,13 +53,13 @@ TEST_CASE(last_write_time_not_representable_error) {
   file_time_type start_time = file_time_type::clock::now() - hours(1);
   last_write_time(file, start_time);
 
-  TEST_CHECK(ent.last_write_time() == old_time);
+  assert(ent.last_write_time() == old_time);
 
   bool IsRepresentable = true;
   file_time_type rep_value;
   {
     std::error_code ec;
-    TEST_REQUIRE(!set_file_times(file, TS, ec));
+    assert(!set_file_times(file, TS, ec));
     ec.clear();
     rep_value = last_write_time(file, ec);
     IsRepresentable = !bool(ec);
@@ -70,30 +68,34 @@ TEST_CASE(last_write_time_not_representable_error) {
   if (!IsRepresentable) {
     std::error_code rec = GetTestEC();
     ent.refresh(rec);
-    TEST_CHECK(!rec);
+    assert(!rec);
 
     const std::errc expected_err = std::errc::value_too_large;
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == file_time_type::min());
-    TEST_CHECK(ErrorIs(ec, expected_err));
+    assert(ent.last_write_time(ec) == file_time_type::min());
+    assert(ErrorIs(ec, expected_err));
 
     ec = GetTestEC();
-    TEST_CHECK(last_write_time(file, ec) == file_time_type::min());
-    TEST_CHECK(ErrorIs(ec, expected_err));
+    assert(last_write_time(file, ec) == file_time_type::min());
+    assert(ErrorIs(ec, expected_err));
 
     ExceptionChecker CheckExcept(file, expected_err,
                                  "directory_entry::last_write_time");
-    TEST_CHECK_THROW_RESULT(filesystem_error, CheckExcept,
+    TEST_VALIDATE_EXCEPTION(filesystem_error, CheckExcept,
                             ent.last_write_time());
 
   } else {
     ent.refresh();
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == rep_value);
-    TEST_CHECK(!ec);
+    assert(ent.last_write_time(ec) == rep_value);
+    assert(!ec);
   }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  last_write_time_not_representable_error();
+
+  return 0;
+}
index e3c240d..621c445 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 #include "test_convertible.h"
 
-TEST_SUITE(directory_entry_path_ctor_suite)
-
-TEST_CASE(copy_ctor) {
+static void copy_ctor() {
   using namespace fs;
   // Copy
   {
@@ -42,7 +39,7 @@ TEST_CASE(copy_ctor) {
   }
 }
 
-TEST_CASE(copy_ctor_copies_cache) {
+static void copy_ctor_copies_cache() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -55,8 +52,8 @@ TEST_CASE(copy_ctor_copies_cache) {
     fs::remove(sym);
 
     directory_entry ent_cp(ent);
-    TEST_CHECK(ent_cp.path() == sym);
-    TEST_CHECK(ent_cp.is_symlink());
+    assert(ent_cp.path() == sym);
+    assert(ent_cp.is_symlink());
   }
 
   {
@@ -65,9 +62,14 @@ TEST_CASE(copy_ctor_copies_cache) {
     fs::remove(file);
 
     directory_entry ent_cp(ent);
-    TEST_CHECK(ent_cp.path() == file);
-    TEST_CHECK(ent_cp.is_regular_file());
+    assert(ent_cp.path() == file);
+    assert(ent_cp.is_regular_file());
   }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  copy_ctor();
+  copy_ctor_copies_cache();
+
+  return 0;
+}
index 2b3dc83..6c551b5 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
-TEST_SUITE(directory_entry_ctor_suite)
-
-TEST_CASE(test_copy_assign_operator) {
+static void test_copy_assign_operator() {
   using namespace fs;
   // Copy
   {
@@ -48,7 +45,7 @@ TEST_CASE(test_copy_assign_operator) {
   }
 }
 
-TEST_CASE(copy_assign_copies_cache) {
+static void copy_assign_copies_cache() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -62,8 +59,8 @@ TEST_CASE(copy_assign_copies_cache) {
 
     directory_entry ent_cp;
     ent_cp = ent;
-    TEST_CHECK(ent_cp.path() == sym);
-    TEST_CHECK(ent_cp.is_symlink());
+    assert(ent_cp.path() == sym);
+    assert(ent_cp.is_symlink());
   }
 
   {
@@ -73,9 +70,14 @@ TEST_CASE(copy_assign_copies_cache) {
 
     directory_entry ent_cp;
     ent_cp = ent;
-    TEST_CHECK(ent_cp.path() == file);
-    TEST_CHECK(ent_cp.is_regular_file());
+    assert(ent_cp.path() == file);
+    assert(ent_cp.is_regular_file());
   }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  test_copy_assign_operator();
+  copy_assign_copies_cache();
+
+  return 0;
+}
index 4d59b42..05ebbc7 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 #include "test_convertible.h"
 
-TEST_SUITE(directory_entry_path_ctor_suite)
-
-TEST_CASE(move_ctor) {
+static void move_ctor() {
   using namespace fs;
   // Move
   {
@@ -40,7 +37,7 @@ TEST_CASE(move_ctor) {
   }
 }
 
-TEST_CASE(move_ctor_copies_cache) {
+static void move_ctor_copies_cache() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -53,8 +50,8 @@ TEST_CASE(move_ctor_copies_cache) {
     fs::remove(sym);
 
     directory_entry ent_cp(std::move(ent));
-    TEST_CHECK(ent_cp.path() == sym);
-    TEST_CHECK(ent_cp.is_symlink());
+    assert(ent_cp.path() == sym);
+    assert(ent_cp.is_symlink());
   }
 
   {
@@ -63,9 +60,14 @@ TEST_CASE(move_ctor_copies_cache) {
     fs::remove(file);
 
     directory_entry ent_cp(std::move(ent));
-    TEST_CHECK(ent_cp.path() == file);
-    TEST_CHECK(ent_cp.is_regular_file());
+    assert(ent_cp.path() == file);
+    assert(ent_cp.is_regular_file());
   }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  move_ctor();
+  move_ctor_copies_cache();
+
+  return 0;
+}
index 945b294..6afb041 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
-TEST_SUITE(directory_entry_ctor_suite)
-
-TEST_CASE(test_move_assign_operator) {
+static void test_move_assign_operator() {
   using namespace fs;
   // Copy
   {
@@ -44,7 +41,7 @@ TEST_CASE(test_move_assign_operator) {
   }
 }
 
-TEST_CASE(move_assign_copies_cache) {
+static void move_assign_copies_cache() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -58,8 +55,8 @@ TEST_CASE(move_assign_copies_cache) {
 
     directory_entry ent_cp;
     ent_cp = std::move(ent);
-    TEST_CHECK(ent_cp.path() == sym);
-    TEST_CHECK(ent_cp.is_symlink());
+    assert(ent_cp.path() == sym);
+    assert(ent_cp.is_symlink());
   }
 
   {
@@ -69,9 +66,14 @@ TEST_CASE(move_assign_copies_cache) {
 
     directory_entry ent_cp;
     ent_cp = std::move(ent);
-    TEST_CHECK(ent_cp.path() == file);
-    TEST_CHECK(ent_cp.is_regular_file());
+    assert(ent_cp.path() == file);
+    assert(ent_cp.is_regular_file());
   }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  test_move_assign_operator();
+  move_assign_copies_cache();
+
+  return 0;
+}
index 19148e7..a075781 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 #include "test_convertible.h"
 
-TEST_SUITE(directory_entry_path_ctor_suite)
-
-TEST_CASE(path_ctor) {
+static void path_ctor() {
   using namespace fs;
   {
     static_assert(std::is_constructible<directory_entry, const path&>::value,
@@ -40,11 +38,11 @@ TEST_CASE(path_ctor) {
   {
     const path p("foo/bar/baz");
     const directory_entry e(p);
-    TEST_CHECK(e.path() == p);
+    assert(e.path() == p);
   }
 }
 
-TEST_CASE(path_ec_ctor) {
+static void path_ec_ctor() {
   static_test_env static_env;
   using namespace fs;
   {
@@ -62,19 +60,19 @@ TEST_CASE(path_ec_ctor) {
   {
     std::error_code ec = GetTestEC();
     const directory_entry e(static_env.File, ec);
-    TEST_CHECK(e.path() == static_env.File);
-    TEST_CHECK(!ec);
+    assert(e.path() == static_env.File);
+    assert(!ec);
   }
   {
     const path p("foo/bar/baz");
     std::error_code ec = GetTestEC();
     const directory_entry e(p, ec);
-    TEST_CHECK(e.path() == p);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(e.path() == p);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
   }
 }
 
-TEST_CASE(path_ctor_calls_refresh) {
+static void path_ctor_calls_refresh() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -85,15 +83,15 @@ TEST_CASE(path_ctor_calls_refresh) {
     directory_entry ent(file);
     std::error_code ec = GetTestEC();
     directory_entry ent_ec(file, ec);
-    TEST_CHECK(!ec);
+    assert(!ec);
 
     LIBCPP_ONLY(remove(file));
 
-    TEST_CHECK(ent.exists());
-    TEST_CHECK(ent_ec.exists());
+    assert(ent.exists());
+    assert(ent_ec.exists());
 
-    TEST_CHECK(ent.file_size() == 42);
-    TEST_CHECK(ent_ec.file_size() == 42);
+    assert(ent.file_size() == 42);
+    assert(ent_ec.file_size() == 42);
   }
 
   env.create_file("dir/file", 101);
@@ -102,23 +100,23 @@ TEST_CASE(path_ctor_calls_refresh) {
     directory_entry ent(sym);
     std::error_code ec = GetTestEC();
     directory_entry ent_ec(sym, ec);
-    TEST_CHECK(!ec);
+    assert(!ec);
 
     LIBCPP_ONLY(remove(file));
     LIBCPP_ONLY(remove(sym));
 
-    TEST_CHECK(ent.is_symlink());
-    TEST_CHECK(ent_ec.is_symlink());
+    assert(ent.is_symlink());
+    assert(ent_ec.is_symlink());
 
-    TEST_CHECK(ent.is_regular_file());
-    TEST_CHECK(ent_ec.is_regular_file());
+    assert(ent.is_regular_file());
+    assert(ent_ec.is_regular_file());
 
-    TEST_CHECK(ent.file_size() == 101);
-    TEST_CHECK(ent_ec.file_size() == 101);
+    assert(ent.file_size() == 101);
+    assert(ent_ec.file_size() == 101);
   }
 }
 
-TEST_CASE(path_ctor_dne) {
+static void path_ctor_dne() {
   using namespace fs;
 
   static_test_env static_env;
@@ -126,27 +124,27 @@ TEST_CASE(path_ctor_dne) {
   {
     std::error_code ec = GetTestEC();
     directory_entry ent(static_env.DNE, ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
-    TEST_CHECK(ent.path() == static_env.DNE);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.path() == static_env.DNE);
   }
   // don't report dead symlinks as an error.
   {
     std::error_code ec = GetTestEC();
     directory_entry ent(static_env.BadSymlink, ec);
-    TEST_CHECK(!ec);
-    TEST_CHECK(ent.path() == static_env.BadSymlink);
+    assert(!ec);
+    assert(ent.path() == static_env.BadSymlink);
   }
   // DNE does not cause the constructor to throw
   {
     directory_entry ent(static_env.DNE);
-    TEST_CHECK(ent.path() == static_env.DNE);
+    assert(ent.path() == static_env.DNE);
 
     directory_entry ent_two(static_env.BadSymlink);
-    TEST_CHECK(ent_two.path() == static_env.BadSymlink);
+    assert(ent_two.path() == static_env.BadSymlink);
   }
 }
 
-TEST_CASE(path_ctor_cannot_resolve) {
+static void path_ctor_cannot_resolve() {
   using namespace fs;
 #ifdef _WIN32
   // Windows doesn't support setting perms::none to trigger failures
@@ -154,16 +152,16 @@ TEST_CASE(path_ctor_cannot_resolve) {
   // instead.
   const path dir = GetWindowsInaccessibleDir();
   if (dir.empty())
-    TEST_UNSUPPORTED();
+    return;
   const path file = dir / "file";
   {
     std::error_code ec = GetTestEC();
     directory_entry ent(file, ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
-    TEST_CHECK(ent.path() == file);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.path() == file);
   }
   {
-    TEST_CHECK_NO_THROW(directory_entry(file));
+    TEST_DOES_NOT_THROW(directory_entry(file));
   }
 #else
   scoped_test_env env;
@@ -177,27 +175,35 @@ TEST_CASE(path_ctor_cannot_resolve) {
   {
     std::error_code ec = GetTestEC();
     directory_entry ent(file, ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
-    TEST_CHECK(ent.path() == file);
+    assert(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.path() == file);
   }
   {
     std::error_code ec = GetTestEC();
     directory_entry ent(sym_in_dir, ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
-    TEST_CHECK(ent.path() == sym_in_dir);
+    assert(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.path() == sym_in_dir);
   }
   {
     std::error_code ec = GetTestEC();
     directory_entry ent(sym_out_of_dir, ec);
-    TEST_CHECK(!ec);
-    TEST_CHECK(ent.path() == sym_out_of_dir);
+    assert(!ec);
+    assert(ent.path() == sym_out_of_dir);
   }
   {
-    TEST_CHECK_NO_THROW(directory_entry(file));
-    TEST_CHECK_NO_THROW(directory_entry(sym_in_dir));
-    TEST_CHECK_NO_THROW(directory_entry(sym_out_of_dir));
+    TEST_DOES_NOT_THROW(directory_entry(file));
+    TEST_DOES_NOT_THROW(directory_entry(sym_in_dir));
+    TEST_DOES_NOT_THROW(directory_entry(sym_out_of_dir));
   }
 #endif
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  path_ctor();
+  path_ec_ctor();
+  path_ctor_calls_refresh();
+  path_ctor_dne();
+  path_ctor_cannot_resolve();
+
+  return 0;
+}
index 1ab9a91..fe5dd80 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
-TEST_SUITE(directory_entry_mods_suite)
-
-TEST_CASE(test_path_assign_method) {
+static void test_path_assign_method() {
   using namespace fs;
   const path p("foo/bar/baz");
   const path p2("abc");
@@ -39,15 +36,15 @@ TEST_CASE(test_path_assign_method) {
                   "operation must not be noexcept");
   }
   {
-    TEST_CHECK(e.path() == p);
+    assert(e.path() == p);
     e.assign(p2);
-    TEST_CHECK(e.path() == p2 && e.path() != p);
+    assert(e.path() == p2 && e.path() != p);
     e.assign(p);
-    TEST_CHECK(e.path() == p && e.path() != p2);
+    assert(e.path() == p && e.path() != p2);
   }
 }
 
-TEST_CASE(test_path_assign_ec_method) {
+static void test_path_assign_ec_method() {
   using namespace fs;
   const path p("foo/bar/baz");
   const path p2("abc");
@@ -63,12 +60,12 @@ TEST_CASE(test_path_assign_ec_method) {
     directory_entry ent(p);
     std::error_code ec = GetTestEC();
     ent.assign(p2, ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
-    TEST_CHECK(ent.path() == p2);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.path() == p2);
   }
 }
 
-TEST_CASE(test_assign_calls_refresh) {
+static void test_assign_calls_refresh() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -82,7 +79,7 @@ TEST_CASE(test_assign_calls_refresh) {
     // removing the file demonstrates that the values where cached previously.
     LIBCPP_ONLY(remove(file));
 
-    TEST_CHECK(ent.is_regular_file());
+    assert(ent.is_regular_file());
   }
   env.create_file("dir/file", 101);
   {
@@ -92,12 +89,12 @@ TEST_CASE(test_assign_calls_refresh) {
     LIBCPP_ONLY(remove(file));
     LIBCPP_ONLY(remove(sym));
 
-    TEST_CHECK(ent.is_symlink());
-    TEST_CHECK(ent.is_regular_file());
+    assert(ent.is_symlink());
+    assert(ent.is_regular_file());
   }
 }
 
-TEST_CASE(test_assign_propagates_error) {
+static void test_assign_propagates_error() {
   using namespace fs;
   scoped_test_env env;
 #ifdef _WIN32
@@ -106,7 +103,7 @@ TEST_CASE(test_assign_propagates_error) {
   // instead.
   const path dir = GetWindowsInaccessibleDir();
   if (dir.empty())
-    TEST_UNSUPPORTED();
+    return;
   const path file = dir / "inaccessible_file";
   // We can't create files in the inaccessible directory, so this doesn't
   // test exactly the same as the code below.
@@ -115,7 +112,7 @@ TEST_CASE(test_assign_propagates_error) {
     directory_entry ent;
     std::error_code ec = GetTestEC();
     ent.assign(file, ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
   }
 #else
   const path dir = env.create_dir("dir");
@@ -130,21 +127,28 @@ TEST_CASE(test_assign_propagates_error) {
     directory_entry ent;
     std::error_code ec = GetTestEC();
     ent.assign(file, ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ErrorIs(ec, std::errc::permission_denied));
   }
   {
     directory_entry ent;
     std::error_code ec = GetTestEC();
     ent.assign(sym_in_dir, ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ErrorIs(ec, std::errc::permission_denied));
   }
 #endif
   {
     directory_entry ent;
     std::error_code ec = GetTestEC();
     ent.assign(sym_out_of_dir, ec);
-    TEST_CHECK(!ec);
+    assert(!ec);
   }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  test_path_assign_method();
+  test_path_assign_ec_method();
+  test_assign_calls_refresh();
+  test_assign_propagates_error();
+
+  return 0;
+}
index 56fda26..3a1c947 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
-TEST_SUITE(directory_entry_mods_suite)
-
-TEST_CASE(test_refresh_method) {
+static void test_refresh_method() {
   using namespace fs;
   {
     directory_entry e;
@@ -43,11 +41,11 @@ TEST_CASE(test_refresh_method) {
   {
     directory_entry e;
     e.refresh();
-    TEST_CHECK(!e.exists());
+    assert(!e.exists());
   }
 }
 
-TEST_CASE(test_refresh_ec_method) {
+static void test_refresh_ec_method() {
   using namespace fs;
   {
     directory_entry e;
@@ -60,14 +58,14 @@ TEST_CASE(test_refresh_ec_method) {
     directory_entry e;
     std::error_code ec = GetTestEC();
     e.refresh(ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
   }
 }
 
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
 // Windows doesn't support setting perms::none to trigger failures
 // reading directories.
-TEST_CASE(refresh_on_file_dne) {
+static void refresh_on_file_dne() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -79,36 +77,36 @@ TEST_CASE(refresh_on_file_dne) {
   {
     directory_entry ent(file);
     remove(file);
-    TEST_CHECK(ent.exists());
+    assert(ent.exists());
 
     ent.refresh();
 
     permissions(dir, perms::none);
-    TEST_CHECK(!ent.exists());
+    assert(!ent.exists());
   }
   permissions(dir, old_perms);
   env.create_file("dir/file", 101);
   {
     directory_entry ent(file);
     remove(file);
-    TEST_CHECK(ent.exists());
+    assert(ent.exists());
 
     std::error_code ec = GetTestEC();
     ent.refresh(ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     permissions(dir, perms::none);
-    TEST_CHECK(!ent.exists());
+    assert(!ent.exists());
   }
 }
-#endif
+#endif // TEST_WIN_NO_FILESYSTEM_PERMS_NONE
 
 void remove_if_exists(const fs::path& p) {
   std::error_code ec;
   remove(p, ec);
 }
 
-TEST_CASE(refresh_on_bad_symlink) {
+static void refresh_on_bad_symlink() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -121,18 +119,18 @@ TEST_CASE(refresh_on_bad_symlink) {
   {
     directory_entry ent(sym);
     LIBCPP_ONLY(remove(file));
-    TEST_CHECK(ent.is_symlink());
-    TEST_CHECK(ent.is_regular_file());
-    TEST_CHECK(ent.exists());
+    assert(ent.is_symlink());
+    assert(ent.is_regular_file());
+    assert(ent.exists());
 
     remove_if_exists(file);
     ent.refresh();
 
     LIBCPP_ONLY(permissions(dir, perms::none));
-    TEST_CHECK(ent.is_symlink());
+    assert(ent.is_symlink());
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
-    TEST_CHECK(!ent.is_regular_file());
-    TEST_CHECK(!ent.exists());
+    assert(!ent.is_regular_file());
+    assert(!ent.exists());
 #endif
   }
   permissions(dir, old_perms);
@@ -140,19 +138,19 @@ TEST_CASE(refresh_on_bad_symlink) {
   {
     directory_entry ent(sym);
     LIBCPP_ONLY(remove(file));
-    TEST_CHECK(ent.is_symlink());
-    TEST_CHECK(ent.is_regular_file());
-    TEST_CHECK(ent.exists());
+    assert(ent.is_symlink());
+    assert(ent.is_regular_file());
+    assert(ent.exists());
 
     remove_if_exists(file);
 
     std::error_code ec = GetTestEC();
     ent.refresh(ec);
-    TEST_CHECK(!ec); // we don't report bad symlinks as an error.
+    assert(!ec); // we don't report bad symlinks as an error.
 
     LIBCPP_ONLY(permissions(dir, perms::none));
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
-    TEST_CHECK(!ent.exists());
+    assert(!ent.exists());
 #endif
   }
 }
@@ -160,7 +158,7 @@ TEST_CASE(refresh_on_bad_symlink) {
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
 // Windows doesn't support setting perms::none to trigger failures
 // reading directories.
-TEST_CASE(refresh_cannot_resolve) {
+static void refresh_cannot_resolve() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -174,50 +172,50 @@ TEST_CASE(refresh_cannot_resolve) {
     directory_entry ent(file);
     permissions(dir, perms::none);
 
-    TEST_CHECK(ent.is_regular_file());
+    assert(ent.is_regular_file());
 
     std::error_code ec = GetTestEC();
     ent.refresh(ec);
 
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
-    TEST_CHECK(ent.path() == file);
+    assert(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.path() == file);
 
     ExceptionChecker Checker(file, std::errc::permission_denied,
                              "directory_entry::refresh");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.refresh());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.refresh());
   }
   permissions(dir, old_perms);
   {
     directory_entry ent(sym_in_dir);
     permissions(dir, perms::none);
-    TEST_CHECK(ent.is_symlink());
+    assert(ent.is_symlink());
 
     std::error_code ec = GetTestEC();
     ent.refresh(ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
-    TEST_CHECK(ent.path() == sym_in_dir);
+    assert(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.path() == sym_in_dir);
 
     ExceptionChecker Checker(sym_in_dir, std::errc::permission_denied,
                              "directory_entry::refresh");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.refresh());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.refresh());
   }
   permissions(dir, old_perms);
   {
     directory_entry ent(sym_out_of_dir);
     permissions(dir, perms::none);
-    TEST_CHECK(ent.is_symlink());
+    assert(ent.is_symlink());
 
     // Failure to resolve the linked entity due to permissions is not
     // reported as an error.
     std::error_code ec = GetTestEC();
     ent.refresh(ec);
-    TEST_CHECK(!ec);
-    TEST_CHECK(ent.is_symlink());
+    assert(!ec);
+    assert(ent.is_symlink());
 
     ec = GetTestEC();
-    TEST_CHECK(ent.exists(ec) == false);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
-    TEST_CHECK(ent.path() == sym_out_of_dir);
+    assert(ent.exists(ec) == false);
+    assert(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.path() == sym_out_of_dir);
   }
   permissions(dir, old_perms);
   {
@@ -228,14 +226,13 @@ TEST_CASE(refresh_cannot_resolve) {
     ((void)ent_file);
     ((void)ent_sym);
 
-    TEST_CHECK_THROW(filesystem_error, ent_file.refresh());
-    TEST_CHECK_THROW(filesystem_error, ent_sym.refresh());
-    TEST_CHECK_NO_THROW(ent_sym2);
+    TEST_THROWS_TYPE(filesystem_error, ent_file.refresh());
+    TEST_THROWS_TYPE(filesystem_error, ent_sym.refresh());
   }
 }
-#endif
+#endif // TEST_WIN_NO_FILESYSTEM_PERMS_NONE
 
-TEST_CASE(refresh_doesnt_throw_on_dne_but_reports_it) {
+static void refresh_doesnt_throw_on_dne_but_reports_it() {
   using namespace fs;
   scoped_test_env env;
 
@@ -244,47 +241,50 @@ TEST_CASE(refresh_doesnt_throw_on_dne_but_reports_it) {
 
   {
     directory_entry ent(file);
-    TEST_CHECK(ent.file_size() == 42);
+    assert(ent.file_size() == 42);
 
     remove(file);
 
     std::error_code ec = GetTestEC();
     ent.refresh(ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
-    TEST_CHECK_NO_THROW(ent.refresh());
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    TEST_DOES_NOT_THROW(ent.refresh());
 
     ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.file_size(ec) == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     // doesn't throw!
-    TEST_CHECK_THROW(filesystem_error, ent.file_size());
+    //
+    //
+    //
+    //TEST_THROWS_TYPE(filesystem_error, ent.file_size());
   }
   env.create_file("file1", 99);
   {
     directory_entry ent(sym);
-    TEST_CHECK(ent.is_symlink());
-    TEST_CHECK(ent.is_regular_file());
-    TEST_CHECK(ent.file_size() == 99);
+    assert(ent.is_symlink());
+    assert(ent.is_regular_file());
+    assert(ent.file_size() == 99);
 
     remove(file);
 
     std::error_code ec = GetTestEC();
     ent.refresh(ec);
-    TEST_CHECK(!ec);
+    assert(!ec);
 
     ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.file_size(ec) == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
-    TEST_CHECK_THROW(filesystem_error, ent.file_size());
+    TEST_THROWS_TYPE(filesystem_error, ent.file_size());
   }
 }
 
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
 // Windows doesn't support setting perms::none to trigger failures
 // reading directories.
-TEST_CASE(access_cache_after_refresh_fails) {
+static void access_cache_after_refresh_fails() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -297,21 +297,21 @@ TEST_CASE(access_cache_after_refresh_fails) {
 
 #define CHECK_ACCESS(func, expect)                                             \
   ec = GetTestEC();                                                            \
-  TEST_CHECK(ent.func(ec) == expect);                                          \
-  TEST_CHECK(ErrorIs(ec, std::errc::permission_denied))
+  assert(ent.func(ec) == expect);                                          \
+  assert(ErrorIs(ec, std::errc::permission_denied))
 
   // test file doesn't exist
   {
     directory_entry ent(file);
 
-    TEST_CHECK(!ent.is_symlink());
-    TEST_CHECK(ent.is_regular_file());
-    TEST_CHECK(ent.exists());
+    assert(!ent.is_symlink());
+    assert(ent.is_regular_file());
+    assert(ent.exists());
 
     permissions(dir, perms::none);
     std::error_code ec = GetTestEC();
     ent.refresh(ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     CHECK_ACCESS(exists, false);
     CHECK_ACCESS(is_symlink, false);
@@ -321,14 +321,14 @@ TEST_CASE(access_cache_after_refresh_fails) {
   permissions(dir, old_perms);
   {
     directory_entry ent(sym_in_dir);
-    TEST_CHECK(ent.is_symlink());
-    TEST_CHECK(ent.is_regular_file());
-    TEST_CHECK(ent.exists());
+    assert(ent.is_symlink());
+    assert(ent.is_regular_file());
+    assert(ent.exists());
 
     permissions(dir, perms::none);
     std::error_code ec = GetTestEC();
     ent.refresh(ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     CHECK_ACCESS(exists, false);
     CHECK_ACCESS(is_symlink, false);
@@ -338,15 +338,15 @@ TEST_CASE(access_cache_after_refresh_fails) {
   permissions(dir, old_perms);
   {
     directory_entry ent(sym);
-    TEST_CHECK(ent.is_symlink());
-    TEST_CHECK(ent.is_regular_file());
-    TEST_CHECK(ent.exists());
+    assert(ent.is_symlink());
+    assert(ent.is_regular_file());
+    assert(ent.exists());
 
     permissions(dir, perms::none);
     std::error_code ec = GetTestEC();
     ent.refresh(ec);
-    TEST_CHECK(!ec);
-    TEST_CHECK(ent.is_symlink());
+    assert(!ec);
+    assert(ent.is_symlink());
 
     CHECK_ACCESS(exists, false);
     CHECK_ACCESS(is_regular_file, false);
@@ -355,6 +355,21 @@ TEST_CASE(access_cache_after_refresh_fails) {
   }
 #undef CHECK_ACCESS
 }
-#endif
+#endif // TEST_WIN_NO_FILESYSTEM_PERMS_NONE
 
-TEST_SUITE_END()
+int main(int, char**) {
+  test_refresh_method();
+  test_refresh_ec_method();
+#ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+  refresh_on_file_dne();
+#endif
+  refresh_on_bad_symlink();
+#ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+  refresh_cannot_resolve();
+#endif
+  refresh_doesnt_throw_on_dne_but_reports_it();
+#ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+  access_cache_after_refresh_fails();
+#endif
+  return 0;
+}
index 564e0e2..1d0b975 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
-TEST_SUITE(directory_entry_mods_suite)
-
-TEST_CASE(test_replace_filename_method) {
+static void test_replace_filename_method() {
   using namespace fs;
 
   {
@@ -44,13 +41,13 @@ TEST_CASE(test_replace_filename_method) {
     const path replace("bar.out");
     const path expect("/path/to/bar.out");
     directory_entry e(p);
-    TEST_CHECK(e.path() == p);
+    assert(e.path() == p);
     e.replace_filename(replace);
-    TEST_CHECK(e.path() == expect);
+    assert(e.path() == expect);
   }
 }
 
-TEST_CASE(test_replace_filename_ec_method) {
+static void test_replace_filename_ec_method() {
   using namespace fs;
 
   static_test_env static_env;
@@ -69,27 +66,27 @@ TEST_CASE(test_replace_filename_ec_method) {
     const path replace("bar.out");
     const path expect("/path/to/bar.out");
     directory_entry e(p);
-    TEST_CHECK(e.path() == p);
+    assert(e.path() == p);
     std::error_code ec = GetTestEC();
     e.replace_filename(replace, ec);
-    TEST_CHECK(e.path() == expect);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(e.path() == expect);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
   }
   {
     const path p = static_env.EmptyFile;
     const path expect = static_env.NonEmptyFile;
     const path replace = static_env.NonEmptyFile.filename();
-    TEST_REQUIRE(expect.parent_path() == p.parent_path());
+    assert(expect.parent_path() == p.parent_path());
     directory_entry e(p);
-    TEST_CHECK(e.path() == p);
+    assert(e.path() == p);
     std::error_code ec = GetTestEC();
     e.replace_filename(replace, ec);
-    TEST_CHECK(e.path() == expect);
-    TEST_CHECK(!ec);
+    assert(e.path() == expect);
+    assert(!ec);
   }
 }
 
-TEST_CASE(test_replace_filename_calls_refresh) {
+static void test_replace_filename_calls_refresh() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -101,32 +98,32 @@ TEST_CASE(test_replace_filename_calls_refresh) {
   {
     directory_entry ent(file);
     ent.replace_filename(file_two.filename());
-    TEST_REQUIRE(ent.path() == file_two);
+    assert(ent.path() == file_two);
 
     // removing the file demonstrates that the values where cached previously.
     LIBCPP_ONLY(remove(file_two));
 
-    TEST_CHECK(ent.file_size() == 101);
+    assert(ent.file_size() == 101);
   }
   env.create_file("dir/file_two", 99);
   {
     directory_entry ent(sym);
     ent.replace_filename(sym_two.filename());
-    TEST_REQUIRE(ent.path() == sym_two);
+    assert(ent.path() == sym_two);
 
     LIBCPP_ONLY(remove(file_two));
     LIBCPP_ONLY(remove(sym_two));
 
-    TEST_CHECK(ent.is_symlink());
-    TEST_CHECK(ent.is_regular_file());
-    TEST_CHECK(ent.file_size() == 99);
+    assert(ent.is_symlink());
+    assert(ent.is_regular_file());
+    assert(ent.file_size() == 99);
   }
 }
 
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
 // Windows doesn't support setting perms::none to trigger failures
 // reading directories.
-TEST_CASE(test_replace_filename_propagates_error) {
+static void test_replace_filename_propagates_error() {
   using namespace fs;
   scoped_test_env env;
   const path dir = env.create_dir("dir");
@@ -145,7 +142,7 @@ TEST_CASE(test_replace_filename_propagates_error) {
     permissions(dir, perms::none);
     std::error_code ec = GetTestEC();
     ent.replace_filename(file_two.filename(), ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ErrorIs(ec, std::errc::permission_denied));
   }
   permissions(dir, old_perms);
   {
@@ -153,7 +150,7 @@ TEST_CASE(test_replace_filename_propagates_error) {
     permissions(dir, perms::none);
     std::error_code ec = GetTestEC();
     ent.replace_filename(sym_in_dir_two.filename(), ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ErrorIs(ec, std::errc::permission_denied));
   }
   permissions(dir, old_perms);
   {
@@ -161,13 +158,22 @@ TEST_CASE(test_replace_filename_propagates_error) {
     permissions(dir, perms::none);
     std::error_code ec = GetTestEC();
     ent.replace_filename(sym_out_of_dir_two.filename(), ec);
-    TEST_CHECK(!ec);
-    TEST_CHECK(ent.is_symlink());
+    assert(!ec);
+    assert(ent.is_symlink());
     ec = GetTestEC();
-    TEST_CHECK(!ent.exists(ec));
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(!ent.exists(ec));
+    assert(ErrorIs(ec, std::errc::permission_denied));
   }
 }
+#endif // TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+
+int main(int, char**) {
+  test_replace_filename_method();
+  test_replace_filename_ec_method();
+  test_replace_filename_calls_refresh();
+#ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+  test_replace_filename_propagates_error();
 #endif
 
-TEST_SUITE_END()
+  return 0;
+}
index c1e9130..6f049e8 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "filesystem_test_helper.h"
-#include "rapid-cxx-test.h"
 
 #include "test_macros.h"
 
-TEST_SUITE(directory_entry_obs_testsuite)
-
-TEST_CASE(signatures) {
+static void signatures() {
   using namespace fs;
   {
     const fs::directory_entry e = {};
@@ -43,7 +41,7 @@ TEST_CASE(signatures) {
   }
 }
 
-TEST_CASE(basic) {
+static void basic() {
   using namespace fs;
 
   scoped_test_env env;
@@ -54,31 +52,31 @@ TEST_CASE(basic) {
   {
     directory_entry ent(file);
     uintmax_t expect = file_size(ent);
-    TEST_CHECK(expect == 42);
+    assert(expect == 42);
 
     // Remove the file to show that the results were already in the cache.
     LIBCPP_ONLY(remove(file));
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == expect);
-    TEST_CHECK(!ec);
+    assert(ent.file_size(ec) == expect);
+    assert(!ec);
   }
   env.create_file("file", 99);
   {
     directory_entry ent(sym);
 
     uintmax_t expect = file_size(ent);
-    TEST_CHECK(expect == 99);
+    assert(expect == 99);
 
     LIBCPP_ONLY(remove(ent));
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == 99);
-    TEST_CHECK(!ec);
+    assert(ent.file_size(ec) == 99);
+    assert(!ec);
   }
 }
 
-TEST_CASE(not_regular_file) {
+static void not_regular_file() {
   using namespace fs;
 
   scoped_test_env env;
@@ -95,24 +93,24 @@ TEST_CASE(not_regular_file) {
   for (auto const& TC : TestCases) {
     const path& p = TC.p;
     directory_entry ent(p);
-    TEST_CHECK(ent.path() == p);
+    assert(ent.path() == p);
     std::error_code ec = GetTestEC(0);
 
     std::error_code other_ec = GetTestEC(1);
     uintmax_t expect = file_size(p, other_ec);
 
     uintmax_t got = ent.file_size(ec);
-    TEST_CHECK(got == expect);
-    TEST_CHECK(got == uintmax_t(-1));
-    TEST_CHECK(ec == other_ec);
-    TEST_CHECK(ErrorIs(ec, TC.expected_err));
+    assert(got == expect);
+    assert(got == uintmax_t(-1));
+    assert(ec == other_ec);
+    assert(ErrorIs(ec, TC.expected_err));
 
     ExceptionChecker Checker(p, TC.expected_err, "directory_entry::file_size");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.file_size());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.file_size());
   }
 }
 
-TEST_CASE(error_reporting) {
+static void error_reporting() {
   using namespace fs;
 
   static_test_env static_env;
@@ -134,17 +132,17 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(static_env.DNE, ec);
-    TEST_REQUIRE(ent.path() == static_env.DNE);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.path() == static_env.DNE);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.file_size(ec) == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ExceptionChecker Checker(static_env.DNE,
                              std::errc::no_such_file_or_directory,
                              "directory_entry::file_size");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.file_size());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.file_size());
   }
   // test a dead symlink
   {
@@ -152,22 +150,22 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     uintmax_t expect_bad = file_size(static_env.BadSymlink, ec);
-    TEST_CHECK(expect_bad == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(expect_bad == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ec = GetTestEC();
     ent.assign(static_env.BadSymlink, ec);
-    TEST_REQUIRE(ent.path() == static_env.BadSymlink);
-    TEST_CHECK(!ec);
+    assert(ent.path() == static_env.BadSymlink);
+    assert(!ec);
 
     ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == expect_bad);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.file_size(ec) == expect_bad);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ExceptionChecker Checker(static_env.BadSymlink,
                              std::errc::no_such_file_or_directory,
                              "directory_entry::file_size");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.file_size());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.file_size());
   }
   // Windows doesn't support setting perms::none to trigger failures
   // reading directories.
@@ -180,21 +178,21 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(file, ec);
-    TEST_REQUIRE(ent.path() == file);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.path() == file);
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.file_size(ec) == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ExceptionChecker Checker(file, std::errc::permission_denied, "file_size");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.file_size());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.file_size());
 
     permissions(dir, old_perms);
     ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == expect_good);
-    TEST_CHECK(!ec);
-    TEST_CHECK_NO_THROW(ent.file_size());
+    assert(ent.file_size(ec) == expect_good);
+    assert(!ec);
+    TEST_DOES_NOT_THROW(ent.file_size());
   }
   permissions(dir, old_perms);
   // test a symlink w/o appropriate permissions.
@@ -205,22 +203,22 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(sym_in_dir, ec);
-    TEST_REQUIRE(ent.path() == sym_in_dir);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.path() == sym_in_dir);
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.file_size(ec) == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ExceptionChecker Checker(sym_in_dir, std::errc::permission_denied,
                              "file_size");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.file_size());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.file_size());
 
     permissions(dir, old_perms);
     ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == expect_good);
-    TEST_CHECK(!ec);
-    TEST_CHECK_NO_THROW(ent.file_size());
+    assert(ent.file_size(ec) == expect_good);
+    assert(!ec);
+    TEST_DOES_NOT_THROW(ent.file_size());
   }
   permissions(dir, old_perms);
   // test a symlink to a file w/o appropriate permissions
@@ -231,24 +229,31 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(sym_out_of_dir, ec);
-    TEST_REQUIRE(ent.path() == sym_out_of_dir);
-    TEST_CHECK(!ec);
+    assert(ent.path() == sym_out_of_dir);
+    assert(!ec);
 
     ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.file_size(ec) == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ExceptionChecker Checker(sym_out_of_dir, std::errc::permission_denied,
                              "file_size");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.file_size());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.file_size());
 
     permissions(dir, old_perms);
     ec = GetTestEC();
-    TEST_CHECK(ent.file_size(ec) == expect_good);
-    TEST_CHECK(!ec);
-    TEST_CHECK_NO_THROW(ent.file_size());
+    assert(ent.file_size(ec) == expect_good);
+    assert(!ec);
+    TEST_DOES_NOT_THROW(ent.file_size());
   }
 #endif
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  signatures();
+  basic();
+  not_regular_file();
+  error_reporting();
+
+  return 0;
+}
index 541a6d9..6591d51 100644 (file)
 #include <cassert>
 
 #include "filesystem_test_helper.h"
-#include "rapid-cxx-test.h"
 
 #include "test_macros.h"
 
-TEST_SUITE(directory_entry_obs_testsuite)
-
-TEST_CASE(file_dne) {
+static void file_dne() {
   using namespace fs;
   directory_entry p("dne");
 }
 
-TEST_CASE(signatures) {
+static void signatures() {
   using namespace fs;
   const directory_entry e = {};
   std::error_code ec;
@@ -56,7 +53,7 @@ TEST_CASE(signatures) {
 #undef TEST_FUNC
 }
 
-TEST_CASE(test_without_ec) {
+static void test_without_ec() {
   using namespace fs;
   using fs::directory_entry;
   using fs::file_status;
@@ -71,17 +68,17 @@ TEST_CASE(test_without_ec) {
     file_status st = status(p);
     file_status sym_st = symlink_status(p);
     fs::remove(p);
-    TEST_REQUIRE(e.exists());
-    TEST_REQUIRE(!exists(p));
-    TEST_CHECK(e.exists() == exists(st));
-    TEST_CHECK(e.is_block_file() == is_block_file(st));
-    TEST_CHECK(e.is_character_file() == is_character_file(st));
-    TEST_CHECK(e.is_directory() == is_directory(st));
-    TEST_CHECK(e.is_fifo() == is_fifo(st));
-    TEST_CHECK(e.is_other() == is_other(st));
-    TEST_CHECK(e.is_regular_file() == is_regular_file(st));
-    TEST_CHECK(e.is_socket() == is_socket(st));
-    TEST_CHECK(e.is_symlink() == is_symlink(sym_st));
+    assert(e.exists());
+    assert(!exists(p));
+    assert(e.exists() == exists(st));
+    assert(e.is_block_file() == is_block_file(st));
+    assert(e.is_character_file() == is_character_file(st));
+    assert(e.is_directory() == is_directory(st));
+    assert(e.is_fifo() == is_fifo(st));
+    assert(e.is_other() == is_other(st));
+    assert(e.is_regular_file() == is_regular_file(st));
+    assert(e.is_socket() == is_socket(st));
+    assert(e.is_symlink() == is_symlink(sym_st));
   };
   test_path(f);
   test_path(d);
@@ -92,7 +89,7 @@ TEST_CASE(test_without_ec) {
 #endif
 }
 
-TEST_CASE(test_with_ec) {
+static void test_with_ec() {
   using namespace fs;
   using fs::directory_entry;
   using fs::file_status;
@@ -116,36 +113,36 @@ TEST_CASE(test_with_ec) {
       return res;
     };
 
-    TEST_REQUIRE(e.exists(ec));
-    TEST_CHECK(CheckEC(status_ec));
-    TEST_REQUIRE(!exists(p));
+    assert(e.exists(ec));
+    assert(CheckEC(status_ec));
+    assert(!exists(p));
 
-    TEST_CHECK(e.exists(ec) == exists(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.exists(ec) == exists(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_block_file(ec) == is_block_file(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_block_file(ec) == is_block_file(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_character_file(ec) == is_character_file(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_character_file(ec) == is_character_file(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_directory(ec) == is_directory(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_directory(ec) == is_directory(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_fifo(ec) == is_fifo(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_fifo(ec) == is_fifo(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_other(ec) == is_other(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_other(ec) == is_other(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_regular_file(ec) == is_regular_file(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_regular_file(ec) == is_regular_file(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_socket(ec) == is_socket(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_socket(ec) == is_socket(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_symlink(ec) == is_symlink(sym_st));
-    TEST_CHECK(CheckEC(sym_status_ec));
+    assert(e.is_symlink(ec) == is_symlink(sym_st));
+    assert(CheckEC(sym_status_ec));
   };
   test_path(f);
   test_path(d);
@@ -156,7 +153,7 @@ TEST_CASE(test_with_ec) {
 #endif
 }
 
-TEST_CASE(test_with_ec_dne) {
+static void test_with_ec_dne() {
   using namespace fs;
   using fs::directory_entry;
   using fs::file_status;
@@ -176,39 +173,39 @@ TEST_CASE(test_with_ec_dne) {
       return res;
     };
 
-    TEST_CHECK(e.exists(ec) == exists(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.exists(ec) == exists(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_block_file(ec) == is_block_file(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_block_file(ec) == is_block_file(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_character_file(ec) == is_character_file(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_character_file(ec) == is_character_file(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_directory(ec) == is_directory(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_directory(ec) == is_directory(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_fifo(ec) == is_fifo(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_fifo(ec) == is_fifo(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_other(ec) == is_other(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_other(ec) == is_other(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_regular_file(ec) == is_regular_file(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_regular_file(ec) == is_regular_file(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_socket(ec) == is_socket(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_socket(ec) == is_socket(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_symlink(ec) == is_symlink(sym_st));
-    TEST_CHECK(CheckEC(sym_status_ec));
+    assert(e.is_symlink(ec) == is_symlink(sym_st));
+    assert(CheckEC(sym_status_ec));
   }
 }
 
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
 // Windows doesn't support setting perms::none to trigger failures
 // reading directories.
-TEST_CASE(test_with_ec_cannot_resolve) {
+static void test_with_ec_cannot_resolve() {
   using namespace fs;
   using fs::directory_entry;
   using fs::file_status;
@@ -229,7 +226,7 @@ TEST_CASE(test_with_ec_cannot_resolve) {
     permissions(dir, perms::none);
     std::error_code dummy_ec;
     e.refresh(dummy_ec);
-    TEST_REQUIRE(dummy_ec);
+    assert(dummy_ec);
 
     std::error_code status_ec = GetTestEC();
     std::error_code sym_status_ec = GetTestEC(1);
@@ -242,34 +239,45 @@ TEST_CASE(test_with_ec_cannot_resolve) {
       return res;
     };
 
-    TEST_CHECK(e.exists(ec) == exists(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.exists(ec) == exists(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_block_file(ec) == is_block_file(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_block_file(ec) == is_block_file(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_character_file(ec) == is_character_file(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_character_file(ec) == is_character_file(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_directory(ec) == is_directory(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_directory(ec) == is_directory(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_fifo(ec) == is_fifo(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_fifo(ec) == is_fifo(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_other(ec) == is_other(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_other(ec) == is_other(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_regular_file(ec) == is_regular_file(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_regular_file(ec) == is_regular_file(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_socket(ec) == is_socket(st));
-    TEST_CHECK(CheckEC(status_ec));
+    assert(e.is_socket(ec) == is_socket(st));
+    assert(CheckEC(status_ec));
 
-    TEST_CHECK(e.is_symlink(ec) == is_symlink(sym_st));
-    TEST_CHECK(CheckEC(sym_status_ec));
+    assert(e.is_symlink(ec) == is_symlink(sym_st));
+    assert(CheckEC(sym_status_ec));
   }
 }
+#endif // TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+
+int main(int, char**) {
+  file_dne();
+  signatures();
+  test_without_ec();
+  test_with_ec();
+  test_with_ec_dne();
+#ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+  test_with_ec_cannot_resolve();
 #endif
 
-TEST_SUITE_END()
+  return 0;
+}
index bd31668..669fcfb 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "filesystem_test_helper.h"
-#include "rapid-cxx-test.h"
 
 #include "test_macros.h"
 
-TEST_SUITE(directory_entry_obs_testsuite)
-
-TEST_CASE(signatures) {
+static void signatures() {
   using namespace fs;
   {
     const directory_entry e = {};
@@ -43,7 +41,7 @@ TEST_CASE(signatures) {
   }
 }
 
-TEST_CASE(basic) {
+static void basic() {
   using namespace fs;
 
   scoped_test_env env;
@@ -59,8 +57,8 @@ TEST_CASE(basic) {
     LIBCPP_ONLY(remove(file));
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == expect);
-    TEST_CHECK(!ec);
+    assert(ent.hard_link_count(ec) == expect);
+    assert(!ec);
   }
   {
     directory_entry ent(dir);
@@ -69,20 +67,20 @@ TEST_CASE(basic) {
     LIBCPP_ONLY(remove(dir));
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == expect);
-    TEST_CHECK(!ec);
+    assert(ent.hard_link_count(ec) == expect);
+    assert(!ec);
   }
   env.create_file("file", 99);
   env.create_hardlink("file", "hl");
   {
     directory_entry ent(sym);
     std::error_code ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == 2);
-    TEST_CHECK(!ec);
+    assert(ent.hard_link_count(ec) == 2);
+    assert(!ec);
   }
 }
 
-TEST_CASE(not_regular_file) {
+static void not_regular_file() {
   using namespace fs;
 
   scoped_test_env env;
@@ -94,16 +92,16 @@ TEST_CASE(not_regular_file) {
   auto test_path = [=](const path &p) {
     std::error_code dummy_ec = GetTestEC();
     directory_entry ent(p, dummy_ec);
-    TEST_CHECK(!dummy_ec);
+    assert(!dummy_ec);
 
     uintmax_t expect = hard_link_count(p);
 
     LIBCPP_ONLY(permissions(dir, perms::none));
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == expect);
-    TEST_CHECK(!ec);
-    TEST_CHECK_NO_THROW(ent.hard_link_count());
+    assert(ent.hard_link_count(ec) == expect);
+    assert(!ec);
+    TEST_DOES_NOT_THROW(ent.hard_link_count());
     permissions(dir, old_perms);
   };
   test_path(dir2);
@@ -115,7 +113,7 @@ TEST_CASE(not_regular_file) {
 #endif
 }
 
-TEST_CASE(error_reporting) {
+static void error_reporting() {
   using namespace fs;
 
   static_test_env static_env;
@@ -137,18 +135,18 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(static_env.DNE, ec);
-    TEST_CHECK(ec);
-    TEST_REQUIRE(ent.path() == static_env.DNE);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ec);
+    assert(ent.path() == static_env.DNE);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.hard_link_count(ec) == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ExceptionChecker Checker(static_env.DNE,
                              std::errc::no_such_file_or_directory,
                              "directory_entry::hard_link_count");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.hard_link_count());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.hard_link_count());
   }
   // test a dead symlink
   {
@@ -156,22 +154,22 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     uintmax_t expect_bad = hard_link_count(static_env.BadSymlink, ec);
-    TEST_CHECK(expect_bad == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(expect_bad == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ec = GetTestEC();
     ent.assign(static_env.BadSymlink, ec);
-    TEST_REQUIRE(ent.path() == static_env.BadSymlink);
-    TEST_CHECK(!ec);
+    assert(ent.path() == static_env.BadSymlink);
+    assert(!ec);
 
     ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == expect_bad);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.hard_link_count(ec) == expect_bad);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ExceptionChecker Checker(static_env.BadSymlink,
                              std::errc::no_such_file_or_directory,
                              "directory_entry::hard_link_count");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.hard_link_count());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.hard_link_count());
   }
   // Windows doesn't support setting perms::none to trigger failures
   // reading directories.
@@ -184,22 +182,22 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(file, ec);
-    TEST_REQUIRE(ent.path() == file);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.path() == file);
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.hard_link_count(ec) == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ExceptionChecker Checker(file, std::errc::permission_denied,
                              "hard_link_count");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.hard_link_count());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.hard_link_count());
 
     permissions(dir, old_perms);
     ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == expect_good);
-    TEST_CHECK(!ec);
-    TEST_CHECK_NO_THROW(ent.hard_link_count());
+    assert(ent.hard_link_count(ec) == expect_good);
+    assert(!ec);
+    TEST_DOES_NOT_THROW(ent.hard_link_count());
   }
   permissions(dir, old_perms);
   // test a symlink w/o appropriate permissions.
@@ -210,22 +208,22 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(sym_in_dir, ec);
-    TEST_REQUIRE(ent.path() == sym_in_dir);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.path() == sym_in_dir);
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.hard_link_count(ec) == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ExceptionChecker Checker(sym_in_dir, std::errc::permission_denied,
                              "hard_link_count");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.hard_link_count());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.hard_link_count());
 
     permissions(dir, old_perms);
     ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == expect_good);
-    TEST_CHECK(!ec);
-    TEST_CHECK_NO_THROW(ent.hard_link_count());
+    assert(ent.hard_link_count(ec) == expect_good);
+    assert(!ec);
+    TEST_DOES_NOT_THROW(ent.hard_link_count());
   }
   permissions(dir, old_perms);
   // test a symlink to a file w/o appropriate permissions
@@ -236,24 +234,30 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(sym_out_of_dir, ec);
-    TEST_REQUIRE(ent.path() == sym_out_of_dir);
-    TEST_CHECK(!ec);
+    assert(ent.path() == sym_out_of_dir);
+    assert(!ec);
 
     ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == uintmax_t(-1));
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.hard_link_count(ec) == uintmax_t(-1));
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ExceptionChecker Checker(sym_out_of_dir, std::errc::permission_denied,
                              "hard_link_count");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.hard_link_count());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.hard_link_count());
 
     permissions(dir, old_perms);
     ec = GetTestEC();
-    TEST_CHECK(ent.hard_link_count(ec) == expect_good);
-    TEST_CHECK(!ec);
-    TEST_CHECK_NO_THROW(ent.hard_link_count());
+    assert(ent.hard_link_count(ec) == expect_good);
+    assert(!ec);
+    TEST_DOES_NOT_THROW(ent.hard_link_count());
   }
 #endif
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  signatures();
+  basic();
+  not_regular_file();
+  error_reporting();
+  return 0;
+}
index dc0a1f7..be4ad74 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "filesystem_test_helper.h"
-#include "rapid-cxx-test.h"
 
 #include "test_macros.h"
 
-TEST_SUITE(directory_entry_obs_testsuite)
-
-TEST_CASE(signatures) {
+static void signatures() {
   using namespace fs;
   {
     const fs::directory_entry e = {};
@@ -44,7 +42,7 @@ TEST_CASE(signatures) {
   }
 }
 
-TEST_CASE(basic) {
+static void basic() {
   using namespace fs;
 
   scoped_test_env env;
@@ -60,8 +58,8 @@ TEST_CASE(basic) {
     LIBCPP_ONLY(remove(file));
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == expect);
-    TEST_CHECK(!ec);
+    assert(ent.last_write_time(ec) == expect);
+    assert(!ec);
   }
   {
     directory_entry ent(dir);
@@ -70,8 +68,8 @@ TEST_CASE(basic) {
     LIBCPP_ONLY(remove(dir));
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == expect);
-    TEST_CHECK(!ec);
+    assert(ent.last_write_time(ec) == expect);
+    assert(!ec);
   }
   env.create_file("file", 99);
   {
@@ -79,12 +77,12 @@ TEST_CASE(basic) {
     file_time_type expect = last_write_time(sym);
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == expect);
-    TEST_CHECK(!ec);
+    assert(ent.last_write_time(ec) == expect);
+    assert(!ec);
   }
 }
 
-TEST_CASE(error_reporting) {
+static void error_reporting() {
   using namespace fs;
 
   static_test_env static_env;
@@ -106,17 +104,17 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(static_env.DNE, ec);
-    TEST_REQUIRE(ent.path() == static_env.DNE);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.path() == static_env.DNE);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == file_time_type::min());
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.last_write_time(ec) == file_time_type::min());
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ExceptionChecker Checker(static_env.DNE,
                              std::errc::no_such_file_or_directory,
                              "directory_entry::last_write_time");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.last_write_time());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.last_write_time());
   }
   // test a dead symlink
   {
@@ -124,22 +122,22 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     file_time_type expect_bad = last_write_time(static_env.BadSymlink, ec);
-    TEST_CHECK(expect_bad == file_time_type::min());
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(expect_bad == file_time_type::min());
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ec = GetTestEC();
     ent.assign(static_env.BadSymlink, ec);
-    TEST_REQUIRE(ent.path() == static_env.BadSymlink);
-    TEST_CHECK(!ec);
+    assert(ent.path() == static_env.BadSymlink);
+    assert(!ec);
 
     ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == expect_bad);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(ent.last_write_time(ec) == expect_bad);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 
     ExceptionChecker Checker(static_env.BadSymlink,
                              std::errc::no_such_file_or_directory,
                              "directory_entry::last_write_time");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.last_write_time());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.last_write_time());
   }
   // Windows doesn't support setting perms::none to trigger failures
   // reading directories.
@@ -152,22 +150,22 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(file, ec);
-    TEST_REQUIRE(ent.path() == file);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.path() == file);
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == file_time_type::min());
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.last_write_time(ec) == file_time_type::min());
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ExceptionChecker Checker(file, std::errc::permission_denied,
                              "last_write_time");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.last_write_time());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.last_write_time());
 
     permissions(dir, old_perms);
     ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == expect_good);
-    TEST_CHECK(!ec);
-    TEST_CHECK_NO_THROW(ent.last_write_time());
+    assert(ent.last_write_time(ec) == expect_good);
+    assert(!ec);
+    TEST_DOES_NOT_THROW(ent.last_write_time());
   }
   permissions(dir, old_perms);
   // test a symlink w/o appropriate permissions.
@@ -178,22 +176,22 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(sym_in_dir, ec);
-    TEST_REQUIRE(ent.path() == sym_in_dir);
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.path() == sym_in_dir);
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == file_time_type::min());
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.last_write_time(ec) == file_time_type::min());
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ExceptionChecker Checker(sym_in_dir, std::errc::permission_denied,
                              "last_write_time");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.last_write_time());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.last_write_time());
 
     permissions(dir, old_perms);
     ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == expect_good);
-    TEST_CHECK(!ec);
-    TEST_CHECK_NO_THROW(ent.last_write_time());
+    assert(ent.last_write_time(ec) == expect_good);
+    assert(!ec);
+    TEST_DOES_NOT_THROW(ent.last_write_time());
   }
   permissions(dir, old_perms);
   // test a symlink to a file w/o appropriate permissions
@@ -204,24 +202,30 @@ TEST_CASE(error_reporting) {
 
     std::error_code ec = GetTestEC();
     ent.assign(sym_out_of_dir, ec);
-    TEST_REQUIRE(ent.path() == sym_out_of_dir);
-    TEST_CHECK(!ec);
+    assert(ent.path() == sym_out_of_dir);
+    assert(!ec);
 
     ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == file_time_type::min());
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(ent.last_write_time(ec) == file_time_type::min());
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ExceptionChecker Checker(sym_out_of_dir, std::errc::permission_denied,
                              "last_write_time");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ent.last_write_time());
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ent.last_write_time());
 
     permissions(dir, old_perms);
     ec = GetTestEC();
-    TEST_CHECK(ent.last_write_time(ec) == expect_good);
-    TEST_CHECK(!ec);
-    TEST_CHECK_NO_THROW(ent.last_write_time());
+    assert(ent.last_write_time(ec) == expect_good);
+    assert(!ec);
+    TEST_DOES_NOT_THROW(ent.last_write_time());
   }
 #endif
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  signatures();
+  basic();
+  error_reporting();
+
+  return 0;
+}
index ce4f286..7a45d60 100644 (file)
 #include <cassert>
 
 #include "filesystem_test_helper.h"
-#include "rapid-cxx-test.h"
 
 #include "test_macros.h"
 
-TEST_SUITE(directory_entry_status_testsuite)
-
-TEST_CASE(test_basic) {
+static void test_basic() {
   using namespace fs;
   static_test_env static_env;
   {
@@ -44,17 +41,21 @@ TEST_CASE(test_basic) {
     std::error_code pec = GetTestEC(), eec = GetTestEC(1);
     file_status ps = fs::status(p, pec);
     file_status es = e.status(eec);
-    TEST_CHECK(ps.type() == es.type());
-    TEST_CHECK(ps.permissions() == es.permissions());
-    TEST_CHECK(pec == eec);
+    assert(ps.type() == es.type());
+    assert(ps.permissions() == es.permissions());
+    assert(pec == eec);
   }
   for (const auto& p : TestCases) {
     const directory_entry e(p);
     file_status ps = fs::status(p);
     file_status es = e.status();
-    TEST_CHECK(ps.type() == es.type());
-    TEST_CHECK(ps.permissions() == es.permissions());
+    assert(ps.type() == es.type());
+    assert(ps.permissions() == es.permissions());
   }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  test_basic();
+
+  return 0;
+}
index 364b832..7fc5d3c 100644 (file)
 #include <cassert>
 
 #include "filesystem_test_helper.h"
-#include "rapid-cxx-test.h"
 
 #include "test_macros.h"
 
-TEST_SUITE(directory_entry_obs_suite)
-
-TEST_CASE(test_signature) {
+static void test_signature() {
   using namespace fs;
   static_test_env static_env;
   {
@@ -44,17 +41,20 @@ TEST_CASE(test_signature) {
     std::error_code pec = GetTestEC(), eec = GetTestEC(1);
     file_status ps = fs::symlink_status(p, pec);
     file_status es = e.symlink_status(eec);
-    TEST_CHECK(ps.type() == es.type());
-    TEST_CHECK(ps.permissions() == es.permissions());
-    TEST_CHECK(pec == eec);
+    assert(ps.type() == es.type());
+    assert(ps.permissions() == es.permissions());
+    assert(pec == eec);
   }
   for (const auto& p : TestCases) {
     const directory_entry e(p);
     file_status ps = fs::symlink_status(p);
     file_status es = e.symlink_status();
-    TEST_CHECK(ps.type() == es.type());
-    TEST_CHECK(ps.permissions() == es.permissions());
+    assert(ps.type() == es.type());
+    assert(ps.permissions() == es.permissions());
   }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  test_signature();
+  return 0;
+}
index 47041cb..d37053a 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(directory_iterator_copy_construct_tests)
-
-TEST_CASE(test_constructor_signature)
+static void test_constructor_signature()
 {
     using D = directory_iterator;
     static_assert(std::is_copy_constructible<D>::value, "");
 }
 
-TEST_CASE(test_copy_end_iterator)
+static void test_copy_end_iterator()
 {
     const directory_iterator endIt;
     directory_iterator it(endIt);
-    TEST_CHECK(it == endIt);
+    assert(it == endIt);
 }
 
-TEST_CASE(test_copy_valid_iterator)
+static void test_copy_valid_iterator()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
     const directory_iterator endIt{};
 
     const directory_iterator it(testDir);
-    TEST_REQUIRE(it != endIt);
+    assert(it != endIt);
     const path entry = *it;
 
     const directory_iterator it2(it);
-    TEST_REQUIRE(it2 == it);
-    TEST_CHECK(*it2 == entry);
-    TEST_CHECK(*it == entry);
+    assert(it2 == it);
+    assert(*it2 == entry);
+    assert(*it == entry);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_constructor_signature();
+    test_copy_end_iterator();
+    test_copy_valid_iterator();
+
+    return 0;
+}
index e6f6d16..c1f96e1 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(directory_iterator_copy_assign_tests)
-
-TEST_CASE(test_assignment_signature)
+static void test_assignment_signature()
 {
     using D = directory_iterator;
     static_assert(std::is_copy_assignable<D>::value, "");
 }
 
-TEST_CASE(test_copy_to_end_iterator)
+static void test_copy_to_end_iterator()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
 
     const directory_iterator from(testDir);
-    TEST_REQUIRE(from != directory_iterator{});
+    assert(from != directory_iterator{});
     const path entry = *from;
 
     directory_iterator to{};
     to = from;
-    TEST_REQUIRE(to == from);
-    TEST_CHECK(*to == entry);
-    TEST_CHECK(*from == entry);
+    assert(to == from);
+    assert(*to == entry);
+    assert(*from == entry);
 }
 
 
-TEST_CASE(test_copy_from_end_iterator)
+static void test_copy_from_end_iterator()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -58,14 +55,14 @@ TEST_CASE(test_copy_from_end_iterator)
     const directory_iterator from{};
 
     directory_iterator to(testDir);
-    TEST_REQUIRE(to != directory_iterator{});
+    assert(to != directory_iterator{});
 
     to = from;
-    TEST_REQUIRE(to == from);
-    TEST_CHECK(to == directory_iterator{});
+    assert(to == from);
+    assert(to == directory_iterator{});
 }
 
-TEST_CASE(test_copy_valid_iterator)
+static void test_copy_valid_iterator()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -73,28 +70,35 @@ TEST_CASE(test_copy_valid_iterator)
 
     directory_iterator it_obj(testDir);
     const directory_iterator& it = it_obj;
-    TEST_REQUIRE(it != endIt);
+    assert(it != endIt);
     ++it_obj;
-    TEST_REQUIRE(it != endIt);
+    assert(it != endIt);
     const path entry = *it;
 
     directory_iterator it2(testDir);
-    TEST_REQUIRE(it2 != it);
+    assert(it2 != it);
     const path entry2 = *it2;
-    TEST_CHECK(entry2 != entry);
+    assert(entry2 != entry);
 
     it2 = it;
-    TEST_REQUIRE(it2 == it);
-    TEST_CHECK(*it2 == entry);
+    assert(it2 == it);
+    assert(*it2 == entry);
 }
 
-TEST_CASE(test_returns_reference_to_self)
+static void test_returns_reference_to_self()
 {
     const directory_iterator it;
     directory_iterator it2;
     directory_iterator& ref = (it2 = it);
-    TEST_CHECK(&ref == &it2);
+    assert(&ref == &it2);
 }
 
+int main(int, char**) {
+    test_assignment_signature();
+    test_copy_to_end_iterator();
+    test_copy_from_end_iterator();
+    test_copy_valid_iterator();
+    test_returns_reference_to_self();
 
-TEST_SUITE_END()
+    return 0;
+}
index 4ab9a2d..67a0703 100644 (file)
 #include <set>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(directory_iterator_constructor_tests)
-
-TEST_CASE(test_constructor_signatures)
+static void test_constructor_signatures()
 {
     using D = directory_iterator;
 
@@ -57,7 +55,7 @@ TEST_CASE(test_constructor_signatures)
 
 }
 
-TEST_CASE(test_construction_from_bad_path)
+static void test_construction_from_bad_path()
 {
     static_test_env static_env;
     std::error_code ec;
@@ -69,22 +67,22 @@ TEST_CASE(test_construction_from_bad_path)
     {
         {
             directory_iterator it(testPath, ec);
-            TEST_CHECK(ec);
-            TEST_CHECK(it == endIt);
+            assert(ec);
+            assert(it == endIt);
         }
         {
             directory_iterator it(testPath, opts, ec);
-            TEST_CHECK(ec);
-            TEST_CHECK(it == endIt);
+            assert(ec);
+            assert(it == endIt);
         }
         {
-            TEST_CHECK_THROW(filesystem_error, directory_iterator(testPath));
-            TEST_CHECK_THROW(filesystem_error, directory_iterator(testPath, opts));
+            TEST_THROWS_TYPE(filesystem_error, directory_iterator(testPath));
+            TEST_THROWS_TYPE(filesystem_error, directory_iterator(testPath, opts));
         }
     }
 }
 
-TEST_CASE(access_denied_test_case)
+static void access_denied_test_case()
 {
     using namespace fs;
 #ifdef _WIN32
@@ -93,7 +91,7 @@ TEST_CASE(access_denied_test_case)
     // instead.
     const path testDir = GetWindowsInaccessibleDir();
     if (testDir.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     scoped_test_env env;
     path const testDir = env.make_env_path("dir1");
@@ -104,7 +102,7 @@ TEST_CASE(access_denied_test_case)
     // Test that we can iterator over the directory before changing the perms
     {
         directory_iterator it(testDir);
-        TEST_REQUIRE(it != directory_iterator{});
+        assert(it != directory_iterator{});
     }
     // Change the permissions so we can no longer iterate
     permissions(testDir, perms::none);
@@ -115,21 +113,21 @@ TEST_CASE(access_denied_test_case)
     {
         std::error_code ec;
         directory_iterator it(testDir, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(it == directory_iterator{});
+        assert(ec);
+        assert(it == directory_iterator{});
     }
     // Check that construction does not report an error when
     // 'skip_permissions_denied' is given.
     {
         std::error_code ec;
         directory_iterator it(testDir, directory_options::skip_permission_denied, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(it == directory_iterator{});
+        assert(!ec);
+        assert(it == directory_iterator{});
     }
 }
 
 
-TEST_CASE(access_denied_to_file_test_case)
+static void access_denied_to_file_test_case()
 {
     using namespace fs;
     scoped_test_env env;
@@ -144,20 +142,20 @@ TEST_CASE(access_denied_to_file_test_case)
     {
         std::error_code ec;
         directory_iterator it(testFile, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(it == directory_iterator{});
+        assert(ec);
+        assert(it == directory_iterator{});
     }
     // Check that construction still fails when 'skip_permissions_denied' is given
     // because we tried to open a file and not a directory.
     {
         std::error_code ec;
         directory_iterator it(testFile, directory_options::skip_permission_denied, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(it == directory_iterator{});
+        assert(ec);
+        assert(it == directory_iterator{});
     }
 }
 
-TEST_CASE(test_open_on_empty_directory_equals_end)
+static void test_open_on_empty_directory_equals_end()
 {
     scoped_test_env env;
     const path testDir = env.make_env_path("dir1");
@@ -167,16 +165,16 @@ TEST_CASE(test_open_on_empty_directory_equals_end)
     {
         std::error_code ec;
         directory_iterator it(testDir, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(it == endIt);
+        assert(!ec);
+        assert(it == endIt);
     }
     {
         directory_iterator it(testDir);
-        TEST_CHECK(it == endIt);
+        assert(it == endIt);
     }
 }
 
-TEST_CASE(test_open_on_directory_succeeds)
+static void test_open_on_directory_succeeds()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -187,18 +185,18 @@ TEST_CASE(test_open_on_directory_succeeds)
     {
         std::error_code ec;
         directory_iterator it(testDir, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(it != endIt);
-        TEST_CHECK(dir_contents.count(*it));
+        assert(!ec);
+        assert(it != endIt);
+        assert(dir_contents.count(*it));
     }
     {
         directory_iterator it(testDir);
-        TEST_CHECK(it != endIt);
-        TEST_CHECK(dir_contents.count(*it));
+        assert(it != endIt);
+        assert(dir_contents.count(*it));
     }
 }
 
-TEST_CASE(test_open_on_file_fails)
+static void test_open_on_file_fails()
 {
     static_test_env static_env;
     const path testFile = static_env.File;
@@ -206,35 +204,35 @@ TEST_CASE(test_open_on_file_fails)
     {
         std::error_code ec;
         directory_iterator it(testFile, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(it == endIt);
+        assert(ec);
+        assert(it == endIt);
     }
     {
-        TEST_CHECK_THROW(filesystem_error, directory_iterator(testFile));
+        TEST_THROWS_TYPE(filesystem_error, directory_iterator(testFile));
     }
 }
 
-TEST_CASE(test_open_on_empty_string)
+static void test_open_on_empty_string()
 {
     const path testPath = "";
     const directory_iterator endIt{};
 
     std::error_code ec;
     directory_iterator it(testPath, ec);
-    TEST_CHECK(ec);
-    TEST_CHECK(it == endIt);
+    assert(ec);
+    assert(it == endIt);
 }
 
-TEST_CASE(test_open_on_dot_dir)
+static void test_open_on_dot_dir()
 {
     const path testPath = ".";
 
     std::error_code ec;
     directory_iterator it(testPath, ec);
-    TEST_CHECK(!ec);
+    assert(!ec);
 }
 
-TEST_CASE(test_open_on_symlink)
+static void test_open_on_symlink()
 {
     static_test_env static_env;
     const path symlinkToDir = static_env.SymlinkToDir;
@@ -247,20 +245,33 @@ TEST_CASE(test_open_on_symlink)
     {
         std::error_code ec;
         directory_iterator it(symlinkToDir, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(it != endIt);
+        assert(!ec);
+        assert(it != endIt);
         path const& entry = *it;
-        TEST_CHECK(dir_contents.count(entry.filename()));
+        assert(dir_contents.count(entry.filename()));
     }
     {
         std::error_code ec;
         directory_iterator it(symlinkToDir,
                               directory_options::follow_directory_symlink, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(it != endIt);
+        assert(!ec);
+        assert(it != endIt);
         path const& entry = *it;
-        TEST_CHECK(dir_contents.count(entry.filename()));
+        assert(dir_contents.count(entry.filename()));
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_constructor_signatures();
+    test_construction_from_bad_path();
+    access_denied_test_case();
+    access_denied_to_file_test_case();
+    test_open_on_empty_directory_equals_end();
+    test_open_on_directory_succeeds();
+    test_open_on_file_fails();
+    test_open_on_empty_string();
+    test_open_on_dot_dir();
+    test_open_on_symlink();
+
+    return 0;
+}
index 09b5139..ca83031 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(directory_iterator_increment_tests)
-
-TEST_CASE(test_increment_signatures)
+static void test_increment_signatures()
 {
     directory_iterator d; ((void)d);
     std::error_code ec; ((void)ec);
@@ -40,7 +37,7 @@ TEST_CASE(test_increment_signatures)
     ASSERT_NOT_NOEXCEPT(d.increment(ec));
 }
 
-TEST_CASE(test_prefix_increment)
+static void test_prefix_increment()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -50,21 +47,21 @@ TEST_CASE(test_prefix_increment)
 
     std::error_code ec;
     directory_iterator it(testDir, ec);
-    TEST_REQUIRE(!ec);
+    assert(!ec);
 
     std::set<path> unseen_entries = dir_contents;
     while (!unseen_entries.empty()) {
-        TEST_REQUIRE(it != endIt);
+        assert(it != endIt);
         const path entry = *it;
-        TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+        assert(unseen_entries.erase(entry) == 1);
         directory_iterator& it_ref = ++it;
-        TEST_CHECK(&it_ref == &it);
+        assert(&it_ref == &it);
     }
 
-    TEST_CHECK(it == endIt);
+    assert(it == endIt);
 }
 
-TEST_CASE(test_postfix_increment)
+static void test_postfix_increment()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -74,22 +71,22 @@ TEST_CASE(test_postfix_increment)
 
     std::error_code ec;
     directory_iterator it(testDir, ec);
-    TEST_REQUIRE(!ec);
+    assert(!ec);
 
     std::set<path> unseen_entries = dir_contents;
     while (!unseen_entries.empty()) {
-        TEST_REQUIRE(it != endIt);
+        assert(it != endIt);
         const path entry = *it;
-        TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+        assert(unseen_entries.erase(entry) == 1);
         const path entry2 = *it++;
-        TEST_CHECK(entry2 == entry);
+        assert(entry2 == entry);
     }
 
-    TEST_CHECK(it == endIt);
+    assert(it == endIt);
 }
 
 
-TEST_CASE(test_increment_method)
+static void test_increment_method()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -99,19 +96,26 @@ TEST_CASE(test_increment_method)
 
     std::error_code ec;
     directory_iterator it(testDir, ec);
-    TEST_REQUIRE(!ec);
+    assert(!ec);
 
     std::set<path> unseen_entries = dir_contents;
     while (!unseen_entries.empty()) {
-        TEST_REQUIRE(it != endIt);
+        assert(it != endIt);
         const path entry = *it;
-        TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+        assert(unseen_entries.erase(entry) == 1);
         directory_iterator& it_ref = it.increment(ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(&it_ref == &it);
+        assert(!ec);
+        assert(&it_ref == &it);
     }
 
-    TEST_CHECK(it == endIt);
+    assert(it == endIt);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_increment_signatures();
+    test_prefix_increment();
+    test_postfix_increment();
+    test_increment_method();
+
+    return 0;
+}
index 6ae6eed..a1f730e 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(directory_iterator_move_construct_tests)
-
-TEST_CASE(test_constructor_signature)
+static void test_constructor_signature()
 {
     using D = directory_iterator;
     static_assert(std::is_nothrow_move_constructible<D>::value, "");
 }
 
-TEST_CASE(test_move_end_iterator)
+static void test_move_end_iterator()
 {
     const directory_iterator endIt;
     directory_iterator endIt2{};
 
     directory_iterator it(std::move(endIt2));
-    TEST_CHECK(it == endIt);
-    TEST_CHECK(endIt2 == endIt);
+    assert(it == endIt);
+    assert(endIt2 == endIt);
 }
 
-TEST_CASE(test_move_valid_iterator)
+static void test_move_valid_iterator()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
     const directory_iterator endIt{};
 
     directory_iterator it(testDir);
-    TEST_REQUIRE(it != endIt);
+    assert(it != endIt);
     const path entry = *it;
 
     const directory_iterator it2(std::move(it));
-    TEST_CHECK(*it2 == entry);
+    assert(*it2 == entry);
 
-    TEST_CHECK(it == it2 || it == endIt);
+    assert(it == it2 || it == endIt);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_constructor_signature();
+    test_move_end_iterator();
+    test_move_valid_iterator();
+
+    return 0;
+}
index d0beee1..636c54b 100644 (file)
@@ -20,7 +20,6 @@
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 // The filesystem specification explicitly allows for self-move on
@@ -29,31 +28,29 @@ TEST_CLANG_DIAGNOSTIC_IGNORED("-Wself-move")
 
 using namespace fs;
 
-TEST_SUITE(directory_iterator_move_assign_tests)
-
-TEST_CASE(test_assignment_signature)
+static void test_assignment_signature()
 {
     using D = directory_iterator;
     static_assert(std::is_nothrow_move_assignable<D>::value, "");
 }
 
-TEST_CASE(test_move_to_end_iterator)
+static void test_move_to_end_iterator()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
 
     directory_iterator from(testDir);
-    TEST_REQUIRE(from != directory_iterator{});
+    assert(from != directory_iterator{});
     const path entry = *from;
 
     directory_iterator to{};
     to = std::move(from);
-    TEST_REQUIRE(to != directory_iterator{});
-    TEST_CHECK(*to == entry);
+    assert(to != directory_iterator{});
+    assert(*to == entry);
 }
 
 
-TEST_CASE(test_move_from_end_iterator)
+static void test_move_from_end_iterator()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -61,57 +58,65 @@ TEST_CASE(test_move_from_end_iterator)
     directory_iterator from{};
 
     directory_iterator to(testDir);
-    TEST_REQUIRE(to != from);
+    assert(to != from);
 
     to = std::move(from);
-    TEST_REQUIRE(to == directory_iterator{});
-    TEST_REQUIRE(from == directory_iterator{});
+    assert(to == directory_iterator{});
+    assert(from == directory_iterator{});
 }
 
-TEST_CASE(test_move_valid_iterator)
+static void test_move_valid_iterator()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
     const directory_iterator endIt{};
 
     directory_iterator it(testDir);
-    TEST_REQUIRE(it != endIt);
+    assert(it != endIt);
     ++it;
-    TEST_REQUIRE(it != endIt);
+    assert(it != endIt);
     const path entry = *it;
 
     directory_iterator it2(testDir);
-    TEST_REQUIRE(it2 != it);
+    assert(it2 != it);
     const path entry2 = *it2;
-    TEST_CHECK(entry2 != entry);
+    assert(entry2 != entry);
 
     it2 = std::move(it);
-    TEST_REQUIRE(it2 != directory_iterator{});
-    TEST_CHECK(*it2 == entry);
+    assert(it2 != directory_iterator{});
+    assert(*it2 == entry);
 }
 
-TEST_CASE(test_returns_reference_to_self)
+static void test_returns_reference_to_self()
 {
     directory_iterator it;
     directory_iterator it2;
     directory_iterator& ref = (it2 = it);
-    TEST_CHECK(&ref == &it2);
+    assert(&ref == &it2);
 }
 
 
-TEST_CASE(test_self_move)
+static void test_self_move()
 {
     static_test_env static_env;
     // Create two non-equal iterators that have exactly the same state.
     directory_iterator it(static_env.Dir);
     directory_iterator it2(static_env.Dir);
     ++it; ++it2;
-    TEST_CHECK(it != it2);
-    TEST_CHECK(*it2 == *it);
+    assert(it != it2);
+    assert(*it2 == *it);
 
     it = std::move(it);
-    TEST_CHECK(*it2 == *it);
+    assert(*it2 == *it);
 }
 
+int main(int, char**) {
+    test_assignment_signature();
+    test_move_to_end_iterator();
+    test_move_from_end_iterator();
+    test_move_valid_iterator();
+    test_returns_reference_to_self();
+    test_self_move();
 
-TEST_SUITE_END()
+    return 0;
+}
index f6f0bbe..44cde7e 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(directory_iterator_begin_end_tests)
-
-TEST_CASE(test_function_signatures)
+static void test_function_signatures()
 {
     directory_iterator d;
 
@@ -43,7 +40,7 @@ TEST_CASE(test_function_signatures)
     ASSERT_NOEXCEPT(end(std::move(d)));
 }
 
-TEST_CASE(test_ranged_for_loop)
+static void test_ranged_for_loop()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -52,12 +49,17 @@ TEST_CASE(test_ranged_for_loop)
 
     std::error_code ec;
     directory_iterator it(testDir, ec);
-    TEST_REQUIRE(!ec);
+    assert(!ec);
 
     for (auto& elem : it) {
-        TEST_CHECK(dir_contents.erase(elem) == 1);
+        assert(dir_contents.erase(elem) == 1);
     }
-    TEST_CHECK(dir_contents.empty());
+    assert(dir_contents.empty());
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_function_signatures();
+    test_ranged_for_loop();
+
+    return 0;
+}
index aacf160..3e007dd 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(recursive_directory_iterator_copy_construct_tests)
-
-TEST_CASE(test_constructor_signature)
+static void test_constructor_signature()
 {
     using D = recursive_directory_iterator;
     static_assert(std::is_copy_constructible<D>::value, "");
     //static_assert(!std::is_nothrow_copy_constructible<D>::value, "");
 }
 
-TEST_CASE(test_copy_end_iterator)
+static void test_copy_end_iterator()
 {
     const recursive_directory_iterator endIt;
     recursive_directory_iterator it(endIt);
-    TEST_CHECK(it == endIt);
+    assert(it == endIt);
 }
 
-TEST_CASE(test_copy_valid_iterator)
+static void test_copy_valid_iterator()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -54,26 +51,32 @@ TEST_CASE(test_copy_valid_iterator)
     //  it.recursion_pending() != true
     const directory_options opts = directory_options::skip_permission_denied;
     recursive_directory_iterator it(testDir, opts);
-    TEST_REQUIRE(it != endIt);
+    assert(it != endIt);
     while (it.depth() == 0) {
         ++it;
-        TEST_REQUIRE(it != endIt);
+        assert(it != endIt);
     }
     it.disable_recursion_pending();
-    TEST_CHECK(it.options() == opts);
-    TEST_CHECK(it.depth() == 1);
-    TEST_CHECK(it.recursion_pending() == false);
+    assert(it.options() == opts);
+    assert(it.depth() == 1);
+    assert(it.recursion_pending() == false);
     const path entry = *it;
 
     // OPERATION UNDER TEST //
     const recursive_directory_iterator it2(it);
     // ------------------- //
 
-    TEST_REQUIRE(it2 == it);
-    TEST_CHECK(*it2 == entry);
-    TEST_CHECK(it2.depth() == 1);
-    TEST_CHECK(it2.recursion_pending() == false);
-    TEST_CHECK(it != endIt);
+    assert(it2 == it);
+    assert(*it2 == entry);
+    assert(it2.depth() == 1);
+    assert(it2.recursion_pending() == false);
+    assert(it != endIt);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_constructor_signature();
+    test_copy_end_iterator();
+    test_copy_valid_iterator();
+
+    return 0;
+}
index dc689ad..95a7762 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(recursive_directory_iterator_copy_assign_tests)
-
 recursive_directory_iterator createInterestingIterator(const static_test_env &static_env)
     // Create an "interesting" iterator where all fields are
     // in a non-default state. The returned 'it' is in a
@@ -39,12 +36,12 @@ recursive_directory_iterator createInterestingIterator(const static_test_env &st
     const recursive_directory_iterator endIt;
     recursive_directory_iterator it(testDir,
                                     directory_options::skip_permission_denied);
-    TEST_ASSERT(it != endIt);
+    assert(it != endIt);
     while (it.depth() != 1) {
         ++it;
-        TEST_ASSERT(it != endIt);
+        assert(it != endIt);
     }
-    TEST_ASSERT(it.depth() == 1);
+    assert(it.depth() == 1);
     it.disable_recursion_pending();
     return it;
 }
@@ -62,21 +59,21 @@ recursive_directory_iterator createDifferentInterestingIterator(const static_tes
     const recursive_directory_iterator endIt;
     recursive_directory_iterator it(testDir,
                                     directory_options::follow_directory_symlink);
-    TEST_ASSERT(it != endIt);
+    assert(it != endIt);
     while (it.depth() != 2) {
         ++it;
-        TEST_ASSERT(it != endIt);
+        assert(it != endIt);
     }
-    TEST_ASSERT(it.depth() == 2);
+    assert(it.depth() == 2);
     return it;
 }
 
-TEST_CASE(test_assignment_signature) {
+static void test_assignment_signature() {
     using D = recursive_directory_iterator;
     static_assert(std::is_copy_assignable<D>::value, "");
 }
 
-TEST_CASE(test_copy_to_end_iterator)
+static void test_copy_to_end_iterator()
 {
     static_test_env static_env;
     const recursive_directory_iterator endIt;
@@ -86,26 +83,26 @@ TEST_CASE(test_copy_to_end_iterator)
 
     recursive_directory_iterator to;
     to = from;
-    TEST_REQUIRE(to == from);
-    TEST_CHECK(*to == entry);
-    TEST_CHECK(to.options() == from.options());
-    TEST_CHECK(to.depth() == from.depth());
-    TEST_CHECK(to.recursion_pending() == from.recursion_pending());
+    assert(to == from);
+    assert(*to == entry);
+    assert(to.options() == from.options());
+    assert(to.depth() == from.depth());
+    assert(to.recursion_pending() == from.recursion_pending());
 }
 
 
-TEST_CASE(test_copy_from_end_iterator)
+static void test_copy_from_end_iterator()
 {
     static_test_env static_env;
     const recursive_directory_iterator from;
     recursive_directory_iterator to = createInterestingIterator(static_env);
 
     to = from;
-    TEST_REQUIRE(to == from);
-    TEST_CHECK(to == recursive_directory_iterator{});
+    assert(to == from);
+    assert(to == recursive_directory_iterator{});
 }
 
-TEST_CASE(test_copy_valid_iterator)
+static void test_copy_valid_iterator()
 {
     static_test_env static_env;
     const recursive_directory_iterator endIt;
@@ -114,48 +111,57 @@ TEST_CASE(test_copy_valid_iterator)
     const path entry = *it;
 
     recursive_directory_iterator it2 = createDifferentInterestingIterator(static_env);
-    TEST_REQUIRE(it2                   != it);
-    TEST_CHECK(it2.options()           != it.options());
-    TEST_CHECK(it2.depth()             != it.depth());
-    TEST_CHECK(it2.recursion_pending() != it.recursion_pending());
-    TEST_CHECK(*it2                    != entry);
+    assert(it2                   != it);
+    assert(it2.options()           != it.options());
+    assert(it2.depth()             != it.depth());
+    assert(it2.recursion_pending() != it.recursion_pending());
+    assert(*it2                    != entry);
 
     it2 = it;
-    TEST_REQUIRE(it2                   == it);
-    TEST_CHECK(it2.options()           == it.options());
-    TEST_CHECK(it2.depth()             == it.depth());
-    TEST_CHECK(it2.recursion_pending() == it.recursion_pending());
-    TEST_CHECK(*it2                    == entry);
+    assert(it2                   == it);
+    assert(it2.options()           == it.options());
+    assert(it2.depth()             == it.depth());
+    assert(it2.recursion_pending() == it.recursion_pending());
+    assert(*it2                    == entry);
 }
 
-TEST_CASE(test_returns_reference_to_self)
+static void test_returns_reference_to_self()
 {
     const recursive_directory_iterator it;
     recursive_directory_iterator it2;
     recursive_directory_iterator& ref = (it2 = it);
-    TEST_CHECK(&ref == &it2);
+    assert(&ref == &it2);
 }
 
-TEST_CASE(test_self_copy)
+static void test_self_copy()
 {
     static_test_env static_env;
     // Create two non-equal iterators that have exactly the same state.
     recursive_directory_iterator it = createInterestingIterator(static_env);
     recursive_directory_iterator it2 = createInterestingIterator(static_env);
-    TEST_CHECK(it != it2);
-    TEST_CHECK(it2.options()           == it.options());
-    TEST_CHECK(it2.depth()             == it.depth());
-    TEST_CHECK(it2.recursion_pending() == it.recursion_pending());
-    TEST_CHECK(*it2 == *it);
+    assert(it != it2);
+    assert(it2.options()           == it.options());
+    assert(it2.depth()             == it.depth());
+    assert(it2.recursion_pending() == it.recursion_pending());
+    assert(*it2 == *it);
 
     // perform a self-copy and check that the state still matches the
     // other unmodified iterator.
     recursive_directory_iterator const& cit = it;
     it = cit;
-    TEST_CHECK(it2.options()           == it.options());
-    TEST_CHECK(it2.depth()             == it.depth());
-    TEST_CHECK(it2.recursion_pending() == it.recursion_pending());
-    TEST_CHECK(*it2 == *it);
+    assert(it2.options()           == it.options());
+    assert(it2.depth()             == it.depth());
+    assert(it2.recursion_pending() == it.recursion_pending());
+    assert(*it2 == *it);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_assignment_signature();
+    test_copy_to_end_iterator();
+    test_copy_from_end_iterator();
+    test_copy_valid_iterator();
+    test_returns_reference_to_self();
+    test_self_copy();
+
+    return 0;
+}
index 5a18c46..ced81b9 100644 (file)
 #include <set>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
 using RDI = recursive_directory_iterator;
 
-TEST_SUITE(recursive_directory_iterator_constructor_tests)
-
-TEST_CASE(test_constructor_signatures)
+static void test_constructor_signatures()
 {
     using D = recursive_directory_iterator;
 
@@ -58,7 +56,7 @@ TEST_CASE(test_constructor_signatures)
     static_assert(!std::is_nothrow_constructible<D, path, directory_options, std::error_code&>::value, "");
 }
 
-TEST_CASE(test_construction_from_bad_path)
+static void test_construction_from_bad_path()
 {
     static_test_env static_env;
     std::error_code ec;
@@ -70,22 +68,22 @@ TEST_CASE(test_construction_from_bad_path)
     {
         {
             RDI it(testPath, ec);
-            TEST_CHECK(ec);
-            TEST_CHECK(it == endIt);
+            assert(ec);
+            assert(it == endIt);
         }
         {
             RDI it(testPath, opts, ec);
-            TEST_CHECK(ec);
-            TEST_CHECK(it == endIt);
+            assert(ec);
+            assert(it == endIt);
         }
         {
-            TEST_CHECK_THROW(filesystem_error, RDI(testPath));
-            TEST_CHECK_THROW(filesystem_error, RDI(testPath, opts));
+            TEST_THROWS_TYPE(filesystem_error, RDI(testPath));
+            TEST_THROWS_TYPE(filesystem_error, RDI(testPath, opts));
         }
     }
 }
 
-TEST_CASE(access_denied_test_case)
+static void access_denied_test_case()
 {
     using namespace fs;
 #ifdef _WIN32
@@ -94,7 +92,7 @@ TEST_CASE(access_denied_test_case)
     // instead.
     const path testDir = GetWindowsInaccessibleDir();
     if (testDir.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     scoped_test_env env;
     path const testDir = env.make_env_path("dir1");
@@ -105,7 +103,7 @@ TEST_CASE(access_denied_test_case)
     // Test that we can iterator over the directory before changing the perms
     {
         RDI it(testDir);
-        TEST_REQUIRE(it != RDI{});
+        assert(it != RDI{});
     }
 
     // Change the permissions so we can no longer iterate
@@ -117,21 +115,21 @@ TEST_CASE(access_denied_test_case)
     {
         std::error_code ec;
         RDI it(testDir, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(it == RDI{});
+        assert(ec);
+        assert(it == RDI{});
     }
     // Check that construction does not report an error when
     // 'skip_permissions_denied' is given.
     {
         std::error_code ec;
         RDI it(testDir, directory_options::skip_permission_denied, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(it == RDI{});
+        assert(!ec);
+        assert(it == RDI{});
     }
 }
 
 
-TEST_CASE(access_denied_to_file_test_case)
+static void access_denied_to_file_test_case()
 {
     using namespace fs;
 #ifdef _WIN32
@@ -140,7 +138,7 @@ TEST_CASE(access_denied_to_file_test_case)
     // instead.
     const path testDir = GetWindowsInaccessibleDir();
     if (testDir.empty())
-        TEST_UNSUPPORTED();
+        return;
     path const testFile = testDir / "inaccessible_file";
 #else
     scoped_test_env env;
@@ -156,20 +154,20 @@ TEST_CASE(access_denied_to_file_test_case)
     {
         std::error_code ec;
         RDI it(testFile, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(it == RDI{});
+        assert(ec);
+        assert(it == RDI{});
     }
     // Check that construction still fails when 'skip_permissions_denied' is given
     // because we tried to open a file and not a directory.
     {
         std::error_code ec;
         RDI it(testFile, directory_options::skip_permission_denied, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(it == RDI{});
+        assert(ec);
+        assert(it == RDI{});
     }
 }
 
-TEST_CASE(test_open_on_empty_directory_equals_end)
+static void test_open_on_empty_directory_equals_end()
 {
     scoped_test_env env;
     const path testDir = env.make_env_path("dir1");
@@ -179,16 +177,16 @@ TEST_CASE(test_open_on_empty_directory_equals_end)
     {
         std::error_code ec;
         RDI it(testDir, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(it == endIt);
+        assert(!ec);
+        assert(it == endIt);
     }
     {
         RDI it(testDir);
-        TEST_CHECK(it == endIt);
+        assert(it == endIt);
     }
 }
 
-TEST_CASE(test_open_on_directory_succeeds)
+static void test_open_on_directory_succeeds()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -199,18 +197,18 @@ TEST_CASE(test_open_on_directory_succeeds)
     {
         std::error_code ec;
         RDI it(testDir, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(it != endIt);
-        TEST_CHECK(dir_contents.count(*it));
+        assert(!ec);
+        assert(it != endIt);
+        assert(dir_contents.count(*it));
     }
     {
         RDI it(testDir);
-        TEST_CHECK(it != endIt);
-        TEST_CHECK(dir_contents.count(*it));
+        assert(it != endIt);
+        assert(dir_contents.count(*it));
     }
 }
 
-TEST_CASE(test_open_on_file_fails)
+static void test_open_on_file_fails()
 {
     static_test_env static_env;
     const path testFile = static_env.File;
@@ -218,15 +216,15 @@ TEST_CASE(test_open_on_file_fails)
     {
         std::error_code ec;
         RDI it(testFile, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(it == endIt);
+        assert(ec);
+        assert(it == endIt);
     }
     {
-        TEST_CHECK_THROW(filesystem_error, RDI(testFile));
+        TEST_THROWS_TYPE(filesystem_error, RDI(testFile));
     }
 }
 
-TEST_CASE(test_options_post_conditions)
+static void test_options_post_conditions()
 {
     static_test_env static_env;
     const path goodDir = static_env.Dir;
@@ -236,33 +234,45 @@ TEST_CASE(test_options_post_conditions)
         std::error_code ec;
 
         RDI it1(goodDir, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(it1.options() == directory_options::none);
+        assert(!ec);
+        assert(it1.options() == directory_options::none);
 
         RDI it2(badDir, ec);
-        TEST_REQUIRE(ec);
-        TEST_REQUIRE(it2 == RDI{});
+        assert(ec);
+        assert(it2 == RDI{});
     }
     {
         std::error_code ec;
         const directory_options opts = directory_options::skip_permission_denied;
 
         RDI it1(goodDir, opts, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(it1.options() == opts);
+        assert(!ec);
+        assert(it1.options() == opts);
 
         RDI it2(badDir, opts, ec);
-        TEST_REQUIRE(ec);
-        TEST_REQUIRE(it2 == RDI{});
+        assert(ec);
+        assert(it2 == RDI{});
     }
     {
         RDI it(goodDir);
-        TEST_CHECK(it.options() == directory_options::none);
+        assert(it.options() == directory_options::none);
     }
     {
         const directory_options opts = directory_options::follow_directory_symlink;
         RDI it(goodDir, opts);
-        TEST_CHECK(it.options() == opts);
+        assert(it.options() == opts);
     }
 }
-TEST_SUITE_END()
+
+int main(int, char**) {
+    test_constructor_signatures();
+    test_construction_from_bad_path();
+    access_denied_test_case();
+    access_denied_to_file_test_case();
+    test_open_on_empty_directory_equals_end();
+    test_open_on_directory_succeeds();
+    test_open_on_file_fails();
+    test_options_post_conditions();
+
+    return 0;
+}
index 4983665..32bd074 100644 (file)
 #include <set>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(recursive_directory_iterator_depth_tests)
-
-TEST_CASE(test_depth)
+static void test_depth()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -37,8 +35,8 @@ TEST_CASE(test_depth)
 
     std::error_code ec;
     recursive_directory_iterator it(testDir, ec);
-    TEST_REQUIRE(!ec);
-    TEST_CHECK(it.depth() == 0);
+    assert(!ec);
+    assert(it.depth() == 0);
 
     bool seen_d1, seen_d2;
     seen_d1 = seen_d2 = false;
@@ -47,20 +45,24 @@ TEST_CASE(test_depth)
         const path entry = *it;
         const path parent = entry.parent_path();
         if (parent == testDir) {
-            TEST_CHECK(it.depth() == 0);
+            assert(it.depth() == 0);
         } else if (parent == DirDepth1) {
-            TEST_CHECK(it.depth() == 1);
+            assert(it.depth() == 1);
             seen_d1 = true;
         } else if (parent == DirDepth2) {
-            TEST_CHECK(it.depth() == 2);
+            assert(it.depth() == 2);
             seen_d2 = true;
         } else {
-            TEST_CHECK(!"Unexpected depth while iterating over static env");
+            assert(!"Unexpected depth while iterating over static env");
         }
         ++it;
     }
-    TEST_REQUIRE(seen_d1 && seen_d2);
-    TEST_CHECK(it == endIt);
+    assert(seen_d1 && seen_d2);
+    assert(it == endIt);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_depth();
+
+    return 0;
+}
index e9dc964..061046e 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(recursive_directory_iterator_disable_recursion_pending_tests)
 
 // NOTE: The main semantics of disable_recursion_pending are tested
 // in the 'recursion_pending()' tests.
-TEST_CASE(basic_test)
+static void basic_test()
 {
     static_test_env static_env;
     recursive_directory_iterator it(static_env.Dir);
-    TEST_REQUIRE(it.recursion_pending() == true);
+    assert(it.recursion_pending() == true);
     it.disable_recursion_pending();
-    TEST_CHECK(it.recursion_pending() == false);
+    assert(it.recursion_pending() == false);
     it.disable_recursion_pending();
-    TEST_CHECK(it.recursion_pending() == false);
+    assert(it.recursion_pending() == false);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    basic_test();
+
+    return 0;
+}
index 4b8390e..9a157ad 100644 (file)
 #include <set>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(recursive_directory_iterator_increment_tests)
-
-TEST_CASE(test_increment_signatures)
+static void test_increment_signatures()
 {
     recursive_directory_iterator d; ((void)d);
     std::error_code ec; ((void)ec);
@@ -40,7 +38,7 @@ TEST_CASE(test_increment_signatures)
     ASSERT_NOT_NOEXCEPT(d.increment(ec));
 }
 
-TEST_CASE(test_prefix_increment)
+static void test_prefix_increment()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -50,21 +48,21 @@ TEST_CASE(test_prefix_increment)
 
     std::error_code ec;
     recursive_directory_iterator it(testDir, ec);
-    TEST_REQUIRE(!ec);
+    assert(!ec);
 
     std::set<path> unseen_entries = dir_contents;
     while (!unseen_entries.empty()) {
-        TEST_REQUIRE(it != endIt);
+        assert(it != endIt);
         const path entry = *it;
-        TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+        assert(unseen_entries.erase(entry) == 1);
         recursive_directory_iterator& it_ref = ++it;
-        TEST_CHECK(&it_ref == &it);
+        assert(&it_ref == &it);
     }
 
-    TEST_CHECK(it == endIt);
+    assert(it == endIt);
 }
 
-TEST_CASE(test_postfix_increment)
+static void test_postfix_increment()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -74,21 +72,21 @@ TEST_CASE(test_postfix_increment)
 
     std::error_code ec;
     recursive_directory_iterator it(testDir, ec);
-    TEST_REQUIRE(!ec);
+    assert(!ec);
 
     std::set<path> unseen_entries = dir_contents;
     while (!unseen_entries.empty()) {
-        TEST_REQUIRE(it != endIt);
+        assert(it != endIt);
         const path entry = *it;
-        TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+        assert(unseen_entries.erase(entry) == 1);
         const path entry2 = *it++;
-        TEST_CHECK(entry2 == entry);
+        assert(entry2 == entry);
     }
-    TEST_CHECK(it == endIt);
+    assert(it == endIt);
 }
 
 
-TEST_CASE(test_increment_method)
+static void test_increment_method()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -98,22 +96,22 @@ TEST_CASE(test_increment_method)
 
     std::error_code ec;
     recursive_directory_iterator it(testDir, ec);
-    TEST_REQUIRE(!ec);
+    assert(!ec);
 
     std::set<path> unseen_entries = dir_contents;
     while (!unseen_entries.empty()) {
-        TEST_REQUIRE(it != endIt);
+        assert(it != endIt);
         const path entry = *it;
-        TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+        assert(unseen_entries.erase(entry) == 1);
         recursive_directory_iterator& it_ref = it.increment(ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(&it_ref == &it);
+        assert(!ec);
+        assert(&it_ref == &it);
     }
 
-    TEST_CHECK(it == endIt);
+    assert(it == endIt);
 }
 
-TEST_CASE(test_follow_symlinks)
+static void test_follow_symlinks()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -125,25 +123,25 @@ TEST_CASE(test_follow_symlinks)
     std::error_code ec;
     recursive_directory_iterator it(testDir,
                               directory_options::follow_directory_symlink, ec);
-    TEST_REQUIRE(!ec);
+    assert(!ec);
 
     std::set<path> unseen_entries = dir_contents;
     while (!unseen_entries.empty()) {
-        TEST_REQUIRE(it != endIt);
+        assert(it != endIt);
         const path entry = *it;
 
-        TEST_REQUIRE(unseen_entries.erase(entry) == 1);
+        assert(unseen_entries.erase(entry) == 1);
         recursive_directory_iterator& it_ref = it.increment(ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(&it_ref == &it);
+        assert(!ec);
+        assert(&it_ref == &it);
     }
-    TEST_CHECK(it == endIt);
+    assert(it == endIt);
 }
 
 // Windows doesn't support setting perms::none to trigger failures
 // reading directories.
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
-TEST_CASE(access_denied_on_recursion_test_case)
+static void access_denied_on_recursion_test_case()
 {
     using namespace fs;
     scoped_test_env env;
@@ -168,54 +166,54 @@ TEST_CASE(access_denied_on_recursion_test_case)
     {
         std::error_code ec = GetTestEC();
         recursive_directory_iterator it(startDir, ec);
-        TEST_REQUIRE(ec != GetTestEC());
-        TEST_REQUIRE(!ec);
+        assert(ec != GetTestEC());
+        assert(!ec);
         while (it != endIt && it->path() != permDeniedDir)
             ++it;
-        TEST_REQUIRE(it != endIt);
-        TEST_REQUIRE(*it == permDeniedDir);
+        assert(it != endIt);
+        assert(*it == permDeniedDir);
 
         it.increment(ec);
-        TEST_CHECK(ec);
-        TEST_CHECK(it == endIt);
+        assert(ec);
+        assert(it == endIt);
     }
     // Same as above but test operator++().
     {
         std::error_code ec = GetTestEC();
         recursive_directory_iterator it(startDir, ec);
-        TEST_REQUIRE(!ec);
+        assert(!ec);
         while (it != endIt && it->path() != permDeniedDir)
             ++it;
-        TEST_REQUIRE(it != endIt);
-        TEST_REQUIRE(*it == permDeniedDir);
+        assert(it != endIt);
+        assert(*it == permDeniedDir);
 
-        TEST_REQUIRE_THROW(filesystem_error, ++it);
+        TEST_THROWS_TYPE(filesystem_error, ++it);
     }
     // Test that recursion resulting in a "EACCESS" error is ignored when the
     // correct options are given to the constructor.
     {
         std::error_code ec = GetTestEC();
         recursive_directory_iterator it(startDir, SkipEPerm, ec);
-        TEST_REQUIRE(!ec);
-        TEST_REQUIRE(it != endIt);
+        assert(!ec);
+        assert(it != endIt);
 
         bool seenOtherFile = false;
         if (*it == otherFile) {
             ++it;
             seenOtherFile = true;
-            TEST_REQUIRE (it != endIt);
+            assert (it != endIt);
         }
-        TEST_REQUIRE(*it == permDeniedDir);
+        assert(*it == permDeniedDir);
 
         ec = GetTestEC();
         it.increment(ec);
-        TEST_REQUIRE(!ec);
+        assert(!ec);
 
         if (seenOtherFile) {
-            TEST_CHECK(it == endIt);
+            assert(it == endIt);
         } else {
-            TEST_CHECK(it != endIt);
-            TEST_CHECK(*it == otherFile);
+            assert(it != endIt);
+            assert(*it == otherFile);
         }
     }
     // Test that construction resulting in a "EACCESS" error is not ignored
@@ -223,12 +221,12 @@ TEST_CASE(access_denied_on_recursion_test_case)
     {
         std::error_code ec;
         recursive_directory_iterator it(permDeniedDir, ec);
-        TEST_REQUIRE(ec);
-        TEST_REQUIRE(it == endIt);
+        assert(ec);
+        assert(it == endIt);
     }
     // Same as above but testing the throwing constructors
     {
-        TEST_REQUIRE_THROW(filesystem_error,
+        TEST_THROWS_TYPE(filesystem_error,
                            recursive_directory_iterator(permDeniedDir));
     }
     // Test that construction resulting in a "EACCESS" error constructs the
@@ -236,13 +234,13 @@ TEST_CASE(access_denied_on_recursion_test_case)
     {
         std::error_code ec = GetTestEC();
         recursive_directory_iterator it(permDeniedDir, SkipEPerm, ec);
-        TEST_REQUIRE(!ec);
-        TEST_REQUIRE(it == endIt);
+        assert(!ec);
+        assert(it == endIt);
     }
 }
 
 // See llvm.org/PR35078
-TEST_CASE(test_PR35078)
+static void test_PR35078()
 {
   using namespace fs;
     scoped_test_env env;
@@ -284,46 +282,46 @@ TEST_CASE(test_PR35078)
     {
       bool SeenNestedFile = false;
       recursive_directory_iterator it = SetupState(false, SeenNestedFile);
-      TEST_REQUIRE(it != endIt);
-      TEST_REQUIRE(*it == nestedDir);
+      assert(it != endIt);
+      assert(*it == nestedDir);
       ec = GetTestEC();
       it.increment(ec);
-      TEST_CHECK(ec);
-      TEST_CHECK(ErrorIs(ec, eacess));
-      TEST_CHECK(it == endIt);
+      assert(ec);
+      assert(ErrorIs(ec, eacess));
+      assert(it == endIt);
     }
     {
       bool SeenNestedFile = false;
       recursive_directory_iterator it = SetupState(true, SeenNestedFile);
-      TEST_REQUIRE(it != endIt);
-      TEST_REQUIRE(*it == nestedDir);
+      assert(it != endIt);
+      assert(*it == nestedDir);
       ec = GetTestEC();
       it.increment(ec);
-      TEST_CHECK(!ec);
+      assert(!ec);
       if (SeenNestedFile) {
-        TEST_CHECK(it == endIt);
+        assert(it == endIt);
       } else {
-        TEST_REQUIRE(it != endIt);
-        TEST_CHECK(*it == nestedFile);
+        assert(it != endIt);
+        assert(*it == nestedFile);
       }
     }
     {
       bool SeenNestedFile = false;
       recursive_directory_iterator it = SetupState(false, SeenNestedFile);
-      TEST_REQUIRE(it != endIt);
-      TEST_REQUIRE(*it == nestedDir);
+      assert(it != endIt);
+      assert(*it == nestedDir);
 
       ExceptionChecker Checker(std::errc::permission_denied,
                                "recursive_directory_iterator::operator++()",
                                format_string("attempting recursion into \"%s\"",
                                              nestedDir.string().c_str()));
-      TEST_CHECK_THROW_RESULT(filesystem_error, Checker, ++it);
+      TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, ++it);
     }
 }
 
 
 // See llvm.org/PR35078
-TEST_CASE(test_PR35078_with_symlink)
+static void test_PR35078_with_symlink()
 {
   using namespace fs;
     scoped_test_env env;
@@ -383,30 +381,30 @@ TEST_CASE(test_PR35078_with_symlink)
       recursive_directory_iterator it = SetupState(TC.SkipPermDenied,
                                                    TC.FollowSymlinks,
                                                    SeenNestedFile);
-      TEST_REQUIRE(!ec);
-      TEST_REQUIRE(it != endIt);
-      TEST_REQUIRE(*it == symDir);
+      assert(!ec);
+      assert(it != endIt);
+      assert(*it == symDir);
       ec = GetTestEC();
       it.increment(ec);
       if (TC.ExpectSuccess) {
-        TEST_CHECK(!ec);
+        assert(!ec);
         if (SeenNestedFile) {
-          TEST_CHECK(it == endIt);
+          assert(it == endIt);
         } else {
-          TEST_REQUIRE(it != endIt);
-          TEST_CHECK(*it == nestedFile);
+          assert(it != endIt);
+          assert(*it == nestedFile);
         }
       } else {
-        TEST_CHECK(ec);
-        TEST_CHECK(ErrorIs(ec, eacess));
-        TEST_CHECK(it == endIt);
+        assert(ec);
+        assert(ErrorIs(ec, eacess));
+        assert(it == endIt);
       }
     }
 }
 
 
 // See llvm.org/PR35078
-TEST_CASE(test_PR35078_with_symlink_file)
+static void test_PR35078_with_symlink_file()
 {
   using namespace fs;
     scoped_test_env env;
@@ -466,34 +464,47 @@ TEST_CASE(test_PR35078_with_symlink_file)
       recursive_directory_iterator it = SetupState(TC.SkipPermDenied,
                                                    TC.FollowSymlinks,
                                                    SeenNestedFile);
-      TEST_REQUIRE(!ec);
-      TEST_REQUIRE(it != EndIt);
-      TEST_REQUIRE(*it == nestedDir);
+      assert(!ec);
+      assert(it != EndIt);
+      assert(*it == nestedDir);
       ec = GetTestEC();
       it.increment(ec);
-      TEST_REQUIRE(it != EndIt);
-      TEST_CHECK(!ec);
-      TEST_CHECK(*it == symFile);
+      assert(it != EndIt);
+      assert(!ec);
+      assert(*it == symFile);
       ec = GetTestEC();
       it.increment(ec);
       if (TC.ExpectSuccess) {
         if (!SeenNestedFile) {
-          TEST_CHECK(!ec);
-          TEST_REQUIRE(it != EndIt);
-          TEST_CHECK(*it == nestedFile);
+          assert(!ec);
+          assert(it != EndIt);
+          assert(*it == nestedFile);
           ec = GetTestEC();
           it.increment(ec);
         }
-        TEST_CHECK(!ec);
-        TEST_CHECK(it == EndIt);
+        assert(!ec);
+        assert(it == EndIt);
       } else {
-        TEST_CHECK(ec);
-        TEST_CHECK(ErrorIs(ec, eacess));
-        TEST_CHECK(it == EndIt);
+        assert(ec);
+        assert(ErrorIs(ec, eacess));
+        assert(it == EndIt);
       }
     }
 }
+#endif // TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+
+int main(int, char**) {
+    test_increment_signatures();
+    test_prefix_increment();
+    test_postfix_increment();
+    test_increment_method();
+    test_follow_symlinks();
+#ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+    access_denied_on_recursion_test_case();
+    test_PR35078();
+    test_PR35078_with_symlink();
+    test_PR35078_with_symlink_file();
 #endif
 
-
-TEST_SUITE_END()
+    return 0;
+}
index 7dcc47d..be32042 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(recursive_directory_iterator_move_construct_tests)
-
-TEST_CASE(test_constructor_signature)
+static void test_constructor_signature()
 {
     using D = recursive_directory_iterator;
     static_assert(std::is_nothrow_move_constructible<D>::value, "");
 }
 
-TEST_CASE(test_move_end_iterator)
+static void test_move_end_iterator()
 {
     const recursive_directory_iterator endIt;
     recursive_directory_iterator endIt2{};
 
     recursive_directory_iterator it(std::move(endIt2));
-    TEST_CHECK(it == endIt);
-    TEST_CHECK(endIt2 == endIt);
+    assert(it == endIt);
+    assert(endIt2 == endIt);
 }
 
-TEST_CASE(test_move_valid_iterator)
+static void test_move_valid_iterator()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -56,25 +53,31 @@ TEST_CASE(test_move_valid_iterator)
     //  it.recursion_pending() != true
     const directory_options opts = directory_options::skip_permission_denied;
     recursive_directory_iterator it(testDir, opts);
-    TEST_REQUIRE(it != endIt);
+    assert(it != endIt);
     while (it.depth() == 0) {
         ++it;
-        TEST_REQUIRE(it != endIt);
+        assert(it != endIt);
     }
     it.disable_recursion_pending();
-    TEST_CHECK(it.options() == opts);
-    TEST_CHECK(it.depth() == 1);
-    TEST_CHECK(it.recursion_pending() == false);
+    assert(it.options() == opts);
+    assert(it.depth() == 1);
+    assert(it.recursion_pending() == false);
     const path entry = *it;
 
     // OPERATION UNDER TEST //
     const recursive_directory_iterator it2(std::move(it));
     // ------------------- //
 
-    TEST_REQUIRE(it2 != endIt);
-    TEST_CHECK(*it2 == entry);
-    TEST_CHECK(it2.depth() == 1);
-    TEST_CHECK(it2.recursion_pending() == false);
+    assert(it2 != endIt);
+    assert(*it2 == entry);
+    assert(it2.depth() == 1);
+    assert(it2.recursion_pending() == false);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_constructor_signature();
+    test_move_end_iterator();
+    test_move_valid_iterator();
+
+    return 0;
+}
index abe5dd7..65c3042 100644 (file)
@@ -20,7 +20,6 @@
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 // The filesystem specification explicitly allows for self-move on
@@ -29,8 +28,6 @@ TEST_CLANG_DIAGNOSTIC_IGNORED("-Wself-move")
 
 using namespace fs;
 
-TEST_SUITE(recursive_directory_iterator_move_assign_tests)
-
 recursive_directory_iterator createInterestingIterator(const static_test_env &static_env)
     // Create an "interesting" iterator where all fields are
     // in a non-default state. The returned 'it' is in a
@@ -43,12 +40,12 @@ recursive_directory_iterator createInterestingIterator(const static_test_env &st
     const recursive_directory_iterator endIt;
     recursive_directory_iterator it(testDir,
                                     directory_options::skip_permission_denied);
-    TEST_ASSERT(it != endIt);
+    assert(it != endIt);
     while (it.depth() != 1) {
         ++it;
-        TEST_ASSERT(it != endIt);
+        assert(it != endIt);
     }
-    TEST_ASSERT(it.depth() == 1);
+    assert(it.depth() == 1);
     it.disable_recursion_pending();
     return it;
 }
@@ -65,24 +62,24 @@ recursive_directory_iterator createDifferentInterestingIterator(const static_tes
     const recursive_directory_iterator endIt;
     recursive_directory_iterator it(testDir,
                                     directory_options::follow_directory_symlink);
-    TEST_ASSERT(it != endIt);
+    assert(it != endIt);
     while (it.depth() != 2) {
         ++it;
-        TEST_ASSERT(it != endIt);
+        assert(it != endIt);
     }
-    TEST_ASSERT(it.depth() == 2);
+    assert(it.depth() == 2);
     return it;
 }
 
 
-TEST_CASE(test_assignment_signature)
+static void test_assignment_signature()
 {
     using D = recursive_directory_iterator;
     static_assert(std::is_nothrow_move_assignable<D>::value, "");
 }
 
 
-TEST_CASE(test_move_to_end_iterator)
+static void test_move_to_end_iterator()
 {
     static_test_env static_env;
     const recursive_directory_iterator endIt;
@@ -93,27 +90,27 @@ TEST_CASE(test_move_to_end_iterator)
 
     recursive_directory_iterator to;
     to = std::move(from);
-    TEST_REQUIRE(to != endIt);
-    TEST_CHECK(*to == entry);
-    TEST_CHECK(to.options() == from_copy.options());
-    TEST_CHECK(to.depth() == from_copy.depth());
-    TEST_CHECK(to.recursion_pending() == from_copy.recursion_pending());
-    TEST_CHECK(from == endIt || from == to);
+    assert(to != endIt);
+    assert(*to == entry);
+    assert(to.options() == from_copy.options());
+    assert(to.depth() == from_copy.depth());
+    assert(to.recursion_pending() == from_copy.recursion_pending());
+    assert(from == endIt || from == to);
 }
 
 
-TEST_CASE(test_move_from_end_iterator)
+static void test_move_from_end_iterator()
 {
     static_test_env static_env;
     recursive_directory_iterator from;
     recursive_directory_iterator to = createInterestingIterator(static_env);
 
     to = std::move(from);
-    TEST_REQUIRE(to == from);
-    TEST_CHECK(to == recursive_directory_iterator{});
+    assert(to == from);
+    assert(to == recursive_directory_iterator{});
 }
 
-TEST_CASE(test_move_valid_iterator)
+static void test_move_valid_iterator()
 {
     static_test_env static_env;
     const recursive_directory_iterator endIt;
@@ -124,47 +121,55 @@ TEST_CASE(test_move_valid_iterator)
 
     recursive_directory_iterator it2 = createDifferentInterestingIterator(static_env);
     const recursive_directory_iterator it2_copy(it2);
-    TEST_REQUIRE(it2 != it);
-    TEST_CHECK(it2.options() != it.options());
-    TEST_CHECK(it2.depth() != it.depth());
-    TEST_CHECK(it2.recursion_pending() != it.recursion_pending());
-    TEST_CHECK(*it2 != entry);
+    assert(it2 != it);
+    assert(it2.options() != it.options());
+    assert(it2.depth() != it.depth());
+    assert(it2.recursion_pending() != it.recursion_pending());
+    assert(*it2 != entry);
 
     it2 = std::move(it);
-    TEST_REQUIRE(it2 != it2_copy && it2 != endIt);
-    TEST_CHECK(it2.options() == it_copy.options());
-    TEST_CHECK(it2.depth() == it_copy.depth());
-    TEST_CHECK(it2.recursion_pending() == it_copy.recursion_pending());
-    TEST_CHECK(*it2 == entry);
-    TEST_CHECK(it == endIt || it == it2);
+    assert(it2 != it2_copy && it2 != endIt);
+    assert(it2.options() == it_copy.options());
+    assert(it2.depth() == it_copy.depth());
+    assert(it2.recursion_pending() == it_copy.recursion_pending());
+    assert(*it2 == entry);
+    assert(it == endIt || it == it2);
 }
 
-TEST_CASE(test_returns_reference_to_self)
+static void test_returns_reference_to_self()
 {
     recursive_directory_iterator it;
     recursive_directory_iterator it2;
     recursive_directory_iterator& ref = (it2 = std::move(it));
-    TEST_CHECK(&ref == &it2);
+    assert(&ref == &it2);
 }
 
-TEST_CASE(test_self_move)
+static void test_self_move()
 {
     static_test_env static_env;
     // Create two non-equal iterators that have exactly the same state.
     recursive_directory_iterator it = createInterestingIterator(static_env);
     recursive_directory_iterator it2 = createInterestingIterator(static_env);
-    TEST_CHECK(it != it2);
-    TEST_CHECK(it2.options()           == it.options());
-    TEST_CHECK(it2.depth()             == it.depth());
-    TEST_CHECK(it2.recursion_pending() == it.recursion_pending());
-    TEST_CHECK(*it2 == *it);
+    assert(it != it2);
+    assert(it2.options()           == it.options());
+    assert(it2.depth()             == it.depth());
+    assert(it2.recursion_pending() == it.recursion_pending());
+    assert(*it2 == *it);
 
     it = std::move(it);
-    TEST_CHECK(it2.options()           == it.options());
-    TEST_CHECK(it2.depth()             == it.depth());
-    TEST_CHECK(it2.recursion_pending() == it.recursion_pending());
-    TEST_CHECK(*it2 == *it);
+    assert(it2.options()           == it.options());
+    assert(it2.depth()             == it.depth());
+    assert(it2.recursion_pending() == it.recursion_pending());
+    assert(*it2 == *it);
 }
 
+int main(int, char**) {
+    test_assignment_signature();
+    test_move_to_end_iterator();
+    test_move_from_end_iterator();
+    test_move_valid_iterator();
+    test_returns_reference_to_self();
+    test_self_move();
 
-TEST_SUITE_END()
+    return 0;
+}
index 40b09f1..0a80fe1 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(recursive_directory_iterator_pop_tests)
-
-TEST_CASE(signature_tests)
+static void signature_tests()
 {
     recursive_directory_iterator it{}; ((void)it);
     std::error_code ec; ((void)ec);
@@ -37,7 +34,7 @@ TEST_CASE(signature_tests)
 
 // NOTE: Since the order of iteration is unspecified we use a list of
 // seen files at each depth to determine the new depth after a 'pop()' operation.
-TEST_CASE(test_depth)
+static void test_depth()
 {
     static_test_env static_env;
     const recursive_directory_iterator endIt{};
@@ -50,8 +47,8 @@ TEST_CASE(test_depth)
 
     std::error_code ec;
     recursive_directory_iterator it(static_env.Dir, ec);
-    TEST_REQUIRE(it != endIt);
-    TEST_CHECK(it.depth() == 0);
+    assert(it != endIt);
+    assert(it.depth() == 0);
 
     while (it.depth() != 2) {
         if (it.depth() == 0)
@@ -59,35 +56,40 @@ TEST_CASE(test_depth)
         else
             notSeenDepth1.erase(it->path());
         ++it;
-        TEST_REQUIRE(it != endIt);
+        assert(it != endIt);
     }
 
     while (true) {
         auto set_ec = std::make_error_code(std::errc::address_in_use);
         it.pop(set_ec);
-        TEST_REQUIRE(!set_ec);
+        assert(!set_ec);
 
         if (it == endIt) {
             // We must have seen every entry at depth 0 and 1.
-            TEST_REQUIRE(notSeenDepth0.empty() && notSeenDepth1.empty());
+            assert(notSeenDepth0.empty() && notSeenDepth1.empty());
             break;
         }
         else if (it.depth() == 1) {
             // If we popped to depth 1 then there must be unseen entries
             // at this level.
-            TEST_REQUIRE(!notSeenDepth1.empty());
-            TEST_CHECK(notSeenDepth1.count(it->path()));
+            assert(!notSeenDepth1.empty());
+            assert(notSeenDepth1.count(it->path()));
             notSeenDepth1.clear();
         }
         else if (it.depth() == 0) {
             // If we popped to depth 0 there must be unseen entries at this
             // level. There should also be no unseen entries at depth 1.
-            TEST_REQUIRE(!notSeenDepth0.empty());
-            TEST_REQUIRE(notSeenDepth1.empty());
-            TEST_CHECK(notSeenDepth0.count(it->path()));
+            assert(!notSeenDepth0.empty());
+            assert(notSeenDepth1.empty());
+            assert(notSeenDepth0.count(it->path()));
             notSeenDepth0.clear();
         }
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_tests();
+    test_depth();
+
+    return 0;
+}
index 82c82c7..721ed7b 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(recursive_directory_iterator_recursion_pending_tests)
-
-TEST_CASE(initial_value_test)
+static void initial_value_test()
 {
     static_test_env static_env;
     recursive_directory_iterator it(static_env.Dir);
-    TEST_REQUIRE(it.recursion_pending() == true);
+    assert(it.recursion_pending() == true);
 }
 
-TEST_CASE(value_after_copy_construction_and_assignment_test)
+static void value_after_copy_construction_and_assignment_test()
 {
     static_test_env static_env;
     recursive_directory_iterator rec_pending_it(static_env.Dir);
@@ -43,31 +40,31 @@ TEST_CASE(value_after_copy_construction_and_assignment_test)
 
     { // copy construction
         recursive_directory_iterator it(rec_pending_it);
-        TEST_CHECK(it.recursion_pending() == true);
+        assert(it.recursion_pending() == true);
         it.disable_recursion_pending();
-        TEST_REQUIRE(rec_pending_it.recursion_pending() == true);
+        assert(rec_pending_it.recursion_pending() == true);
 
         recursive_directory_iterator it2(no_rec_pending_it);
-        TEST_CHECK(it2.recursion_pending() == false);
+        assert(it2.recursion_pending() == false);
     }
     { // copy assignment
         recursive_directory_iterator it(static_env.Dir);
         it.disable_recursion_pending();
         it = rec_pending_it;
-        TEST_CHECK(it.recursion_pending() == true);
+        assert(it.recursion_pending() == true);
         it.disable_recursion_pending();
-        TEST_REQUIRE(rec_pending_it.recursion_pending() == true);
+        assert(rec_pending_it.recursion_pending() == true);
 
         recursive_directory_iterator it2(static_env.Dir);
         it2 = no_rec_pending_it;
-        TEST_CHECK(it2.recursion_pending() == false);
+        assert(it2.recursion_pending() == false);
     }
-    TEST_CHECK(rec_pending_it.recursion_pending() == true);
-    TEST_CHECK(no_rec_pending_it.recursion_pending() == false);
+    assert(rec_pending_it.recursion_pending() == true);
+    assert(no_rec_pending_it.recursion_pending() == false);
 }
 
 
-TEST_CASE(value_after_move_construction_and_assignment_test)
+static void value_after_move_construction_and_assignment_test()
 {
     static_test_env static_env;
     recursive_directory_iterator rec_pending_it(static_env.Dir);
@@ -77,60 +74,60 @@ TEST_CASE(value_after_move_construction_and_assignment_test)
     { // move construction
         recursive_directory_iterator it_cp(rec_pending_it);
         recursive_directory_iterator it(std::move(it_cp));
-        TEST_CHECK(it.recursion_pending() == true);
+        assert(it.recursion_pending() == true);
 
         recursive_directory_iterator it_cp2(no_rec_pending_it);
         recursive_directory_iterator it2(std::move(it_cp2));
-        TEST_CHECK(it2.recursion_pending() == false);
+        assert(it2.recursion_pending() == false);
     }
     { // copy assignment
         recursive_directory_iterator it(static_env.Dir);
         it.disable_recursion_pending();
         recursive_directory_iterator it_cp(rec_pending_it);
         it = std::move(it_cp);
-        TEST_CHECK(it.recursion_pending() == true);
+        assert(it.recursion_pending() == true);
 
         recursive_directory_iterator it2(static_env.Dir);
         recursive_directory_iterator it_cp2(no_rec_pending_it);
         it2 = std::move(it_cp2);
-        TEST_CHECK(it2.recursion_pending() == false);
+        assert(it2.recursion_pending() == false);
     }
-    TEST_CHECK(rec_pending_it.recursion_pending() == true);
-    TEST_CHECK(no_rec_pending_it.recursion_pending() == false);
+    assert(rec_pending_it.recursion_pending() == true);
+    assert(no_rec_pending_it.recursion_pending() == false);
 }
 
-TEST_CASE(increment_resets_value)
+static void increment_resets_value()
 {
     static_test_env static_env;
     const recursive_directory_iterator endIt;
     {
         recursive_directory_iterator it(static_env.Dir);
         it.disable_recursion_pending();
-        TEST_CHECK(it.recursion_pending() == false);
+        assert(it.recursion_pending() == false);
         ++it;
-        TEST_CHECK(it.recursion_pending() == true);
-        TEST_CHECK(it.depth() == 0);
+        assert(it.recursion_pending() == true);
+        assert(it.depth() == 0);
     }
     {
         recursive_directory_iterator it(static_env.Dir);
         it.disable_recursion_pending();
-        TEST_CHECK(it.recursion_pending() == false);
+        assert(it.recursion_pending() == false);
         it++;
-        TEST_CHECK(it.recursion_pending() == true);
-        TEST_CHECK(it.depth() == 0);
+        assert(it.recursion_pending() == true);
+        assert(it.depth() == 0);
     }
     {
         recursive_directory_iterator it(static_env.Dir);
         it.disable_recursion_pending();
-        TEST_CHECK(it.recursion_pending() == false);
+        assert(it.recursion_pending() == false);
         std::error_code ec;
         it.increment(ec);
-        TEST_CHECK(it.recursion_pending() == true);
-        TEST_CHECK(it.depth() == 0);
+        assert(it.recursion_pending() == true);
+        assert(it.depth() == 0);
     }
 }
 
-TEST_CASE(pop_does_not_reset_value)
+static void pop_does_not_reset_value()
 {
     static_test_env static_env;
     const recursive_directory_iterator endIt;
@@ -139,28 +136,36 @@ TEST_CASE(pop_does_not_reset_value)
     std::set<path> notSeenDepth0(DE0.begin(), DE0.end());
 
     recursive_directory_iterator it(static_env.Dir);
-    TEST_REQUIRE(it != endIt);
+    assert(it != endIt);
 
     while (it.depth() == 0) {
         notSeenDepth0.erase(it->path());
         ++it;
-        TEST_REQUIRE(it != endIt);
+        assert(it != endIt);
     }
-    TEST_REQUIRE(it.depth() == 1);
+    assert(it.depth() == 1);
     it.disable_recursion_pending();
     it.pop();
     // Since the order of iteration is unspecified the pop() could result
     // in the end iterator. When this is the case it is undefined behavior
     // to call recursion_pending().
     if (it == endIt) {
-        TEST_CHECK(notSeenDepth0.empty());
+        assert(notSeenDepth0.empty());
 #if defined(_LIBCPP_VERSION)
-        TEST_CHECK(it.recursion_pending() == false);
+        assert(it.recursion_pending() == false);
 #endif
     } else {
-        TEST_CHECK(! notSeenDepth0.empty());
-        TEST_CHECK(it.recursion_pending() == false);
+        assert(! notSeenDepth0.empty());
+        assert(it.recursion_pending() == false);
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    initial_value_test();
+    value_after_copy_construction_and_assignment_test();
+    value_after_move_construction_and_assignment_test();
+    increment_resets_value();
+    pop_does_not_reset_value();
+
+    return 0;
+}
index 104e419..f0b6804 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(recursive_directory_iterator_begin_end_tests)
-
-TEST_CASE(test_function_signatures)
+static void test_function_signatures()
 {
     recursive_directory_iterator d;
 
@@ -43,7 +40,7 @@ TEST_CASE(test_function_signatures)
     ASSERT_NOEXCEPT(end(std::move(d)));
 }
 
-TEST_CASE(test_ranged_for_loop)
+static void test_ranged_for_loop()
 {
     static_test_env static_env;
     const path testDir = static_env.Dir;
@@ -52,12 +49,17 @@ TEST_CASE(test_ranged_for_loop)
 
     std::error_code ec;
     recursive_directory_iterator it(testDir, ec);
-    TEST_REQUIRE(!ec);
+    assert(!ec);
 
     for (auto& elem : it) {
-        TEST_CHECK(dir_contents.erase(elem) == 1);
+        assert(dir_contents.erase(elem) == 1);
     }
-    TEST_CHECK(dir_contents.empty());
+    assert(dir_contents.empty());
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_function_signatures();
+    test_ranged_for_loop();
+
+    return 0;
+}
index 4b597fc..2a05056 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_absolute_path_test_suite)
-
-TEST_CASE(absolute_signature_test)
+static void absolute_signature_test()
 {
     const path p; ((void)p);
     std::error_code ec;
@@ -33,7 +30,7 @@ TEST_CASE(absolute_signature_test)
 }
 
 
-TEST_CASE(basic_test)
+static void basic_test()
 {
     const fs::path cwd = fs::current_path();
     const struct {
@@ -48,11 +45,16 @@ TEST_CASE(basic_test)
     for (auto& TC : TestCases) {
         std::error_code ec = GetTestEC();
         const path ret = absolute(TC.input, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(ret.is_absolute());
-        TEST_CHECK(PathEqIgnoreSep(ret, TC.expect));
-        LIBCPP_ONLY(TEST_CHECK(PathEq(ret, TC.expect)));
+        assert(!ec);
+        assert(ret.is_absolute());
+        assert(PathEqIgnoreSep(ret, TC.expect));
+        LIBCPP_ONLY(assert(PathEq(ret, TC.expect)));
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    absolute_signature_test();
+    basic_test();
+
+    return 0;
+}
index 707b646..fb88b4a 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_canonical_path_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -35,7 +33,7 @@ TEST_CASE(signature_test)
 
 // There are 4 cases is the proposal for absolute path.
 // Each scope tests one of the cases.
-TEST_CASE(test_canonical)
+static void test_canonical()
 {
     static_test_env static_env;
     CWDGuard guard;
@@ -68,30 +66,30 @@ TEST_CASE(test_canonical)
         std::error_code ec = GetTestEC();
         fs::current_path(TC.base);
         const path ret = canonical(TC.p, ec);
-        TEST_REQUIRE(!ec);
+        assert(!ec);
         const path ret2 = canonical(TC.p);
-        TEST_CHECK(PathEq(ret, TC.expect));
-        TEST_CHECK(PathEq(ret, ret2));
-        TEST_CHECK(ret.is_absolute());
+        assert(PathEq(ret, TC.expect));
+        assert(PathEq(ret, ret2));
+        assert(ret.is_absolute());
     }
 }
 
-TEST_CASE(test_dne_path)
+static void test_dne_path()
 {
     static_test_env static_env;
     std::error_code ec = GetTestEC();
     {
         const path ret = canonical(static_env.DNE, ec);
-        TEST_CHECK(ec != GetTestEC());
-        TEST_REQUIRE(ec);
-        TEST_CHECK(ret == path{});
+        assert(ec != GetTestEC());
+        assert(ec);
+        assert(ret == path{});
     }
     {
-        TEST_CHECK_THROW(filesystem_error, canonical(static_env.DNE));
+        TEST_THROWS_TYPE(filesystem_error, canonical(static_env.DNE));
     }
 }
 
-TEST_CASE(test_exception_contains_paths)
+static void test_exception_contains_paths()
 {
 #ifndef TEST_HAS_NO_EXCEPTIONS
     static_test_env static_env;
@@ -99,21 +97,28 @@ TEST_CASE(test_exception_contains_paths)
     const path p = "blabla/dne";
     try {
         (void)canonical(p);
-        TEST_REQUIRE(false);
+        assert(false);
     } catch (filesystem_error const& err) {
-        TEST_CHECK(err.path1() == p);
+        assert(err.path1() == p);
         // libc++ provides the current path as the second path in the exception
-        LIBCPP_ONLY(TEST_CHECK(err.path2() == current_path()));
+        LIBCPP_ONLY(assert(err.path2() == current_path()));
     }
     fs::current_path(static_env.Dir);
     try {
         (void)canonical(p);
-        TEST_REQUIRE(false);
+        assert(false);
     } catch (filesystem_error const& err) {
-        TEST_CHECK(err.path1() == p);
-        LIBCPP_ONLY(TEST_CHECK(err.path2() == static_env.Dir));
+        assert(err.path1() == p);
+        LIBCPP_ONLY(assert(err.path2() == static_env.Dir));
     }
 #endif
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    test_canonical();
+    test_dne_path();
+    test_exception_contains_paths();
+
+    return 0;
+}
index 3f9574d..2d7acf3 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
 using CO = fs::copy_options;
 
-TEST_SUITE(filesystem_copy_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -44,7 +41,7 @@ TEST_CASE(signature_test)
 
 // There are 4 cases is the proposal for absolute path.
 // Each scope tests one of the cases.
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
     {
@@ -69,7 +66,7 @@ TEST_CASE(test_error_reporting)
     const path dir = env.create_dir("dir");
 #ifndef _WIN32
     const path fifo = env.create_fifo("fifo");
-    TEST_REQUIRE(is_other(fifo));
+    assert(is_other(fifo));
 #endif
 
     const auto test_ec = GetTestEC();
@@ -80,43 +77,43 @@ TEST_CASE(test_error_reporting)
         const path f = static_env.DNE;
         const path t = env.test_root;
         fs::copy(f, t, ec);
-        TEST_REQUIRE(ec);
-        TEST_REQUIRE(ec != test_ec);
-        TEST_CHECK(checkThrow(f, t, ec));
+        assert(ec);
+        assert(ec != test_ec);
+        assert(checkThrow(f, t, ec));
     }
     { // equivalent(f, t) == true
         std::error_code ec = test_ec;
         fs::copy(file, file, ec);
-        TEST_REQUIRE(ec);
-        TEST_REQUIRE(ec != test_ec);
-        TEST_CHECK(checkThrow(file, file, ec));
+        assert(ec);
+        assert(ec != test_ec);
+        assert(checkThrow(file, file, ec));
     }
     { // is_directory(from) && is_file(to)
         std::error_code ec = test_ec;
         fs::copy(dir, file, ec);
-        TEST_REQUIRE(ec);
-        TEST_REQUIRE(ec != test_ec);
-        TEST_CHECK(checkThrow(dir, file, ec));
+        assert(ec);
+        assert(ec != test_ec);
+        assert(checkThrow(dir, file, ec));
     }
 #ifndef _WIN32
     { // is_other(from)
         std::error_code ec = test_ec;
         fs::copy(fifo, dir, ec);
-        TEST_REQUIRE(ec);
-        TEST_REQUIRE(ec != test_ec);
-        TEST_CHECK(checkThrow(fifo, dir, ec));
+        assert(ec);
+        assert(ec != test_ec);
+        assert(checkThrow(fifo, dir, ec));
     }
     { // is_other(to)
         std::error_code ec = test_ec;
         fs::copy(file, fifo, ec);
-        TEST_REQUIRE(ec);
-        TEST_REQUIRE(ec != test_ec);
-        TEST_CHECK(checkThrow(file, fifo, ec));
+        assert(ec);
+        assert(ec != test_ec);
+        assert(checkThrow(file, fifo, ec));
     }
 #endif
 }
 
-TEST_CASE(from_is_symlink)
+static void from_is_symlink()
 {
     scoped_test_env env;
     const path file = env.create_file("file", 42);
@@ -126,32 +123,32 @@ TEST_CASE(from_is_symlink)
     { // skip symlinks
         std::error_code ec = GetTestEC();
         fs::copy(symlink, dne, copy_options::skip_symlinks, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(!exists(dne));
+        assert(!ec);
+        assert(!exists(dne));
     }
     {
         const path dest = env.make_env_path("dest");
         std::error_code ec = GetTestEC();
         fs::copy(symlink, dest, copy_options::copy_symlinks, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(exists(dest));
-        TEST_CHECK(is_symlink(dest));
+        assert(!ec);
+        assert(exists(dest));
+        assert(is_symlink(dest));
     }
     { // copy symlink but target exists
         std::error_code ec = GetTestEC();
         fs::copy(symlink, file, copy_options::copy_symlinks, ec);
-        TEST_CHECK(ec);
-        TEST_CHECK(ec != GetTestEC());
+        assert(ec);
+        assert(ec != GetTestEC());
     }
     { // create symlinks but target exists
         std::error_code ec = GetTestEC();
         fs::copy(symlink, file, copy_options::create_symlinks, ec);
-        TEST_CHECK(ec);
-        TEST_CHECK(ec != GetTestEC());
+        assert(ec);
+        assert(ec != GetTestEC());
     }
 }
 
-TEST_CASE(from_is_regular_file)
+static void from_is_regular_file()
 {
     scoped_test_env env;
     const path file = env.create_file("file", 42);
@@ -160,44 +157,44 @@ TEST_CASE(from_is_regular_file)
         const path dest = env.make_env_path("dest1");
         std::error_code ec = GetTestEC();
         fs::copy(file, dest, CO::directories_only, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(!exists(dest));
+        assert(!ec);
+        assert(!exists(dest));
     }
     { // create symlink to file
         const path dest = env.make_env_path("sym");
         std::error_code ec = GetTestEC();
         fs::copy(file, dest, CO::create_symlinks, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(is_symlink(dest));
-        TEST_CHECK(equivalent(file, canonical(dest)));
+        assert(!ec);
+        assert(is_symlink(dest));
+        assert(equivalent(file, canonical(dest)));
     }
     { // create hard link to file
         const path dest = env.make_env_path("hardlink");
-        TEST_CHECK(hard_link_count(file) == 1);
+        assert(hard_link_count(file) == 1);
         std::error_code ec = GetTestEC();
         fs::copy(file, dest, CO::create_hard_links, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(exists(dest));
-        TEST_CHECK(hard_link_count(file) == 2);
+        assert(!ec);
+        assert(exists(dest));
+        assert(hard_link_count(file) == 2);
     }
     { // is_directory(t)
         const path dest_dir = env.create_dir("dest_dir");
         const path expect_dest = dest_dir / file.filename();
         std::error_code ec = GetTestEC();
         fs::copy(file, dest_dir, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(is_regular_file(expect_dest));
+        assert(!ec);
+        assert(is_regular_file(expect_dest));
     }
     { // otherwise copy_file(from, to, ...)
         const path dest = env.make_env_path("file_copy");
         std::error_code ec = GetTestEC();
         fs::copy(file, dest, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(is_regular_file(dest));
+        assert(!ec);
+        assert(is_regular_file(dest));
     }
 }
 
-TEST_CASE(from_is_directory)
+static void from_is_directory()
 {
     struct FileInfo {
         path filename;
@@ -221,48 +218,48 @@ TEST_CASE(from_is_directory)
         const path dest = env.make_env_path("dest_dir1");
         std::error_code ec = GetTestEC();
         fs::copy(dir, dest, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(is_directory(dest));
+        assert(!ec);
+        assert(is_directory(dest));
         for (auto& FI : files) {
             path created = dest / FI.filename;
-            TEST_CHECK(is_regular_file(created));
-            TEST_CHECK(file_size(created) == FI.size);
+            assert(is_regular_file(created));
+            assert(file_size(created) == FI.size);
         }
-        TEST_CHECK(!is_directory(dest / nested_dir_name));
+        assert(!is_directory(dest / nested_dir_name));
     }
     { // test for existing directory
         const path dest = env.create_dir("dest_dir2");
         std::error_code ec = GetTestEC();
         fs::copy(dir, dest, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(is_directory(dest));
+        assert(!ec);
+        assert(is_directory(dest));
         for (auto& FI : files) {
             path created = dest / FI.filename;
-            TEST_CHECK(is_regular_file(created));
-            TEST_CHECK(file_size(created) == FI.size);
+            assert(is_regular_file(created));
+            assert(file_size(created) == FI.size);
         }
-        TEST_CHECK(!is_directory(dest / nested_dir_name));
+        assert(!is_directory(dest / nested_dir_name));
     }
     { // test recursive copy
         const path dest = env.make_env_path("dest_dir3");
         std::error_code ec = GetTestEC();
         fs::copy(dir, dest, CO::recursive, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(is_directory(dest));
+        assert(!ec);
+        assert(is_directory(dest));
         const path nested_dest = dest / nested_dir_name;
-        TEST_REQUIRE(is_directory(nested_dest));
+        assert(is_directory(nested_dest));
         for (auto& FI : files) {
             path created = dest / FI.filename;
             path nested_created = nested_dest / FI.filename;
-            TEST_CHECK(is_regular_file(created));
-            TEST_CHECK(file_size(created) == FI.size);
-            TEST_CHECK(is_regular_file(nested_created));
-            TEST_CHECK(file_size(nested_created) == FI.size);
+            assert(is_regular_file(created));
+            assert(file_size(created) == FI.size);
+            assert(is_regular_file(nested_created));
+            assert(file_size(nested_created) == FI.size);
         }
     }
 }
 
-TEST_CASE(test_copy_symlinks_to_symlink_dir)
+static void test_copy_symlinks_to_symlink_dir()
 {
     scoped_test_env env;
     const path file1 = env.create_file("file1", 42);
@@ -273,16 +270,16 @@ TEST_CASE(test_copy_symlinks_to_symlink_dir)
     {
         std::error_code ec = GetTestEC();
         fs::copy(file1, dir_sym, copy_options::copy_symlinks, ec);
-        TEST_CHECK(!ec);
+        assert(!ec);
         const path dest = env.make_env_path("dir/file1");
-        TEST_CHECK(exists(dest));
-        TEST_CHECK(!is_symlink(dest));
-        TEST_CHECK(file_size(dest) == 42);
+        assert(exists(dest));
+        assert(!is_symlink(dest));
+        assert(file_size(dest) == 42);
     }
 }
 
 
-TEST_CASE(test_dir_create_symlink)
+static void test_dir_create_symlink()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir1");
@@ -290,20 +287,20 @@ TEST_CASE(test_dir_create_symlink)
     {
         std::error_code ec = GetTestEC();
         fs::copy(dir, dest, copy_options::create_symlinks, ec);
-        TEST_CHECK(ErrorIs(ec, std::errc::is_a_directory));
-        TEST_CHECK(!exists(dest));
-        TEST_CHECK(!is_symlink(dest));
+        assert(ErrorIs(ec, std::errc::is_a_directory));
+        assert(!exists(dest));
+        assert(!is_symlink(dest));
     }
     {
         std::error_code ec = GetTestEC();
         fs::copy(dir, dest, copy_options::create_symlinks|copy_options::recursive, ec);
-        TEST_CHECK(ErrorIs(ec, std::errc::is_a_directory));
-        TEST_CHECK(!exists(dest));
-        TEST_CHECK(!is_symlink(dest));
+        assert(ErrorIs(ec, std::errc::is_a_directory));
+        assert(!exists(dest));
+        assert(!is_symlink(dest));
     }
 }
 
-TEST_CASE(test_otherwise_no_effects_clause)
+static void test_otherwise_no_effects_clause()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir1");
@@ -311,9 +308,20 @@ TEST_CASE(test_otherwise_no_effects_clause)
         const path dest = env.make_env_path("dest1");
         std::error_code ec;
         fs::copy(dir, dest, CO::directories_only, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(!exists(dest));
+        assert(!ec);
+        assert(!exists(dest));
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    test_error_reporting();
+    from_is_symlink();
+    from_is_regular_file();
+    from_is_directory();
+    test_copy_symlinks_to_symlink_dir();
+    test_dir_create_symlink();
+    test_otherwise_no_effects_clause();
+
+    return 0;
+}
index 85e8416..28616c9 100644 (file)
 #include <chrono>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
 using CO = fs::copy_options;
 
-TEST_SUITE(filesystem_copy_file_test_suite)
-
-TEST_CASE(test_signatures) {
+static void test_signatures() {
   const path p;
   ((void)p);
   const copy_options opts{};
@@ -52,7 +50,7 @@ TEST_CASE(test_signatures) {
   ASSERT_NOT_NOEXCEPT(fs::copy_file(p, p, opts, ec));
 }
 
-TEST_CASE(test_error_reporting) {
+static void test_error_reporting() {
 
   scoped_test_env env;
   const path file = env.create_file("file1", 42);
@@ -60,25 +58,25 @@ TEST_CASE(test_error_reporting) {
 
   { // exists(to) && equivalent(to, from)
     std::error_code ec;
-    TEST_CHECK(fs::copy_file(file, file, copy_options::overwrite_existing,
+    assert(fs::copy_file(file, file, copy_options::overwrite_existing,
                              ec) == false);
-    TEST_CHECK(ErrorIs(ec, std::errc::file_exists));
+    assert(ErrorIs(ec, std::errc::file_exists));
     ExceptionChecker Checker(file, file, std::errc::file_exists, "copy_file");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, copy_file(file, file, copy_options::overwrite_existing));
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, copy_file(file, file, copy_options::overwrite_existing));
 
   }
   { // exists(to) && !(skip_existing | overwrite_existing | update_existing)
     std::error_code ec;
-    TEST_CHECK(fs::copy_file(file, file2, ec) == false);
-    TEST_CHECK(ErrorIs(ec, std::errc::file_exists));
+    assert(fs::copy_file(file, file2, ec) == false);
+    assert(ErrorIs(ec, std::errc::file_exists));
     ExceptionChecker Checker(file, file, std::errc::file_exists, "copy_file");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, copy_file(file, file, copy_options::overwrite_existing));
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, copy_file(file, file, copy_options::overwrite_existing));
 
   }
 }
 
 #ifndef _WIN32
-TEST_CASE(non_regular_file_test) {
+static void non_regular_file_test() {
   scoped_test_env env;
   const path fifo = env.create_fifo("fifo");
   const path dest = env.make_env_path("dest");
@@ -86,22 +84,22 @@ TEST_CASE(non_regular_file_test) {
 
   {
     std::error_code ec = GetTestEC();
-    TEST_REQUIRE(fs::copy_file(fifo, dest, ec) == false);
-    TEST_CHECK(ErrorIs(ec, std::errc::not_supported));
-    TEST_CHECK(!exists(dest));
+    assert(fs::copy_file(fifo, dest, ec) == false);
+    assert(ErrorIs(ec, std::errc::not_supported));
+    assert(!exists(dest));
   }
   {
     std::error_code ec = GetTestEC();
-    TEST_REQUIRE(fs::copy_file(file, fifo, copy_options::overwrite_existing,
+    assert(fs::copy_file(file, fifo, copy_options::overwrite_existing,
                                ec) == false);
-    TEST_CHECK(ErrorIs(ec, std::errc::not_supported));
-    TEST_CHECK(is_fifo(fifo));
+    assert(ErrorIs(ec, std::errc::not_supported));
+    assert(is_fifo(fifo));
   }
 
 }
-#endif
+#endif // _WIN32
 
-TEST_CASE(test_attributes_get_copied) {
+static void test_attributes_get_copied() {
   scoped_test_env env;
   const path file = env.create_file("file1", 42);
   const path dest = env.make_env_path("file2");
@@ -109,27 +107,27 @@ TEST_CASE(test_attributes_get_copied) {
   perms new_perms = perms::owner_read;
   permissions(file, new_perms);
   std::error_code ec = GetTestEC();
-  TEST_REQUIRE(fs::copy_file(file, dest, ec) == true);
-  TEST_CHECK(!ec);
+  assert(fs::copy_file(file, dest, ec) == true);
+  assert(!ec);
   auto new_st = status(dest);
-  TEST_CHECK(new_st.permissions() == NormalizeExpectedPerms(new_perms));
+  assert(new_st.permissions() == NormalizeExpectedPerms(new_perms));
 }
 
-TEST_CASE(copy_dir_test) {
+static void copy_dir_test() {
   scoped_test_env env;
   const path file = env.create_file("file1", 42);
   const path dest = env.create_dir("dir1");
   std::error_code ec = GetTestEC();
-  TEST_CHECK(fs::copy_file(file, dest, ec) == false);
-  TEST_CHECK(ec);
-  TEST_CHECK(ec != GetTestEC());
+  assert(fs::copy_file(file, dest, ec) == false);
+  assert(ec);
+  assert(ec != GetTestEC());
   ec = GetTestEC();
-  TEST_CHECK(fs::copy_file(dest, file, ec) == false);
-  TEST_CHECK(ec);
-  TEST_CHECK(ec != GetTestEC());
+  assert(fs::copy_file(dest, file, ec) == false);
+  assert(ec);
+  assert(ec != GetTestEC());
 }
 
-TEST_CASE(copy_file) {
+static void copy_file() {
   scoped_test_env env;
   const path file = env.create_file("file1", 42);
 
@@ -137,9 +135,9 @@ TEST_CASE(copy_file) {
     const path dest = env.make_env_path("dest1");
     std::error_code ec = GetTestEC();
 
-    TEST_REQUIRE(fs::copy_file(file, dest, ec) == true);
-    TEST_CHECK(!ec);
-    TEST_CHECK(file_size(dest) == 42);
+    assert(fs::copy_file(file, dest, ec) == true);
+    assert(!ec);
+    assert(file_size(dest) == 42);
   }
   { // exists(to) && overwrite_existing
     const path dest = env.create_file("dest2", 55);
@@ -149,11 +147,11 @@ TEST_CASE(copy_file) {
                 perm_options::remove);
 
     std::error_code ec = GetTestEC();
-    TEST_REQUIRE(fs::copy_file(file, dest, copy_options::overwrite_existing,
+    assert(fs::copy_file(file, dest, copy_options::overwrite_existing,
                                ec) == true);
-    TEST_CHECK(!ec);
-    TEST_CHECK(file_size(dest) == 42);
-    TEST_CHECK(status(dest).permissions() == status(file).permissions());
+    assert(!ec);
+    assert(file_size(dest) == 42);
+    assert(status(dest).permissions() == status(file).permissions());
   }
   { // exists(to) && update_existing
     using Sec = std::chrono::seconds;
@@ -166,25 +164,35 @@ TEST_CASE(copy_file) {
     const path newer = env.create_file("newer_file", 2);
 
     std::error_code ec = GetTestEC();
-    TEST_REQUIRE(
+    assert(
         fs::copy_file(from, older, copy_options::update_existing, ec) == true);
-    TEST_CHECK(!ec);
-    TEST_CHECK(file_size(older) == 55);
+    assert(!ec);
+    assert(file_size(older) == 55);
 
-    TEST_REQUIRE(
+    assert(
         fs::copy_file(from, newer, copy_options::update_existing, ec) == false);
-    TEST_CHECK(!ec);
-    TEST_CHECK(file_size(newer) == 2);
+    assert(!ec);
+    assert(file_size(newer) == 2);
   }
   { // skip_existing
     const path file2 = env.create_file("file2", 55);
     std::error_code ec = GetTestEC();
-    TEST_REQUIRE(fs::copy_file(file, file2, copy_options::skip_existing, ec) ==
+    assert(fs::copy_file(file, file2, copy_options::skip_existing, ec) ==
                  false);
-    TEST_CHECK(!ec);
-    TEST_CHECK(file_size(file2) == 55);
+    assert(!ec);
+    assert(file_size(file2) == 55);
   }
 }
 
+int main(int, char**) {
+  test_signatures();
+  test_error_reporting();
+#ifndef _WIN32
+  non_regular_file_test();
+#endif
+  test_attributes_get_copied();
+  copy_dir_test();
+  copy_file();
 
-TEST_SUITE_END()
+  return 0;
+}
index dd38b1e..37d1108 100644 (file)
 #include <string>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_copy_file_test_suite)
-
 // This test is intended to test 'sendfile's 2gb limit for a single call, and
 // to ensure that libc++ correctly copies files larger than that limit.
 // However it requires allocating ~5GB of filesystem space. This might not
 // be acceptable on all systems.
-TEST_CASE(large_file) {
+static void large_file() {
   using namespace fs;
   constexpr uintmax_t sendfile_size_limit = 2147479552ull;
   constexpr uintmax_t additional_size = 1024;
@@ -46,7 +43,7 @@ TEST_CASE(large_file) {
   // Check that we have more than sufficient room to create the files needed
   // to perform the test.
   if (space(env.test_root).available < 3 * test_file_size) {
-    TEST_UNSUPPORTED();
+    return;
   }
 
   // Create a file right at the size limit. The file is full of '\0's.
@@ -55,32 +52,36 @@ TEST_CASE(large_file) {
   // Append known data to the end of the source file.
   {
     std::FILE* outf = std::fopen(source.string().c_str(), "a");
-    TEST_REQUIRE(outf != nullptr);
+    assert(outf != nullptr);
     std::fputs(additional_data.c_str(), outf);
     std::fclose(outf);
   }
-  TEST_REQUIRE(file_size(source) == test_file_size);
+  assert(file_size(source) == test_file_size);
   const path dest = env.make_env_path("dest");
 
   std::error_code ec = GetTestEC();
-  TEST_CHECK(copy_file(source, dest, ec));
-  TEST_CHECK(!ec);
+  assert(copy_file(source, dest, ec));
+  assert(!ec);
 
-  TEST_REQUIRE(is_regular_file(dest));
-  TEST_CHECK(file_size(dest) == test_file_size);
+  assert(is_regular_file(dest));
+  assert(file_size(dest) == test_file_size);
 
   // Read the data from the end of the destination file, and ensure it matches
   // the data at the end of the source file.
   std::string out_data(additional_size, 'z');
   {
     std::FILE* dest_file = std::fopen(dest.string().c_str(), "rb");
-    TEST_REQUIRE(dest_file != nullptr);
-    TEST_REQUIRE(std::fseek(dest_file, sendfile_size_limit, SEEK_SET) == 0);
-    TEST_REQUIRE(std::fread(&out_data[0], sizeof(out_data[0]), additional_size, dest_file) == additional_size);
+    assert(dest_file != nullptr);
+    assert(std::fseek(dest_file, sendfile_size_limit, SEEK_SET) == 0);
+    assert(std::fread(&out_data[0], sizeof(out_data[0]), additional_size, dest_file) == additional_size);
     std::fclose(dest_file);
   }
-  TEST_CHECK(out_data.size() == additional_data.size());
-  TEST_CHECK(out_data == additional_data);
+  assert(out_data.size() == additional_data.size());
+  assert(out_data == additional_data);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  large_file();
+
+  return 0;
+}
index fff62c3..c618acf 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_copy_symlink_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -35,7 +32,7 @@ TEST_CASE(test_signatures)
 }
 
 
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
     {
@@ -62,23 +59,23 @@ TEST_CASE(test_error_reporting)
     { // from is a file, not a symlink
         std::error_code ec;
         fs::copy_symlink(file, dne, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(checkThrow(file, dne, ec));
+        assert(ec);
+        assert(checkThrow(file, dne, ec));
     }
     { // from is a file, not a symlink
         std::error_code ec;
         fs::copy_symlink(dir, dne, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(checkThrow(dir, dne, ec));
+        assert(ec);
+        assert(checkThrow(dir, dne, ec));
     }
     { // destination exists
         std::error_code ec;
         fs::copy_symlink(sym, file2, ec);
-        TEST_REQUIRE(ec);
+        assert(ec);
     }
 }
 
-TEST_CASE(copy_symlink_basic)
+static void copy_symlink_basic()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir");
@@ -89,19 +86,24 @@ TEST_CASE(copy_symlink_basic)
         const path dest = env.make_env_path("dest1");
         std::error_code ec;
         fs::copy_symlink(dir_sym, dest, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(is_symlink(dest));
-        TEST_CHECK(equivalent(dest, dir));
+        assert(!ec);
+        assert(is_symlink(dest));
+        assert(equivalent(dest, dir));
     }
     { // test for file symlinks
         const path dest = env.make_env_path("dest2");
         std::error_code ec;
         fs::copy_symlink(file_sym, dest, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(is_symlink(dest));
-        TEST_CHECK(equivalent(dest, file));
+        assert(!ec);
+        assert(is_symlink(dest));
+        assert(equivalent(dest, file));
     }
 }
 
+int main(int, char**) {
+    test_signatures();
+    test_error_reporting();
+    copy_symlink_basic();
 
-TEST_SUITE_END()
+    return 0;
+}
index f3c22c8..c5bae1d 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_create_directories_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -38,37 +36,37 @@ TEST_CASE(test_signatures)
     ASSERT_NOT_NOEXCEPT(fs::create_directories(p, ec));
 }
 
-TEST_CASE(create_existing_directory)
+static void create_existing_directory()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir1");
     std::error_code ec;
-    TEST_CHECK(fs::create_directories(dir, ec) == false);
-    TEST_CHECK(!ec);
-    TEST_CHECK(is_directory(dir));
+    assert(fs::create_directories(dir, ec) == false);
+    assert(!ec);
+    assert(is_directory(dir));
 }
 
-TEST_CASE(create_directory_one_level)
+static void create_directory_one_level()
 {
     scoped_test_env env;
     const path dir = env.make_env_path("dir1");
     std::error_code ec;
-    TEST_CHECK(fs::create_directories(dir, ec) == true);
-    TEST_CHECK(!ec);
-    TEST_CHECK(is_directory(dir));
+    assert(fs::create_directories(dir, ec) == true);
+    assert(!ec);
+    assert(is_directory(dir));
 }
 
-TEST_CASE(create_directories_multi_level)
+static void create_directories_multi_level()
 {
     scoped_test_env env;
     const path dir = env.make_env_path("dir1/dir2/dir3");
     std::error_code ec;
-    TEST_CHECK(fs::create_directories(dir, ec) == true);
-    TEST_CHECK(!ec);
-    TEST_CHECK(is_directory(dir));
+    assert(fs::create_directories(dir, ec) == true);
+    assert(!ec);
+    assert(is_directory(dir));
 }
 
-TEST_CASE(create_directory_symlinks) {
+static void create_directory_symlinks() {
   scoped_test_env env;
   const path root = env.create_dir("dir");
   const path sym_dest_dead = env.make_env_path("dead");
@@ -76,82 +74,82 @@ TEST_CASE(create_directory_symlinks) {
   const path target = env.make_env_path("dir/sym_dir/foo");
   {
     std::error_code ec = GetTestEC();
-    TEST_CHECK(create_directories(target, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::file_exists));
-    TEST_CHECK(!exists(sym_dest_dead));
-    TEST_CHECK(!exists(dead_sym));
+    assert(create_directories(target, ec) == false);
+    assert(ec);
+    assert(ErrorIs(ec, std::errc::file_exists));
+    assert(!exists(sym_dest_dead));
+    assert(!exists(dead_sym));
   }
 }
 
-TEST_CASE(create_directory_through_symlinks) {
+static void create_directory_through_symlinks() {
   scoped_test_env env;
   const path root = env.create_dir("dir");
   const path sym_dir = env.create_directory_symlink(root, "sym_dir");
   const path target = env.make_env_path("sym_dir/foo");
   const path resolved_target = env.make_env_path("dir/foo");
-  TEST_REQUIRE(is_directory(sym_dir));
+  assert(is_directory(sym_dir));
   {
     std::error_code ec = GetTestEC();
-    TEST_CHECK(create_directories(target, ec) == true);
-    TEST_CHECK(!ec);
-    TEST_CHECK(is_directory(target));
-    TEST_CHECK(is_directory(resolved_target));
+    assert(create_directories(target, ec) == true);
+    assert(!ec);
+    assert(is_directory(target));
+    assert(is_directory(resolved_target));
   }
 }
 
-TEST_CASE(dest_is_file)
+static void dest_is_file()
 {
     scoped_test_env env;
     const path file = env.create_file("file", 42);
     std::error_code ec = GetTestEC();
-    TEST_CHECK(fs::create_directories(file, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::file_exists));
-    TEST_CHECK(is_regular_file(file));
+    assert(fs::create_directories(file, ec) == false);
+    assert(ec);
+    assert(ErrorIs(ec, std::errc::file_exists));
+    assert(is_regular_file(file));
 }
 
-TEST_CASE(dest_part_is_file)
+static void dest_part_is_file()
 {
     scoped_test_env env;
     const path file = env.create_file("file");
     const path dir = env.make_env_path("file/dir1");
     std::error_code ec = GetTestEC();
-    TEST_CHECK(fs::create_directories(dir, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::not_a_directory));
-    TEST_CHECK(is_regular_file(file));
-    TEST_CHECK(!exists(dir));
+    assert(fs::create_directories(dir, ec) == false);
+    assert(ec);
+    assert(ErrorIs(ec, std::errc::not_a_directory));
+    assert(is_regular_file(file));
+    assert(!exists(dir));
 }
 
-TEST_CASE(dest_final_part_is_file)
+static void dest_final_part_is_file()
 {
     scoped_test_env env;
     env.create_dir("dir");
     const path file = env.create_file("dir/file");
     const path dir = env.make_env_path("dir/file/dir1");
     std::error_code ec = GetTestEC();
-    TEST_CHECK(fs::create_directories(dir, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::not_a_directory));
-    TEST_CHECK(is_regular_file(file));
-    TEST_CHECK(!exists(dir));
+    assert(fs::create_directories(dir, ec) == false);
+    assert(ec);
+    assert(ErrorIs(ec, std::errc::not_a_directory));
+    assert(is_regular_file(file));
+    assert(!exists(dir));
 }
 
-TEST_CASE(dest_is_empty_path)
+static void dest_is_empty_path()
 {
     std::error_code ec = GetTestEC();
-    TEST_CHECK(fs::create_directories(fs::path{}, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(fs::create_directories(fs::path{}, ec) == false);
+    assert(ec);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
     ExceptionChecker Checker(path{}, std::errc::no_such_file_or_directory,
                              "create_directories");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker,
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker,
                             fs::create_directories(path{}));
 }
 
 #ifdef _WIN32
-TEST_CASE(nonexistent_root)
+static void nonexistent_root()
 {
     std::error_code ec = GetTestEC();
     // If Q:\ doesn't exist, create_directories would try to recurse upwards
@@ -159,9 +157,25 @@ TEST_CASE(nonexistent_root)
     // whole path is the root name, parent_path() returns itself, and it
     // would recurse indefinitely, unless the recursion is broken.
     if (!exists("Q:\\"))
-       TEST_CHECK(fs::create_directories("Q:\\", ec) == false);
-    TEST_CHECK(fs::create_directories("\\\\nonexistentserver", ec) == false);
+       assert(fs::create_directories("Q:\\", ec) == false);
+    assert(fs::create_directories("\\\\nonexistentserver", ec) == false);
 }
+#endif // _WIN32
+
+int main(int, char**) {
+    test_signatures();
+    create_existing_directory();
+    create_directory_one_level();
+    create_directories_multi_level();
+    create_directory_symlinks();
+    create_directory_through_symlinks();
+    dest_is_file();
+    dest_part_is_file();
+    dest_final_part_is_file();
+    dest_is_empty_path();
+#ifdef _WIN32
+    nonexistent_root();
 #endif
 
-TEST_SUITE_END()
+    return 0;
+}
index cf7e64c..9bad40d 100644 (file)
@@ -23,7 +23,6 @@
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 #include <sys/types.h>
@@ -37,9 +36,7 @@ fs::perms read_umask() {
     return static_cast<fs::perms>(old_mask);
 }
 
-TEST_SUITE(filesystem_create_directory_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -54,84 +51,95 @@ TEST_CASE(test_signatures)
 }
 
 
-TEST_CASE(create_existing_directory)
+static void create_existing_directory()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir1");
     std::error_code ec;
-    TEST_CHECK(fs::create_directory(dir, ec) == false);
-    TEST_CHECK(!ec);
-    TEST_CHECK(is_directory(dir));
+    assert(fs::create_directory(dir, ec) == false);
+    assert(!ec);
+    assert(is_directory(dir));
     // Test throwing version
-    TEST_CHECK(fs::create_directory(dir) == false);
+    assert(fs::create_directory(dir) == false);
 }
 
-TEST_CASE(create_directory_one_level)
+static void create_directory_one_level()
 {
     scoped_test_env env;
     const path dir = env.make_env_path("dir1");
     std::error_code ec;
-    TEST_CHECK(fs::create_directory(dir, ec) == true);
-    TEST_CHECK(!ec);
-    TEST_CHECK(is_directory(dir));
+    assert(fs::create_directory(dir, ec) == true);
+    assert(!ec);
+    assert(is_directory(dir));
 
     auto st = status(dir);
     const perms expect_perms = perms::all & ~(read_umask());
-    TEST_CHECK((st.permissions() & perms::all) == expect_perms);
+    assert((st.permissions() & perms::all) == expect_perms);
 }
 
-TEST_CASE(create_directory_multi_level)
+static void create_directory_multi_level()
 {
     scoped_test_env env;
     const path dir = env.make_env_path("dir1/dir2");
     const path dir1 = env.make_env_path("dir1");
     std::error_code ec;
-    TEST_CHECK(fs::create_directory(dir, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(!is_directory(dir));
-    TEST_CHECK(!is_directory(dir1));
+    assert(fs::create_directory(dir, ec) == false);
+    assert(ec);
+    assert(!is_directory(dir));
+    assert(!is_directory(dir1));
 }
 
-TEST_CASE(dest_is_file)
+static void dest_is_file()
 {
     scoped_test_env env;
     const path file = env.create_file("file", 42);
     std::error_code ec = GetTestEC();
-    TEST_CHECK(fs::create_directory(file, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(is_regular_file(file));
+    assert(fs::create_directory(file, ec) == false);
+    assert(ec);
+    assert(is_regular_file(file));
 }
 
-TEST_CASE(dest_part_is_file)
+static void dest_part_is_file()
 {
     scoped_test_env env;
     const path file = env.create_file("file");
     const path dir = env.make_env_path("file/dir1");
     std::error_code ec = GetTestEC();
-    TEST_CHECK(fs::create_directory(dir, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(is_regular_file(file));
-    TEST_CHECK(!exists(dir));
+    assert(fs::create_directory(dir, ec) == false);
+    assert(ec);
+    assert(is_regular_file(file));
+    assert(!exists(dir));
 }
 
-TEST_CASE(dest_is_symlink_to_dir)
+static void dest_is_symlink_to_dir()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir");
     const path sym = env.create_directory_symlink(dir, "sym_name");
     std::error_code ec = GetTestEC();
-    TEST_CHECK(create_directory(sym, ec) == false);
-    TEST_CHECK(!ec);
+    assert(create_directory(sym, ec) == false);
+    assert(!ec);
 }
 
-TEST_CASE(dest_is_symlink_to_file)
+static void dest_is_symlink_to_file()
 {
     scoped_test_env env;
     const path file = env.create_file("file");
     const path sym = env.create_symlink(file, "sym_name");
     std::error_code ec = GetTestEC();
-    TEST_CHECK(create_directory(sym, ec) == false);
-    TEST_CHECK(ec);
+    assert(create_directory(sym, ec) == false);
+    assert(ec);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_signatures();
+    create_existing_directory();
+    create_directory_one_level();
+    create_directory_multi_level();
+    dest_is_file();
+    dest_part_is_file();
+    dest_is_symlink_to_dir();
+    dest_is_symlink_to_file();
+
+    return 0;
+}
index c3ca9dd..d687e9d 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_create_directory_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -38,7 +35,7 @@ TEST_CASE(test_signatures)
     ASSERT_NOEXCEPT(fs::create_directory(p, p, ec));
 }
 
-TEST_CASE(create_existing_directory)
+static void create_existing_directory()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir1");
@@ -48,19 +45,19 @@ TEST_CASE(create_existing_directory)
     permissions(dir2, perms::none);
 
     std::error_code ec;
-    TEST_CHECK(fs::create_directory(dir, dir2, ec) == false);
-    TEST_CHECK(!ec);
+    assert(fs::create_directory(dir, dir2, ec) == false);
+    assert(!ec);
 
     // Check that the permissions were unchanged
-    TEST_CHECK(orig_p == status(dir).permissions());
+    assert(orig_p == status(dir).permissions());
 
     // Test throwing version
-    TEST_CHECK(fs::create_directory(dir, dir2) == false);
+    assert(fs::create_directory(dir, dir2) == false);
 }
 
 // Windows doesn't have the concept of perms::none on directories.
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
-TEST_CASE(create_directory_one_level)
+static void create_directory_one_level()
 {
     scoped_test_env env;
     // Remove setgid which mkdir would inherit
@@ -71,104 +68,119 @@ TEST_CASE(create_directory_one_level)
     permissions(attr_dir, perms::none);
 
     std::error_code ec;
-    TEST_CHECK(fs::create_directory(dir, attr_dir, ec) == true);
-    TEST_CHECK(!ec);
-    TEST_CHECK(is_directory(dir));
+    assert(fs::create_directory(dir, attr_dir, ec) == true);
+    assert(!ec);
+    assert(is_directory(dir));
 
     // Check that the new directory has the same permissions as attr_dir
     auto st = status(dir);
-    TEST_CHECK(st.permissions() == perms::none);
+    assert(st.permissions() == perms::none);
 }
-#endif
+#endif // TEST_WIN_NO_FILESYSTEM_PERMS_NONE
 
-TEST_CASE(create_directory_multi_level)
+static void create_directory_multi_level()
 {
     scoped_test_env env;
     const path dir = env.make_env_path("dir1/dir2");
     const path dir1 = env.make_env_path("dir1");
     const path attr_dir = env.create_dir("attr_dir");
     std::error_code ec = GetTestEC();
-    TEST_CHECK(fs::create_directory(dir, attr_dir, ec) == false);
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
-    TEST_CHECK(!is_directory(dir));
-    TEST_CHECK(!is_directory(dir1));
+    assert(fs::create_directory(dir, attr_dir, ec) == false);
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(!is_directory(dir));
+    assert(!is_directory(dir1));
 }
 
-TEST_CASE(dest_is_file)
+static void dest_is_file()
 {
     scoped_test_env env;
     const path file = env.create_file("file", 42);
     const path attr_dir = env.create_dir("attr_dir");
     std::error_code ec = GetTestEC();
-    TEST_CHECK(fs::create_directory(file, attr_dir, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(is_regular_file(file));
+    assert(fs::create_directory(file, attr_dir, ec) == false);
+    assert(ec);
+    assert(is_regular_file(file));
 }
 
-TEST_CASE(dest_part_is_file)
+static void dest_part_is_file()
 {
     scoped_test_env env;
     const path file = env.create_file("file", 42);
     const path dir = env.make_env_path("file/dir1");
     const path attr_dir = env.create_dir("attr_dir");
     std::error_code ec = GetTestEC();
-    TEST_CHECK(fs::create_directory(dir, attr_dir, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(is_regular_file(file));
-    TEST_CHECK(!exists(dir));
+    assert(fs::create_directory(dir, attr_dir, ec) == false);
+    assert(ec);
+    assert(is_regular_file(file));
+    assert(!exists(dir));
 }
 
-TEST_CASE(attr_dir_is_invalid) {
+static void attr_dir_is_invalid() {
   scoped_test_env env;
   const path file = env.create_file("file", 42);
   const path dest = env.make_env_path("dir");
   const path dne = env.make_env_path("dne");
   {
     std::error_code ec = GetTestEC();
-    TEST_CHECK(create_directory(dest, file, ec) == false);
-    TEST_CHECK(ErrorIs(ec, std::errc::not_a_directory));
+    assert(create_directory(dest, file, ec) == false);
+    assert(ErrorIs(ec, std::errc::not_a_directory));
   }
-  TEST_REQUIRE(!exists(dest));
+  assert(!exists(dest));
   {
     std::error_code ec = GetTestEC();
-    TEST_CHECK(create_directory(dest, dne, ec) == false);
-    TEST_CHECK(ErrorIs(ec, std::errc::not_a_directory));
+    assert(create_directory(dest, dne, ec) == false);
+    assert(ErrorIs(ec, std::errc::not_a_directory));
   }
 }
 
-TEST_CASE(dest_is_symlink_to_unexisting) {
+static void dest_is_symlink_to_unexisting() {
   scoped_test_env env;
   const path attr_dir = env.create_dir("attr_dir");
   const path sym = env.create_symlink("dne_sym", "dne_sym_name");
   {
     std::error_code ec = GetTestEC();
-    TEST_CHECK(create_directory(sym, attr_dir, ec) == false);
-    TEST_CHECK(ec);
+    assert(create_directory(sym, attr_dir, ec) == false);
+    assert(ec);
   }
 }
 
-TEST_CASE(dest_is_symlink_to_dir) {
+static void dest_is_symlink_to_dir() {
   scoped_test_env env;
   const path dir = env.create_dir("dir");
   const path sym = env.create_directory_symlink(dir, "sym_name");
   const path attr_dir = env.create_dir("attr_dir");
   {
     std::error_code ec = GetTestEC();
-    TEST_CHECK(create_directory(sym, attr_dir, ec) == false);
-    TEST_CHECK(!ec);
+    assert(create_directory(sym, attr_dir, ec) == false);
+    assert(!ec);
   }
 }
 
-TEST_CASE(dest_is_symlink_to_file) {
+static void dest_is_symlink_to_file() {
   scoped_test_env env;
   const path file = env.create_file("file");
   const path sym = env.create_symlink(file, "sym_name");
   const path attr_dir = env.create_dir("attr_dir");
   {
     std::error_code ec = GetTestEC();
-    TEST_CHECK(create_directory(sym, attr_dir, ec) == false);
-    TEST_CHECK(ec);
+    assert(create_directory(sym, attr_dir, ec) == false);
+    assert(ec);
   }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  test_signatures();
+  create_existing_directory();
+#ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+  create_directory_one_level();
+#endif
+  create_directory_multi_level();
+  dest_is_file();
+  dest_part_is_file();
+  attr_dir_is_invalid();
+  dest_is_symlink_to_unexisting();
+  dest_is_symlink_to_dir();
+  dest_is_symlink_to_file();
+
+  return 0;
+}
index 2b6467b..cd8d053 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_create_directory_symlink_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -33,7 +30,7 @@ TEST_CASE(test_signatures)
     ASSERT_NOEXCEPT(fs::create_directory_symlink(p, p, ec));
 }
 
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     scoped_test_env env;
     const path file = env.create_file("file1", 42);
@@ -42,11 +39,11 @@ TEST_CASE(test_error_reporting)
     { // destination exists
         std::error_code ec;
         fs::create_directory_symlink(sym, file2, ec);
-        TEST_REQUIRE(ec);
+        assert(ec);
     }
 }
 
-TEST_CASE(create_directory_symlink_basic)
+static void create_directory_symlink_basic()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir");
@@ -55,10 +52,15 @@ TEST_CASE(create_directory_symlink_basic)
     const path dest = env.make_env_path("dest1");
     std::error_code ec;
     fs::create_directory_symlink(dir_sym, dest, ec);
-    TEST_REQUIRE(!ec);
-    TEST_CHECK(is_symlink(dest));
-    TEST_CHECK(equivalent(dest, dir));
+    assert(!ec);
+    assert(is_symlink(dest));
+    assert(equivalent(dest, dir));
 }
 
+int main(int, char**) {
+    test_signatures();
+    test_error_reporting();
+    create_directory_symlink_basic();
 
-TEST_SUITE_END()
+    return 0;
+}
index c6785e6..5145cd4 100644 (file)
 #include "filesystem_include.h"
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_create_hard_link_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -32,7 +29,7 @@ TEST_CASE(test_signatures)
     ASSERT_NOEXCEPT(fs::create_hard_link(p, p, ec));
 }
 
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     scoped_test_env env;
     const path file = env.create_file("file1", 42);
@@ -41,25 +38,25 @@ TEST_CASE(test_error_reporting)
     { // destination exists
         std::error_code ec;
         fs::create_hard_link(sym, file2, ec);
-        TEST_REQUIRE(ec);
+        assert(ec);
     }
 }
 
-TEST_CASE(create_file_hard_link)
+static void create_file_hard_link()
 {
     scoped_test_env env;
     const path file = env.create_file("file");
     const path dest = env.make_env_path("dest1");
     std::error_code ec;
-    TEST_CHECK(hard_link_count(file) == 1);
+    assert(hard_link_count(file) == 1);
     fs::create_hard_link(file, dest, ec);
-    TEST_REQUIRE(!ec);
-    TEST_CHECK(exists(dest));
-    TEST_CHECK(equivalent(dest, file));
-    TEST_CHECK(hard_link_count(file) == 2);
+    assert(!ec);
+    assert(exists(dest));
+    assert(equivalent(dest, file));
+    assert(hard_link_count(file) == 2);
 }
 
-TEST_CASE(create_directory_hard_link_fails)
+static void create_directory_hard_link_fails()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir");
@@ -67,7 +64,14 @@ TEST_CASE(create_directory_hard_link_fails)
     std::error_code ec;
 
     fs::create_hard_link(dir, dest, ec);
-    TEST_REQUIRE(ec);
+    assert(ec);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_signatures();
+    test_error_reporting();
+    create_file_hard_link();
+    create_directory_hard_link_fails();
+
+    return 0;
+}
index 3b54cff..28d7f4a 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_create_symlink_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -33,7 +30,7 @@ TEST_CASE(test_signatures)
     ASSERT_NOEXCEPT(fs::create_symlink(p, p, ec));
 }
 
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     scoped_test_env env;
     const path file = env.create_file("file1", 42);
@@ -42,11 +39,11 @@ TEST_CASE(test_error_reporting)
     { // destination exists
         std::error_code ec;
         fs::create_symlink(sym, file2, ec);
-        TEST_REQUIRE(ec);
+        assert(ec);
     }
 }
 
-TEST_CASE(create_symlink_basic)
+static void create_symlink_basic()
 {
     scoped_test_env env;
     const path file = env.create_file("file", 42);
@@ -57,21 +54,21 @@ TEST_CASE(create_symlink_basic)
         const path dest = env.make_env_path("dest1");
         std::error_code ec;
         fs::create_symlink(file_sym, dest, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(is_symlink(dest));
-        TEST_CHECK(equivalent(dest, file));
+        assert(!ec);
+        assert(is_symlink(dest));
+        assert(equivalent(dest, file));
     }
     {
         const path dest = env.make_env_path("dest2");
         std::error_code ec;
         fs::create_directory_symlink(dir_sym, dest, ec);
-        TEST_REQUIRE(!ec);
-        TEST_CHECK(is_symlink(dest));
-        TEST_CHECK(equivalent(dest, dir));
+        assert(!ec);
+        assert(is_symlink(dest));
+        assert(equivalent(dest, dir));
     }
 }
 
-TEST_CASE(create_symlink_dest_cleanup)
+static void create_symlink_dest_cleanup()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir");
@@ -84,12 +81,18 @@ TEST_CASE(create_symlink_dest_cleanup)
     sym_target_normalized.make_preferred();
     std::error_code ec;
     fs::create_symlink(sym_target, sym, ec);
-    TEST_REQUIRE(!ec);
-    TEST_CHECK(equivalent(sym, file, ec));
+    assert(!ec);
+    assert(equivalent(sym, file, ec));
     const path ret = fs::read_symlink(sym, ec);
-    TEST_CHECK(!ec);
-    TEST_CHECK(ret.native() == sym_target_normalized.native());
+    assert(!ec);
+    assert(ret.native() == sym_target_normalized.native());
 }
 
+int main(int, char**) {
+    test_signatures();
+    test_error_reporting();
+    create_symlink_basic();
+    create_symlink_dest_cleanup();
 
-TEST_SUITE_END()
+    return 0;
+}
index 5e90c44..981c549 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_current_path_path_test_suite)
-
-TEST_CASE(current_path_signature_test)
+static void current_path_signature_test()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -37,28 +34,28 @@ TEST_CASE(current_path_signature_test)
     ASSERT_NOEXCEPT(current_path(p, ec));
 }
 
-TEST_CASE(current_path_test)
+static void current_path_test()
 {
     std::error_code ec;
     const path p = current_path(ec);
-    TEST_REQUIRE(!ec);
-    TEST_CHECK(p.is_absolute());
-    TEST_CHECK(is_directory(p));
+    assert(!ec);
+    assert(p.is_absolute());
+    assert(is_directory(p));
 
     const path p2 = current_path();
-    TEST_CHECK(p2 == p);
+    assert(p2 == p);
 }
 
-TEST_CASE(current_path_after_change_test)
+static void current_path_after_change_test()
 {
     static_test_env static_env;
     CWDGuard guard;
     const path new_path = static_env.Dir;
     current_path(new_path);
-    TEST_CHECK(current_path() == new_path);
+    assert(current_path() == new_path);
 }
 
-TEST_CASE(current_path_is_file_test)
+static void current_path_is_file_test()
 {
     static_test_env static_env;
     CWDGuard guard;
@@ -66,11 +63,11 @@ TEST_CASE(current_path_is_file_test)
     std::error_code ec;
     const path old_p = current_path();
     current_path(p, ec);
-    TEST_CHECK(ec);
-    TEST_CHECK(old_p == current_path());
+    assert(ec);
+    assert(old_p == current_path());
 }
 
-TEST_CASE(set_to_non_absolute_path)
+static void set_to_non_absolute_path()
 {
     static_test_env static_env;
     CWDGuard guard;
@@ -79,20 +76,29 @@ TEST_CASE(set_to_non_absolute_path)
     const path p = static_env.Dir2.filename();
     std::error_code ec;
     current_path(p, ec);
-    TEST_CHECK(!ec);
+    assert(!ec);
     const path new_cwd = current_path();
-    TEST_CHECK(new_cwd == static_env.Dir2);
-    TEST_CHECK(new_cwd.is_absolute());
+    assert(new_cwd == static_env.Dir2);
+    assert(new_cwd.is_absolute());
 }
 
-TEST_CASE(set_to_empty)
+static void set_to_empty()
 {
     const path p = "";
     std::error_code ec;
     const path old_p = current_path();
     current_path(p, ec);
-    TEST_CHECK(ec);
-    TEST_CHECK(old_p == current_path());
+    assert(ec);
+    assert(old_p == current_path());
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    current_path_signature_test();
+    current_path_test();
+    current_path_after_change_test();
+    current_path_is_file_test();
+    set_to_non_absolute_path();
+    set_to_empty();
+
+    return 0;
+}
index 5fe8886..e9c8935 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(equivalent_test_suite)
-
-TEST_CASE(signature_test) {
+static void signature_test() {
   const path p;
   ((void)p);
   std::error_code ec;
@@ -34,7 +32,7 @@ TEST_CASE(signature_test) {
   ASSERT_NOT_NOEXCEPT(equivalent(p, p));
 }
 
-TEST_CASE(equivalent_test) {
+static void equivalent_test() {
   static_test_env static_env;
   struct TestCase {
     path lhs;
@@ -51,65 +49,75 @@ TEST_CASE(equivalent_test) {
   };
   for (auto& TC : testCases) {
     std::error_code ec;
-    TEST_CHECK(equivalent(TC.lhs, TC.rhs, ec) == TC.expect);
-    TEST_CHECK(!ec);
+    assert(equivalent(TC.lhs, TC.rhs, ec) == TC.expect);
+    assert(!ec);
   }
 }
 
-TEST_CASE(equivalent_reports_error_if_input_dne) {
+static void equivalent_reports_error_if_input_dne() {
   static_test_env static_env;
   const path E = static_env.File;
   const path DNE = static_env.DNE;
   { // Test that an error is reported when either of the paths don't exist
     std::error_code ec = GetTestEC();
-    TEST_CHECK(equivalent(E, DNE, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(ec != GetTestEC());
+    assert(equivalent(E, DNE, ec) == false);
+    assert(ec);
+    assert(ec != GetTestEC());
   }
   {
     std::error_code ec = GetTestEC();
-    TEST_CHECK(equivalent(DNE, E, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(ec != GetTestEC());
+    assert(equivalent(DNE, E, ec) == false);
+    assert(ec);
+    assert(ec != GetTestEC());
   }
   {
-    TEST_CHECK_THROW(filesystem_error, equivalent(DNE, E));
-    TEST_CHECK_THROW(filesystem_error, equivalent(E, DNE));
+    TEST_THROWS_TYPE(filesystem_error, equivalent(DNE, E));
+    TEST_THROWS_TYPE(filesystem_error, equivalent(E, DNE));
   }
   { // Test that an exception is thrown if both paths do not exist.
-    TEST_CHECK_THROW(filesystem_error, equivalent(DNE, DNE));
+    TEST_THROWS_TYPE(filesystem_error, equivalent(DNE, DNE));
   }
   {
     std::error_code ec = GetTestEC();
-    TEST_CHECK(equivalent(DNE, DNE, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(ec != GetTestEC());
+    assert(equivalent(DNE, DNE, ec) == false);
+    assert(ec);
+    assert(ec != GetTestEC());
   }
 }
 
-TEST_CASE(equivalent_hardlink_succeeds) {
+static void equivalent_hardlink_succeeds() {
   scoped_test_env env;
   path const file = env.create_file("file", 42);
   const path hl1 = env.create_hardlink(file, "hl1");
   const path hl2 = env.create_hardlink(file, "hl2");
-  TEST_CHECK(equivalent(file, hl1));
-  TEST_CHECK(equivalent(file, hl2));
-  TEST_CHECK(equivalent(hl1, hl2));
+  assert(equivalent(file, hl1));
+  assert(equivalent(file, hl2));
+  assert(equivalent(hl1, hl2));
 }
 
 #ifndef _WIN32
-TEST_CASE(equivalent_is_other_succeeds) {
+static void equivalent_is_other_succeeds() {
   scoped_test_env env;
   path const file = env.create_file("file", 42);
   const path fifo1 = env.create_fifo("fifo1");
   const path fifo2 = env.create_fifo("fifo2");
   // Required to test behavior for inputs where is_other(p) is true.
-  TEST_REQUIRE(is_other(fifo1));
-  TEST_CHECK(!equivalent(file, fifo1));
-  TEST_CHECK(!equivalent(fifo2, file));
-  TEST_CHECK(!equivalent(fifo1, fifo2));
-  TEST_CHECK(equivalent(fifo1, fifo1));
+  assert(is_other(fifo1));
+  assert(!equivalent(file, fifo1));
+  assert(!equivalent(fifo2, file));
+  assert(!equivalent(fifo1, fifo2));
+  assert(equivalent(fifo1, fifo1));
 }
+#endif // _WIN32
+
+int main(int, char**) {
+  signature_test();
+  equivalent_test();
+  equivalent_reports_error_if_input_dne();
+  equivalent_hardlink_succeeds();
+#ifndef _WIN32
+  equivalent_is_other_succeeds();
 #endif
 
-TEST_SUITE_END()
+  return 0;
+}
index 13e8b95..c16a592 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(exists_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     file_status s; ((void)s);
     const path p; ((void)p);
@@ -36,7 +34,7 @@ TEST_CASE(signature_test)
     ASSERT_NOT_NOEXCEPT(exists(p));
 }
 
-TEST_CASE(exists_status_test)
+static void exists_status_test()
 {
     struct TestCase {
         file_type type;
@@ -56,33 +54,33 @@ TEST_CASE(exists_status_test)
     };
     for (auto& TC : testCases) {
         file_status s(TC.type);
-        TEST_CHECK(exists(s) == TC.expect);
+        assert(exists(s) == TC.expect);
     }
 }
 
-TEST_CASE(test_exist_not_found)
+static void test_exist_not_found()
 {
     static_test_env static_env;
     const path p = static_env.DNE;
-    TEST_CHECK(exists(p) == false);
+    assert(exists(p) == false);
 
-    TEST_CHECK(exists(static_env.Dir) == true);
-    TEST_CHECK(exists(static_env.Dir / "dne") == false);
+    assert(exists(static_env.Dir) == true);
+    assert(exists(static_env.Dir / "dne") == false);
     // Whether <dir>/dne/.. is considered to exist or not is not necessarily
     // something we need to define, but the platform specific behaviour
     // does affect a few other tests, so clarify the root cause here.
 #ifdef _WIN32
-    TEST_CHECK(exists(static_env.Dir / "dne" / "..") == true);
+    assert(exists(static_env.Dir / "dne" / "..") == true);
 #else
-    TEST_CHECK(exists(static_env.Dir / "dne" / "..") == false);
+    assert(exists(static_env.Dir / "dne" / "..") == false);
 #endif
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(exists(p, ec) == false);
-    TEST_CHECK(!ec);
+    assert(exists(p, ec) == false);
+    assert(!ec);
 }
 
-TEST_CASE(test_exists_fails)
+static void test_exists_fails()
 {
 #ifdef _WIN32
     // Windows doesn't support setting perms::none to trigger failures
@@ -90,7 +88,7 @@ TEST_CASE(test_exists_fails)
     // instead.
     const path p = GetWindowsInaccessibleDir();
     if (p.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     scoped_test_env env;
     const path dir = env.create_dir("dir");
@@ -99,23 +97,33 @@ TEST_CASE(test_exists_fails)
 #endif
 
     std::error_code ec;
-    TEST_CHECK(exists(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(exists(p, ec) == false);
+    assert(ec);
 
-    TEST_CHECK_THROW(filesystem_error, exists(p));
+    TEST_THROWS_TYPE(filesystem_error, exists(p));
 }
 
 #ifndef _WIN32
 // Checking for the existence of an invalid long path name doesn't
 // trigger errors on windows.
-TEST_CASE(test_name_too_long) {
+static void test_name_too_long() {
     std::string long_name(2500, 'a');
     const path file(long_name);
 
     std::error_code ec;
-    TEST_CHECK(exists(file, ec) == false);
-    TEST_CHECK(ec);
+    assert(exists(file, ec) == false);
+    assert(ec);
 }
+#endif // _WIN32
+
+int main(int, char**) {
+    signature_test();
+    exists_status_test();
+    test_exist_not_found();
+    test_exists_fails();
+#ifndef _WIN32
+    test_name_too_long();
 #endif
 
-TEST_SUITE_END()
+    return 0;
+}
index 2b1cb07..e3b9c3e 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(file_size_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -39,33 +37,33 @@ TEST_CASE(signature_test)
     ASSERT_NOEXCEPT(file_size(p, ec));
 }
 
-TEST_CASE(file_size_empty_test)
+static void file_size_empty_test()
 {
     static_test_env static_env;
     const path p = static_env.EmptyFile;
-    TEST_CHECK(file_size(p) == 0);
+    assert(file_size(p) == 0);
     std::error_code ec;
-    TEST_CHECK(file_size(p, ec) == 0);
+    assert(file_size(p, ec) == 0);
 }
 
-TEST_CASE(file_size_non_empty)
+static void file_size_non_empty()
 {
     scoped_test_env env;
     const path p = env.create_file("file", 42);
-    TEST_CHECK(file_size(p) == 42);
+    assert(file_size(p) == 42);
     std::error_code ec;
-    TEST_CHECK(file_size(p, ec) == 42);
+    assert(file_size(p, ec) == 42);
 }
 
-TEST_CASE(symlink_test_case)
+static void symlink_test_case()
 {
     static_test_env static_env;
     const path p = static_env.File;
     const path p2 = static_env.SymlinkToFile;
-    TEST_CHECK(file_size(p) == file_size(p2));
+    assert(file_size(p) == file_size(p2));
 }
 
-TEST_CASE(file_size_error_cases)
+static void file_size_error_cases()
 {
   static_test_env static_env;
   struct {
@@ -80,12 +78,19 @@ TEST_CASE(file_size_error_cases)
     const uintmax_t expect = static_cast<uintmax_t>(-1);
     for (auto& TC : TestCases) {
       std::error_code ec = GetTestEC();
-      TEST_CHECK(file_size(TC.p, ec) == expect);
-      TEST_CHECK(ErrorIs(ec, TC.expected_err));
+      assert(file_size(TC.p, ec) == expect);
+      assert(ErrorIs(ec, TC.expected_err));
 
       ExceptionChecker Checker(TC.p, TC.expected_err, "file_size");
-      TEST_CHECK_THROW_RESULT(filesystem_error, Checker, file_size(TC.p));
+      TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, file_size(TC.p));
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    file_size_empty_test();
+    file_size_non_empty();
+    symlink_test_case();
+    file_size_error_cases();
+    return 0;
+}
index 38b2671..bc37e0c 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(hard_link_count_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -35,15 +32,15 @@ TEST_CASE(signature_test)
     ASSERT_NOEXCEPT(hard_link_count(p, ec));
 }
 
-TEST_CASE(hard_link_count_for_file)
+static void hard_link_count_for_file()
 {
     static_test_env static_env;
-    TEST_CHECK(hard_link_count(static_env.File) == 1);
+    assert(hard_link_count(static_env.File) == 1);
     std::error_code ec;
-    TEST_CHECK(hard_link_count(static_env.File, ec) == 1);
+    assert(hard_link_count(static_env.File, ec) == 1);
 }
 
-TEST_CASE(hard_link_count_for_directory)
+static void hard_link_count_for_directory()
 {
     static_test_env static_env;
     uintmax_t DirExpect = 3; // hard link from . .. and Dir2
@@ -57,33 +54,34 @@ TEST_CASE(hard_link_count_for_directory)
     DirExpectAlt = 5; // .  ..  Dir2  file1  file2
     Dir3Expect = 3; // .  ..  file5
 #endif
-    TEST_CHECK(hard_link_count(static_env.Dir) == DirExpect ||
+    assert(hard_link_count(static_env.Dir) == DirExpect ||
                hard_link_count(static_env.Dir) == DirExpectAlt ||
                hard_link_count(static_env.Dir) == 1);
-    TEST_CHECK(hard_link_count(static_env.Dir3) == Dir3Expect ||
+    assert(hard_link_count(static_env.Dir3) == Dir3Expect ||
                hard_link_count(static_env.Dir3) == Dir3ExpectAlt ||
                hard_link_count(static_env.Dir3) == 1);
 
     std::error_code ec;
-    TEST_CHECK(hard_link_count(static_env.Dir, ec) == DirExpect ||
+    assert(hard_link_count(static_env.Dir, ec) == DirExpect ||
                hard_link_count(static_env.Dir, ec) == DirExpectAlt ||
                hard_link_count(static_env.Dir) == 1);
-    TEST_CHECK(hard_link_count(static_env.Dir3, ec) == Dir3Expect ||
+    assert(hard_link_count(static_env.Dir3, ec) == Dir3Expect ||
                hard_link_count(static_env.Dir3, ec) == Dir3ExpectAlt ||
                hard_link_count(static_env.Dir3) == 1);
 }
-TEST_CASE(hard_link_count_increments_test)
+
+static void hard_link_count_increments_test()
 {
     scoped_test_env env;
     const path file = env.create_file("file", 42);
-    TEST_CHECK(hard_link_count(file) == 1);
+    assert(hard_link_count(file) == 1);
 
     env.create_hardlink(file, "file_hl");
-    TEST_CHECK(hard_link_count(file) == 2);
+    assert(hard_link_count(file) == 2);
 }
 
 
-TEST_CASE(hard_link_count_error_cases)
+static void hard_link_count_error_cases()
 {
     static_test_env static_env;
     const path testCases[] = {
@@ -93,9 +91,17 @@ TEST_CASE(hard_link_count_error_cases)
     const uintmax_t expect = static_cast<uintmax_t>(-1);
     for (auto& TC : testCases) {
         std::error_code ec;
-        TEST_CHECK(hard_link_count(TC, ec) == expect);
-        TEST_CHECK(ec);
+        assert(hard_link_count(TC, ec) == expect);
+        assert(ec);
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    hard_link_count_for_file();
+    hard_link_count_for_directory();
+    hard_link_count_increments_test();
+    hard_link_count_error_cases();
+
+    return 0;
+}
index d288984..3986b18 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(is_block_file_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     file_status s; ((void)s);
     const path p; ((void)p);
@@ -36,7 +34,7 @@ TEST_CASE(signature_test)
     ASSERT_NOT_NOEXCEPT(is_block_file(p));
 }
 
-TEST_CASE(is_block_file_status_test)
+static void is_block_file_status_test()
 {
     struct TestCase {
         file_type type;
@@ -56,18 +54,18 @@ TEST_CASE(is_block_file_status_test)
     };
     for (auto& TC : testCases) {
         file_status s(TC.type);
-        TEST_CHECK(is_block_file(s) == TC.expect);
+        assert(is_block_file(s) == TC.expect);
     }
 }
 
-TEST_CASE(test_exist_not_found)
+static void test_exist_not_found()
 {
     static_test_env static_env;
     const path p = static_env.DNE;
-    TEST_CHECK(is_block_file(p) == false);
+    assert(is_block_file(p) == false);
 }
 
-TEST_CASE(test_is_block_file_fails)
+static void test_is_block_file_fails()
 {
     scoped_test_env env;
 #ifdef _WIN32
@@ -76,7 +74,7 @@ TEST_CASE(test_is_block_file_fails)
     // instead.
     const path p = GetWindowsInaccessibleDir();
     if (p.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     const path dir = env.create_dir("dir");
     const path p = env.create_file("dir/file", 42);
@@ -84,10 +82,17 @@ TEST_CASE(test_is_block_file_fails)
 #endif
 
     std::error_code ec;
-    TEST_CHECK(is_block_file(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(is_block_file(p, ec) == false);
+    assert(ec);
 
-    TEST_CHECK_THROW(filesystem_error, is_block_file(p));
+    TEST_THROWS_TYPE(filesystem_error, is_block_file(p));
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    is_block_file_status_test();
+    test_exist_not_found();
+    test_is_block_file_fails();
+
+    return 0;
+}
index 738e06c..610d97b 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(is_character_file_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     file_status s; ((void)s);
     const path p; ((void)p);
@@ -36,7 +34,7 @@ TEST_CASE(signature_test)
     ASSERT_NOT_NOEXCEPT(is_character_file(p));
 }
 
-TEST_CASE(is_character_file_status_test)
+static void is_character_file_status_test()
 {
     struct TestCase {
         file_type type;
@@ -56,18 +54,18 @@ TEST_CASE(is_character_file_status_test)
     };
     for (auto& TC : testCases) {
         file_status s(TC.type);
-        TEST_CHECK(is_character_file(s) == TC.expect);
+        assert(is_character_file(s) == TC.expect);
     }
 }
 
-TEST_CASE(test_exist_not_found)
+static void test_exist_not_found()
 {
     static_test_env static_env;
     const path p = static_env.DNE;
-    TEST_CHECK(is_character_file(p) == false);
+    assert(is_character_file(p) == false);
 }
 
-TEST_CASE(test_is_character_file_fails)
+static void test_is_character_file_fails()
 {
     scoped_test_env env;
 #ifdef _WIN32
@@ -76,7 +74,7 @@ TEST_CASE(test_is_character_file_fails)
     // instead.
     const path p = GetWindowsInaccessibleDir();
     if (p.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     const path dir = env.create_dir("dir");
     const path p = env.create_file("dir/file", 42);
@@ -84,10 +82,17 @@ TEST_CASE(test_is_character_file_fails)
 #endif
 
     std::error_code ec;
-    TEST_CHECK(is_character_file(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(is_character_file(p, ec) == false);
+    assert(ec);
 
-    TEST_CHECK_THROW(filesystem_error, is_character_file(p));
+    TEST_THROWS_TYPE(filesystem_error, is_character_file(p));
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    is_character_file_status_test();
+    test_exist_not_found();
+    test_is_character_file_fails();
+
+    return 0;
+}
index 8b1e41e..7cb297b 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(is_directory_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     file_status s; ((void)s);
     const path p; ((void)p);
@@ -36,7 +34,7 @@ TEST_CASE(signature_test)
     ASSERT_NOT_NOEXCEPT(is_directory(p));
 }
 
-TEST_CASE(is_directory_status_test)
+static void is_directory_status_test()
 {
     struct TestCase {
         file_type type;
@@ -56,26 +54,26 @@ TEST_CASE(is_directory_status_test)
     };
     for (auto& TC : testCases) {
         file_status s(TC.type);
-        TEST_CHECK(is_directory(s) == TC.expect);
+        assert(is_directory(s) == TC.expect);
     }
 }
 
-TEST_CASE(test_exist_not_found)
+static void test_exist_not_found()
 {
     static_test_env static_env;
     const path p = static_env.DNE;
-    TEST_CHECK(is_directory(p) == false);
+    assert(is_directory(p) == false);
 }
 
-TEST_CASE(static_env_test)
+static void static_env_test()
 {
     static_test_env static_env;
-    TEST_CHECK(is_directory(static_env.Dir));
-    TEST_CHECK(is_directory(static_env.SymlinkToDir));
-    TEST_CHECK(!is_directory(static_env.File));
+    assert(is_directory(static_env.Dir));
+    assert(is_directory(static_env.SymlinkToDir));
+    assert(!is_directory(static_env.File));
 }
 
-TEST_CASE(test_is_directory_fails)
+static void test_is_directory_fails()
 {
     scoped_test_env env;
 #ifdef _WIN32
@@ -84,7 +82,7 @@ TEST_CASE(test_is_directory_fails)
     // instead.
     const path p = GetWindowsInaccessibleDir();
     if (p.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     const path dir = env.create_dir("dir");
     const path p = env.create_dir("dir/dir2");
@@ -92,10 +90,18 @@ TEST_CASE(test_is_directory_fails)
 #endif
 
     std::error_code ec;
-    TEST_CHECK(is_directory(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(is_directory(p, ec) == false);
+    assert(ec);
 
-    TEST_CHECK_THROW(filesystem_error, is_directory(p));
+    TEST_THROWS_TYPE(filesystem_error, is_directory(p));
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    is_directory_status_test();
+    test_exist_not_found();
+    static_env_test();
+    test_is_directory_fails();
+
+    return 0;
+}
index 8478037..752e682 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(is_empty_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -33,39 +31,39 @@ TEST_CASE(signature_test)
     ASSERT_NOT_NOEXCEPT(is_empty(p));
 }
 
-TEST_CASE(test_exist_not_found)
+static void test_exist_not_found()
 {
     static_test_env static_env;
     const path p = static_env.DNE;
     std::error_code ec;
-    TEST_CHECK(is_empty(p, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK_THROW(filesystem_error, is_empty(p));
+    assert(is_empty(p, ec) == false);
+    assert(ec);
+    TEST_THROWS_TYPE(filesystem_error, is_empty(p));
 }
 
-TEST_CASE(test_is_empty_directory)
+static void test_is_empty_directory()
 {
     static_test_env static_env;
-    TEST_CHECK(!is_empty(static_env.Dir));
-    TEST_CHECK(!is_empty(static_env.SymlinkToDir));
+    assert(!is_empty(static_env.Dir));
+    assert(!is_empty(static_env.SymlinkToDir));
 }
 
-TEST_CASE(test_is_empty_directory_dynamic)
+static void test_is_empty_directory_dynamic()
 {
     scoped_test_env env;
-    TEST_CHECK(is_empty(env.test_root));
+    assert(is_empty(env.test_root));
     env.create_file("foo", 42);
-    TEST_CHECK(!is_empty(env.test_root));
+    assert(!is_empty(env.test_root));
 }
 
-TEST_CASE(test_is_empty_file)
+static void test_is_empty_file()
 {
     static_test_env static_env;
-    TEST_CHECK(is_empty(static_env.EmptyFile));
-    TEST_CHECK(!is_empty(static_env.NonEmptyFile));
+    assert(is_empty(static_env.EmptyFile));
+    assert(!is_empty(static_env.NonEmptyFile));
 }
 
-TEST_CASE(test_is_empty_fails)
+static void test_is_empty_fails()
 {
     scoped_test_env env;
 #ifdef _WIN32
@@ -74,7 +72,7 @@ TEST_CASE(test_is_empty_fails)
     // instead.
     const path p = GetWindowsInaccessibleDir();
     if (p.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     const path dir = env.create_dir("dir");
     const path p = env.create_dir("dir/dir2");
@@ -82,13 +80,13 @@ TEST_CASE(test_is_empty_fails)
 #endif
 
     std::error_code ec;
-    TEST_CHECK(is_empty(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(is_empty(p, ec) == false);
+    assert(ec);
 
-    TEST_CHECK_THROW(filesystem_error, is_empty(p));
+    TEST_THROWS_TYPE(filesystem_error, is_empty(p));
 }
 
-TEST_CASE(test_directory_access_denied)
+static void test_directory_access_denied()
 {
     scoped_test_env env;
 #ifdef _WIN32
@@ -97,7 +95,7 @@ TEST_CASE(test_directory_access_denied)
     // instead.
     const path dir = GetWindowsInaccessibleDir();
     if (dir.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     const path dir = env.create_dir("dir");
     const path file1 = env.create_file("dir/file", 42);
@@ -105,27 +103,40 @@ TEST_CASE(test_directory_access_denied)
 #endif
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(is_empty(dir, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(ec != GetTestEC());
+    assert(is_empty(dir, ec) == false);
+    assert(ec);
+    assert(ec != GetTestEC());
 
-    TEST_CHECK_THROW(filesystem_error, is_empty(dir));
+    TEST_THROWS_TYPE(filesystem_error, is_empty(dir));
 }
 
 
 #ifndef _WIN32
-TEST_CASE(test_fifo_fails)
+static void test_fifo_fails()
 {
     scoped_test_env env;
     const path fifo = env.create_fifo("fifo");
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(is_empty(fifo, ec) == false);
-    TEST_CHECK(ec);
-    TEST_CHECK(ec != GetTestEC());
+    assert(is_empty(fifo, ec) == false);
+    assert(ec);
+    assert(ec != GetTestEC());
 
-    TEST_CHECK_THROW(filesystem_error, is_empty(fifo));
+    TEST_THROWS_TYPE(filesystem_error, is_empty(fifo));
 }
+#endif // _WIN32
+
+int main(int, char**) {
+    signature_test();
+    test_exist_not_found();
+    test_is_empty_directory();
+    test_is_empty_directory_dynamic();
+    test_is_empty_file();
+    test_is_empty_fails();
+    test_directory_access_denied();
+#ifndef _WIN32
+    test_fifo_fails();
 #endif
 
-TEST_SUITE_END()
+    return 0;
+}
index 0169fed..b0ef430 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(is_fifo_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     file_status s; ((void)s);
     const path p; ((void)p);
@@ -36,7 +34,7 @@ TEST_CASE(signature_test)
     ASSERT_NOT_NOEXCEPT(is_fifo(p));
 }
 
-TEST_CASE(is_fifo_status_test)
+static void is_fifo_status_test()
 {
     struct TestCase {
         file_type type;
@@ -56,18 +54,18 @@ TEST_CASE(is_fifo_status_test)
     };
     for (auto& TC : testCases) {
         file_status s(TC.type);
-        TEST_CHECK(is_fifo(s) == TC.expect);
+        assert(is_fifo(s) == TC.expect);
     }
 }
 
-TEST_CASE(test_exist_not_found)
+static void test_exist_not_found()
 {
     static_test_env static_env;
     const path p = static_env.DNE;
-    TEST_CHECK(is_fifo(p) == false);
+    assert(is_fifo(p) == false);
 }
 
-TEST_CASE(test_is_fifo_fails)
+static void test_is_fifo_fails()
 {
     scoped_test_env env;
 #ifdef _WIN32
@@ -76,7 +74,7 @@ TEST_CASE(test_is_fifo_fails)
     // instead.
     const path p = GetWindowsInaccessibleDir();
     if (p.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     const path dir = env.create_dir("dir");
     const path p = env.create_file("dir/file", 42);
@@ -84,10 +82,17 @@ TEST_CASE(test_is_fifo_fails)
 #endif
 
     std::error_code ec;
-    TEST_CHECK(is_fifo(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(is_fifo(p, ec) == false);
+    assert(ec);
 
-    TEST_CHECK_THROW(filesystem_error, is_fifo(p));
+    TEST_THROWS_TYPE(filesystem_error, is_fifo(p));
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    is_fifo_status_test();
+    test_exist_not_found();
+    test_is_fifo_fails();
+
+    return 0;
+}
index f84eb7d..8b37190 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(is_other_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     file_status s; ((void)s);
     const path p; ((void)p);
@@ -36,7 +34,7 @@ TEST_CASE(signature_test)
     ASSERT_NOT_NOEXCEPT(is_other(p));
 }
 
-TEST_CASE(is_other_status_test)
+static void is_other_status_test()
 {
     struct TestCase {
         file_type type;
@@ -56,18 +54,18 @@ TEST_CASE(is_other_status_test)
     };
     for (auto& TC : testCases) {
         file_status s(TC.type);
-        TEST_CHECK(is_other(s) == TC.expect);
+        assert(is_other(s) == TC.expect);
     }
 }
 
-TEST_CASE(test_exist_not_found)
+static void test_exist_not_found()
 {
     static_test_env static_env;
     const path p = static_env.DNE;
-    TEST_CHECK(is_other(p) == false);
+    assert(is_other(p) == false);
 }
 
-TEST_CASE(test_is_other_fails)
+static void test_is_other_fails()
 {
     scoped_test_env env;
 #ifdef _WIN32
@@ -76,7 +74,7 @@ TEST_CASE(test_is_other_fails)
     // instead.
     const path p = GetWindowsInaccessibleDir();
     if (p.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     const path dir = env.create_dir("dir");
     const path p = env.create_file("dir/file", 42);
@@ -84,10 +82,17 @@ TEST_CASE(test_is_other_fails)
 #endif
 
     std::error_code ec;
-    TEST_CHECK(is_other(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(is_other(p, ec) == false);
+    assert(ec);
 
-    TEST_CHECK_THROW(filesystem_error, is_other(p));
+    TEST_THROWS_TYPE(filesystem_error, is_other(p));
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    is_other_status_test();
+    test_exist_not_found();
+    test_is_other_fails();
+
+    return 0;
+}
index 441f15a..b32ce64 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(is_regular_file_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     file_status s; ((void)s);
     const path p; ((void)p);
@@ -36,7 +34,7 @@ TEST_CASE(signature_test)
     ASSERT_NOT_NOEXCEPT(is_regular_file(p));
 }
 
-TEST_CASE(is_regular_file_status_test)
+static void is_regular_file_status_test()
 {
     struct TestCase {
         file_type type;
@@ -56,21 +54,21 @@ TEST_CASE(is_regular_file_status_test)
     };
     for (auto& TC : testCases) {
         file_status s(TC.type);
-        TEST_CHECK(is_regular_file(s) == TC.expect);
+        assert(is_regular_file(s) == TC.expect);
     }
 }
 
-TEST_CASE(test_exist_not_found)
+static void test_exist_not_found()
 {
     static_test_env static_env;
     const path p = static_env.DNE;
-    TEST_CHECK(is_regular_file(p) == false);
+    assert(is_regular_file(p) == false);
     std::error_code ec;
-    TEST_CHECK(is_regular_file(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(is_regular_file(p, ec) == false);
+    assert(ec);
 }
 
-TEST_CASE(test_is_regular_file_fails)
+static void test_is_regular_file_fails()
 {
     scoped_test_env env;
 #ifdef _WIN32
@@ -79,7 +77,7 @@ TEST_CASE(test_is_regular_file_fails)
     // instead.
     const path p = GetWindowsInaccessibleDir();
     if (p.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     const path dir = env.create_dir("dir");
     const path p = env.create_file("dir/file", 42);
@@ -87,10 +85,17 @@ TEST_CASE(test_is_regular_file_fails)
 #endif
 
     std::error_code ec;
-    TEST_CHECK(is_regular_file(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(is_regular_file(p, ec) == false);
+    assert(ec);
 
-    TEST_CHECK_THROW(filesystem_error, is_regular_file(p));
+    TEST_THROWS_TYPE(filesystem_error, is_regular_file(p));
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    is_regular_file_status_test();
+    test_exist_not_found();
+    test_is_regular_file_fails();
+
+    return 0;
+}
index 21aa537..da5169f 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(is_socket_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     file_status s; ((void)s);
     const path p; ((void)p);
@@ -36,7 +34,7 @@ TEST_CASE(signature_test)
     ASSERT_NOT_NOEXCEPT(is_socket(p));
 }
 
-TEST_CASE(is_socket_status_test)
+static void is_socket_status_test()
 {
     struct TestCase {
         file_type type;
@@ -56,18 +54,18 @@ TEST_CASE(is_socket_status_test)
     };
     for (auto& TC : testCases) {
         file_status s(TC.type);
-        TEST_CHECK(is_socket(s) == TC.expect);
+        assert(is_socket(s) == TC.expect);
     }
 }
 
-TEST_CASE(test_exist_not_found)
+static void test_exist_not_found()
 {
     static_test_env static_env;
     const path p = static_env.DNE;
-    TEST_CHECK(is_socket(p) == false);
+    assert(is_socket(p) == false);
 }
 
-TEST_CASE(test_is_socket_fails)
+static void test_is_socket_fails()
 {
     scoped_test_env env;
 #ifdef _WIN32
@@ -76,7 +74,7 @@ TEST_CASE(test_is_socket_fails)
     // instead.
     const path p = GetWindowsInaccessibleDir();
     if (p.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     const path dir = env.create_dir("dir");
     const path p = env.create_file("dir/file", 42);
@@ -84,10 +82,17 @@ TEST_CASE(test_is_socket_fails)
 #endif
 
     std::error_code ec;
-    TEST_CHECK(is_socket(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(is_socket(p, ec) == false);
+    assert(ec);
 
-    TEST_CHECK_THROW(filesystem_error, is_socket(p));
+    TEST_THROWS_TYPE(filesystem_error, is_socket(p));
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    is_socket_status_test();
+    test_exist_not_found();
+    test_is_socket_fails();
+
+    return 0;
+}
index d8ec533..e8ee7f4 100644 (file)
 #include <type_traits>
 #include <cassert>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(is_symlink_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     file_status s; ((void)s);
     const path p; ((void)p);
@@ -36,7 +34,7 @@ TEST_CASE(signature_test)
     ASSERT_NOT_NOEXCEPT(is_symlink(p));
 }
 
-TEST_CASE(is_symlink_status_test)
+static void is_symlink_status_test()
 {
     struct TestCase {
         file_type type;
@@ -56,11 +54,11 @@ TEST_CASE(is_symlink_status_test)
     };
     for (auto& TC : testCases) {
         file_status s(TC.type);
-        TEST_CHECK(is_symlink(s) == TC.expect);
+        assert(is_symlink(s) == TC.expect);
     }
 }
 
-TEST_CASE(static_env_test)
+static void static_env_test()
 {
     static_test_env static_env;
     struct TestCase {
@@ -75,21 +73,21 @@ TEST_CASE(static_env_test)
         {static_env.BadSymlink, true}
     };
     for (auto& TC : testCases) {
-        TEST_CHECK(is_symlink(TC.p) == TC.expect);
+        assert(is_symlink(TC.p) == TC.expect);
     }
 }
 
-TEST_CASE(test_exist_not_found)
+static void test_exist_not_found()
 {
     static_test_env static_env;
     const path p = static_env.DNE;
-    TEST_CHECK(is_symlink(p) == false);
+    assert(is_symlink(p) == false);
     std::error_code ec;
-    TEST_CHECK(is_symlink(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(is_symlink(p, ec) == false);
+    assert(ec);
 }
 
-TEST_CASE(test_is_symlink_fails)
+static void test_is_symlink_fails()
 {
     scoped_test_env env;
 #ifdef _WIN32
@@ -98,7 +96,7 @@ TEST_CASE(test_is_symlink_fails)
     // instead.
     const path p = GetWindowsInaccessibleDir();
     if (p.empty())
-        TEST_UNSUPPORTED();
+        return;
 #else
     const path dir = env.create_dir("dir");
     const path p = env.create_file("dir/file", 42);
@@ -106,10 +104,18 @@ TEST_CASE(test_is_symlink_fails)
 #endif
 
     std::error_code ec;
-    TEST_CHECK(is_symlink(p, ec) == false);
-    TEST_CHECK(ec);
+    assert(is_symlink(p, ec) == false);
+    assert(ec);
 
-    TEST_CHECK_THROW(filesystem_error, is_symlink(p));
+    TEST_THROWS_TYPE(filesystem_error, is_symlink(p));
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    is_symlink_status_test();
+    static_env_test();
+    test_exist_not_found();
+    test_is_symlink_fails();
+
+    return 0;
+}
index cfff7c2..51546f3 100644 (file)
@@ -29,7 +29,6 @@
 #include <type_traits>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 #include <fcntl.h>
@@ -376,9 +375,7 @@ file_time_type::duration SubSec(long long val) {
   }
 }
 
-TEST_SUITE(last_write_time_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     const file_time_type t;
     const path p; ((void)p);
@@ -393,7 +390,7 @@ TEST_CASE(signature_test)
     ASSERT_NOEXCEPT(last_write_time(p, t, ec));
 }
 
-TEST_CASE(read_last_write_time_static_env_test)
+static void read_last_write_time_static_env_test()
 {
     static_test_env static_env;
     using C = file_time_type::clock;
@@ -405,29 +402,28 @@ TEST_CASE(read_last_write_time_static_env_test)
     SleepFor(MilliSec(30));
     {
         file_time_type ret = last_write_time(static_env.File);
-        TEST_CHECK(ret != min);
-        TEST_CHECK(ret < C::now());
-        TEST_CHECK(CompareTime(ret, LastWriteTime(static_env.File)));
+        assert(ret != min);
+        assert(ret < C::now());
+        assert(CompareTime(ret, LastWriteTime(static_env.File)));
 
         file_time_type ret2 = last_write_time(static_env.SymlinkToFile);
-        TEST_CHECK(CompareTime(ret, ret2));
-        TEST_CHECK(CompareTime(ret2, LastWriteTime(static_env.SymlinkToFile)));
+        assert(CompareTime(ret, ret2));
+        assert(CompareTime(ret2, LastWriteTime(static_env.SymlinkToFile)));
     }
     {
         file_time_type ret = last_write_time(static_env.Dir);
-        TEST_CHECK(ret != min);
-        TEST_CHECK(ret < C::now());
-        TEST_CHECK(CompareTime(ret, LastWriteTime(static_env.Dir)));
+        assert(ret != min);
+        assert(ret < C::now());
+        assert(CompareTime(ret, LastWriteTime(static_env.Dir)));
 
         file_time_type ret2 = last_write_time(static_env.SymlinkToDir);
-        TEST_CHECK(CompareTime(ret, ret2));
-        TEST_CHECK(CompareTime(ret2, LastWriteTime(static_env.SymlinkToDir)));
+        assert(CompareTime(ret, ret2));
+        assert(CompareTime(ret2, LastWriteTime(static_env.SymlinkToDir)));
     }
 }
 
-TEST_CASE(get_last_write_time_dynamic_env_test)
+static void get_last_write_time_dynamic_env_test()
 {
-    using Sec = std::chrono::seconds;
     scoped_test_env env;
 
     const path file = env.create_file("file", 42);
@@ -439,12 +435,12 @@ TEST_CASE(get_last_write_time_dynamic_env_test)
     const TimeSpec dir_write_time = dir_times.write;
 
     file_time_type ftime = last_write_time(file);
-    TEST_CHECK(CompareTime(ftime, file_write_time));
+    assert(CompareTime(ftime, file_write_time));
 
     file_time_type dtime = last_write_time(dir);
-    TEST_CHECK(CompareTime(dtime, dir_write_time));
+    assert(CompareTime(dtime, dir_write_time));
 
-    SleepFor(Sec(2));
+    SleepFor(std::chrono::seconds(2));
 
     // update file and add a file to the directory. Make sure the times increase.
     std::FILE* of = std::fopen(file.string().c_str(), "a");
@@ -455,14 +451,14 @@ TEST_CASE(get_last_write_time_dynamic_env_test)
     file_time_type ftime2 = last_write_time(file);
     file_time_type dtime2 = last_write_time(dir);
 
-    TEST_CHECK(ftime2 > ftime);
-    TEST_CHECK(dtime2 > dtime);
-    TEST_CHECK(CompareTime(LastWriteTime(file), ftime2));
-    TEST_CHECK(CompareTime(LastWriteTime(dir), dtime2));
+    assert(ftime2 > ftime);
+    assert(dtime2 > dtime);
+    assert(CompareTime(LastWriteTime(file), ftime2));
+    assert(CompareTime(LastWriteTime(dir), dtime2));
 }
 
 
-TEST_CASE(set_last_write_time_dynamic_env_test)
+static void set_last_write_time_dynamic_env_test()
 {
     using Clock = file_time_type::clock;
     scoped_test_env env;
@@ -513,25 +509,25 @@ TEST_CASE(set_last_write_time_dynamic_env_test)
     for (const auto& TC : cases) {
         const auto old_times = GetTimes(TC.p);
         file_time_type old_time;
-        TEST_REQUIRE(ConvertFromTimeSpec(old_time, old_times.write));
+        assert(ConvertFromTimeSpec(old_time, old_times.write));
 
         std::error_code ec = GetTestEC();
         last_write_time(TC.p, TC.new_time, ec);
-        TEST_CHECK(!ec);
+        assert(!ec);
 
         ec = GetTestEC();
         file_time_type  got_time = last_write_time(TC.p, ec);
-        TEST_REQUIRE(!ec);
+        assert(!ec);
 
         if (TimeIsRepresentableByFilesystem(TC.new_time)) {
-            TEST_CHECK(got_time != old_time);
-            TEST_CHECK(CompareTime(got_time, TC.new_time));
-            TEST_CHECK(CompareTime(LastAccessTime(TC.p), old_times.access));
+            assert(got_time != old_time);
+            assert(CompareTime(got_time, TC.new_time));
+            assert(CompareTime(LastAccessTime(TC.p), old_times.access));
         }
     }
 }
 
-TEST_CASE(last_write_time_symlink_test)
+static void last_write_time_symlink_test()
 {
     using Clock = file_time_type::clock;
 
@@ -547,24 +543,24 @@ TEST_CASE(last_write_time_symlink_test)
 
     std::error_code ec = GetTestEC();
     last_write_time(sym, new_time, ec);
-    TEST_CHECK(!ec);
+    assert(!ec);
 
     file_time_type  got_time = last_write_time(sym);
-    TEST_CHECK(!CompareTime(got_time, old_times.write));
+    assert(!CompareTime(got_time, old_times.write));
     if (!WorkaroundStatTruncatesToSeconds) {
-      TEST_CHECK(got_time == new_time);
+      assert(got_time == new_time);
     } else {
-      TEST_CHECK(CompareTime(got_time, new_time));
+      assert(CompareTime(got_time, new_time));
     }
 
-    TEST_CHECK(CompareTime(LastWriteTime(file), new_time));
-    TEST_CHECK(CompareTime(LastAccessTime(sym), old_times.access));
+    assert(CompareTime(LastWriteTime(file), new_time));
+    assert(CompareTime(LastAccessTime(sym), old_times.access));
     Times sym_times = GetSymlinkTimes(sym);
-    TEST_CHECK(CompareTime(sym_times.write, old_sym_times.write));
+    assert(CompareTime(sym_times.write, old_sym_times.write));
 }
 
 
-TEST_CASE(test_write_min_time)
+static void test_write_min_time()
 {
     scoped_test_env env;
     const path p = env.create_file("file", 42);
@@ -576,8 +572,8 @@ TEST_CASE(test_write_min_time)
     file_time_type tt = last_write_time(p);
 
     if (TimeIsRepresentableByFilesystem(new_time)) {
-        TEST_CHECK(!ec);
-        TEST_CHECK(CompareTime(tt, new_time));
+        assert(!ec);
+        assert(CompareTime(tt, new_time));
 
         last_write_time(p, old_time);
         new_time = file_time_type::min() + SubSec(1);
@@ -587,19 +583,19 @@ TEST_CASE(test_write_min_time)
         tt = last_write_time(p);
 
         if (TimeIsRepresentableByFilesystem(new_time)) {
-            TEST_CHECK(!ec);
-            TEST_CHECK(CompareTime(tt, new_time));
+            assert(!ec);
+            assert(CompareTime(tt, new_time));
         } else {
-          TEST_CHECK(ErrorIs(ec, std::errc::value_too_large));
-          TEST_CHECK(tt == old_time);
+          assert(ErrorIs(ec, std::errc::value_too_large));
+          assert(tt == old_time);
         }
     } else {
-      TEST_CHECK(ErrorIs(ec, std::errc::value_too_large));
-      TEST_CHECK(tt == old_time);
+      assert(ErrorIs(ec, std::errc::value_too_large));
+      assert(tt == old_time);
     }
 }
 
-TEST_CASE(test_write_max_time) {
+static void test_write_max_time() {
   scoped_test_env env;
   const path p = env.create_file("file", 42);
   const file_time_type old_time = last_write_time(p);
@@ -610,27 +606,27 @@ TEST_CASE(test_write_max_time) {
   file_time_type tt = last_write_time(p);
 
   if (TimeIsRepresentableByFilesystem(new_time)) {
-    TEST_CHECK(!ec);
-    TEST_CHECK(CompareTime(tt, new_time));
+    assert(!ec);
+    assert(CompareTime(tt, new_time));
   } else {
-    TEST_CHECK(ErrorIs(ec, std::errc::value_too_large));
-    TEST_CHECK(tt == old_time);
+    assert(ErrorIs(ec, std::errc::value_too_large));
+    assert(tt == old_time);
   }
 }
 
-TEST_CASE(test_value_on_failure)
+static void test_value_on_failure()
 {
     static_test_env static_env;
     const path p = static_env.DNE;
     std::error_code ec = GetTestEC();
-    TEST_CHECK(last_write_time(p, ec) == file_time_type::min());
-    TEST_CHECK(ErrorIs(ec, std::errc::no_such_file_or_directory));
+    assert(last_write_time(p, ec) == file_time_type::min());
+    assert(ErrorIs(ec, std::errc::no_such_file_or_directory));
 }
 
 // Windows doesn't support setting perms::none to trigger failures
 // reading directories.
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
-TEST_CASE(test_exists_fails)
+static void test_exists_fails()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir");
@@ -638,13 +634,26 @@ TEST_CASE(test_exists_fails)
     permissions(dir, perms::none);
 
     std::error_code ec = GetTestEC();
-    TEST_CHECK(last_write_time(file, ec) == file_time_type::min());
-    TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
+    assert(last_write_time(file, ec) == file_time_type::min());
+    assert(ErrorIs(ec, std::errc::permission_denied));
 
     ExceptionChecker Checker(file, std::errc::permission_denied,
                              "last_write_time");
-    TEST_CHECK_THROW_RESULT(filesystem_error, Checker, last_write_time(file));
+    TEST_VALIDATE_EXCEPTION(filesystem_error, Checker, last_write_time(file));
 }
+#endif // TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+
+int main(int, char**) {
+    signature_test();
+    read_last_write_time_static_env_test();
+    get_last_write_time_dynamic_env_test();
+    set_last_write_time_dynamic_env_test();
+    last_write_time_symlink_test();
+    test_write_min_time();
+    test_write_max_time();
+    test_value_on_failure();
+#ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+    test_exists_fails();
 #endif
-
-TEST_SUITE_END()
+  return 0;
+}
index 7cf1c72..dc5ff11 100644 (file)
 #include "filesystem_include.h"
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
 using PR = fs::perms;
 
-TEST_SUITE(filesystem_permissions_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     const perms pr{}; ((void)pr);
@@ -41,7 +38,7 @@ TEST_CASE(test_signatures)
     LIBCPP_ONLY(ASSERT_NOT_NOEXCEPT(fs::permissions(p, pr, opts, ec)));
 }
 
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     auto checkThrow = [](path const& f, fs::perms opts,
                          const std::error_code& ec)
@@ -67,20 +64,20 @@ TEST_CASE(test_error_reporting)
     { // !exists
         std::error_code ec = GetTestEC();
         fs::permissions(dne, fs::perms{}, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(ec != GetTestEC());
-        TEST_CHECK(checkThrow(dne, fs::perms{}, ec));
+        assert(ec);
+        assert(ec != GetTestEC());
+        assert(checkThrow(dne, fs::perms{}, ec));
     }
     {
         std::error_code ec = GetTestEC();
         fs::permissions(dne_sym, fs::perms{}, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(ec != GetTestEC());
-        TEST_CHECK(checkThrow(dne_sym, fs::perms{}, ec));
+        assert(ec);
+        assert(ec != GetTestEC());
+        assert(checkThrow(dne_sym, fs::perms{}, ec));
     }
 }
 
-TEST_CASE(basic_permissions_test)
+static void basic_permissions_test()
 {
     scoped_test_env env;
     const path file = env.create_file("file1", 42);
@@ -120,20 +117,20 @@ TEST_CASE(basic_permissions_test)
         {dir,  perms::group_all, perms::owner_all | perms::group_all, AP | NF}
     };
     for (auto const& TC : cases) {
-        TEST_CHECK(status(TC.p).permissions() != TC.expected);
+        assert(status(TC.p).permissions() != TC.expected);
         {
           std::error_code ec = GetTestEC();
           permissions(TC.p, TC.set_perms, TC.opts, ec);
-          TEST_CHECK(!ec);
+          assert(!ec);
           auto pp = status(TC.p).permissions();
-          TEST_CHECK(pp == NormalizeExpectedPerms(TC.expected));
+          assert(pp == NormalizeExpectedPerms(TC.expected));
         }
         if (TC.opts == perm_options::replace) {
           std::error_code ec = GetTestEC();
           permissions(TC.p, TC.set_perms, ec);
-          TEST_CHECK(!ec);
+          assert(!ec);
           auto pp = status(TC.p).permissions();
-          TEST_CHECK(pp == NormalizeExpectedPerms(TC.expected));
+          assert(pp == NormalizeExpectedPerms(TC.expected));
         }
     }
 }
@@ -142,7 +139,7 @@ TEST_CASE(basic_permissions_test)
 // This test isn't currently meaningful on Windows; the Windows file
 // permissions visible via std::filesystem doesn't show any difference
 // between owner/group/others.
-TEST_CASE(test_no_resolve_symlink_on_symlink)
+static void test_no_resolve_symlink_on_symlink()
 {
     scoped_test_env env;
     const path file = env.create_file("file", 42);
@@ -177,13 +174,21 @@ TEST_CASE(test_no_resolve_symlink_on_symlink)
         std::error_code ec = GetTestEC();
         permissions(sym, TC.set_perms, TC.opts | perm_options::nofollow, ec);
         if (expected_ec)
-            TEST_CHECK(ErrorIs(ec, static_cast<std::errc>(expected_ec.value())));
+            assert(ErrorIs(ec, static_cast<std::errc>(expected_ec.value())));
         else
-            TEST_CHECK(!ec);
-        TEST_CHECK(status(file).permissions() == file_perms);
-        TEST_CHECK(symlink_status(sym).permissions() == expected_link_perms);
+            assert(!ec);
+        assert(status(file).permissions() == file_perms);
+        assert(symlink_status(sym).permissions() == expected_link_perms);
     }
 }
-#endif
+#endif // _WIN32
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_signatures();
+    test_error_reporting();
+    basic_permissions_test();
+#ifndef _WIN32
+    test_no_resolve_symlink_on_symlink();
+#endif
+    return 0;
+}
index b1341ee..2970d9f 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "test_macros.h"
 #include "count_new.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 
@@ -33,10 +32,8 @@ static int count_path_elems(const fs::path& p) {
   return count;
 }
 
-TEST_SUITE(filesystem_proximate_path_test_suite)
 
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     using fs::path;
     const path p; ((void)p);
@@ -47,12 +44,12 @@ TEST_CASE(signature_test)
     ASSERT_NOT_NOEXCEPT(proximate(p, p, ec));
 }
 
-TEST_CASE(basic_test) {
+static void basic_test() {
   using fs::path;
   const path cwd = fs::current_path();
   const path parent_cwd = cwd.parent_path();
   const path curdir = cwd.filename();
-  TEST_REQUIRE(!cwd.native().empty());
+  assert(!cwd.native().empty());
   int cwd_depth = count_path_elems(cwd);
   path dot_dot_to_root;
   for (int i=0; i < cwd_depth; ++i)
@@ -141,7 +138,7 @@ TEST_CASE(basic_test) {
     fs::path expect = TC.expect;
     expect.make_preferred();
     if (ec) {
-      TEST_CHECK(!ec);
+      assert(!ec);
       std::fprintf(stderr, "TEST CASE #%d FAILED:\n"
                   "  Input: '%s'\n"
                   "  Base: '%s'\n"
@@ -149,7 +146,7 @@ TEST_CASE(basic_test) {
         ID, TC.input.string().c_str(), TC.base.string().c_str(),
         expect.string().c_str());
     } else if (!PathEq(output, expect)) {
-      TEST_CHECK(PathEq(output, expect));
+      assert(PathEq(output, expect));
 
       const path canon_input = fs::weakly_canonical(TC.input);
       const path canon_base = fs::weakly_canonical(TC.base);
@@ -170,4 +167,9 @@ TEST_CASE(basic_test) {
   }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  signature_test();
+  basic_test();
+
+  return 0;
+}
index ae94253..fa0bf95 100644 (file)
 #include "filesystem_include.h"
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_read_symlink_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -35,7 +32,7 @@ TEST_CASE(test_signatures)
     ASSERT_NOT_NOEXCEPT(fs::read_symlink(p, ec));
 }
 
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     auto checkThrow = [](path const& f, const std::error_code& ec)
     {
@@ -63,14 +60,14 @@ TEST_CASE(test_error_reporting)
     for (path const& p : cases) {
         std::error_code ec;
         const path ret = fs::read_symlink(p, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(ret == path{});
-        TEST_CHECK(checkThrow(p, ec));
+        assert(ec);
+        assert(ret == path{});
+        assert(checkThrow(p, ec));
     }
 
 }
 
-TEST_CASE(basic_symlink_test)
+static void basic_symlink_test()
 {
     scoped_test_env env;
     const path dne = env.make_env_path("dne");
@@ -91,9 +88,15 @@ TEST_CASE(basic_symlink_test)
     for (auto& TC : testCases) {
         std::error_code ec = std::make_error_code(std::errc::address_in_use);
         const path ret = read_symlink(TC.symlink, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(ret == TC.expected);
+        assert(!ec);
+        assert(ret == TC.expected);
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_signatures();
+    test_error_reporting();
+    basic_symlink_test();
+
+    return 0;
+}
index 0c05605..820162f 100644 (file)
 #include "test_macros.h"
 #include "test_iterators.h"
 #include "count_new.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 
-TEST_SUITE(filesystem_proximate_path_test_suite)
-
-TEST_CASE(test_signature_0) {
+static void test_signature_0() {
   fs::path p("");
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(fs::current_path()));
+  assert(output == fs::path::string_type(fs::current_path()));
 }
 
-TEST_CASE(test_signature_1) {
+static void test_signature_1() {
   fs::path p(".");
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(fs::current_path()));
+  assert(output == fs::path::string_type(fs::current_path()));
 }
 
-TEST_CASE(test_signature_2) {
+static void test_signature_2() {
   static_test_env static_env;
   fs::path p(static_env.File);
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(static_env.File));
+  assert(output == fs::path::string_type(static_env.File));
 }
 
-TEST_CASE(test_signature_3) {
+static void test_signature_3() {
   static_test_env static_env;
   fs::path p(static_env.Dir);
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir));
+  assert(output == fs::path::string_type(static_env.Dir));
 }
 
-TEST_CASE(test_signature_4) {
+static void test_signature_4() {
   static_test_env static_env;
   fs::path p(static_env.SymlinkToDir);
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir));
+  assert(output == fs::path::string_type(static_env.Dir));
 }
 
-TEST_CASE(test_signature_5) {
+static void test_signature_5() {
   static_test_env static_env;
   fs::path p(static_env.SymlinkToDir / "dir2/.");
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir / "dir2"));
+  assert(output == fs::path::string_type(static_env.Dir / "dir2"));
 }
 
-TEST_CASE(test_signature_6) {
+static void test_signature_6() {
   static_test_env static_env;
   // FIXME? If the trailing separator occurs in a part of the path that exists,
   // it is omitted. Otherwise it is added to the end of the result.
   fs::path p(static_env.SymlinkToDir / "dir2/./");
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir / "dir2"));
+  assert(output == fs::path::string_type(static_env.Dir / "dir2"));
 }
 
-TEST_CASE(test_signature_7) {
+static void test_signature_7() {
   static_test_env static_env;
   fs::path p(static_env.SymlinkToDir / "dir2/DNE/./");
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir / "dir2/DNE/"));
+  assert(output == fs::path::string_type(static_env.Dir / "dir2/DNE/"));
 }
 
-TEST_CASE(test_signature_8) {
+static void test_signature_8() {
   static_test_env static_env;
   fs::path p(static_env.SymlinkToDir / "dir2");
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir2));
+  assert(output == fs::path::string_type(static_env.Dir2));
 }
 
-TEST_CASE(test_signature_9) {
+static void test_signature_9() {
   static_test_env static_env;
   fs::path p(static_env.SymlinkToDir / "dir2/../dir2/DNE/..");
   const fs::path output = fs::weakly_canonical(p);
@@ -102,38 +99,55 @@ TEST_CASE(test_signature_9) {
   // to exist, on posix it's considered to not exist. Therefore, the
   // result here differs in the trailing slash.
 #ifdef _WIN32
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir2));
+  assert(output == fs::path::string_type(static_env.Dir2));
 #else
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir2 / ""));
+  assert(output == fs::path::string_type(static_env.Dir2 / ""));
 #endif
 }
 
-TEST_CASE(test_signature_10) {
+static void test_signature_10() {
   static_test_env static_env;
   fs::path p(static_env.SymlinkToDir / "dir2/dir3/../DNE/DNE2");
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir2 / "DNE/DNE2"));
+  assert(output == fs::path::string_type(static_env.Dir2 / "DNE/DNE2"));
 }
 
-TEST_CASE(test_signature_11) {
+static void test_signature_11() {
   static_test_env static_env;
   fs::path p(static_env.Dir / "../dir1");
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir));
+  assert(output == fs::path::string_type(static_env.Dir));
 }
 
-TEST_CASE(test_signature_12) {
+static void test_signature_12() {
   static_test_env static_env;
   fs::path p(static_env.Dir / "./.");
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir));
+  assert(output == fs::path::string_type(static_env.Dir));
 }
 
-TEST_CASE(test_signature_13) {
+static void test_signature_13() {
   static_test_env static_env;
   fs::path p(static_env.Dir / "DNE/../foo");
   const fs::path output = fs::weakly_canonical(p);
-  TEST_CHECK(output == fs::path::string_type(static_env.Dir / "foo"));
+  assert(output == fs::path::string_type(static_env.Dir / "foo"));
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+  test_signature_0();
+  test_signature_1();
+  test_signature_2();
+  test_signature_3();
+  test_signature_4();
+  test_signature_5();
+  test_signature_6();
+  test_signature_7();
+  test_signature_8();
+  test_signature_9();
+  test_signature_10();
+  test_signature_11();
+  test_signature_12();
+  test_signature_13();
+
+  return 0;
+}
index 950ed73..f82a583 100644 (file)
 #include "filesystem_include.h"
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_remove_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -34,7 +31,7 @@ TEST_CASE(test_signatures)
     ASSERT_NOEXCEPT(fs::remove(p, ec));
 }
 
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     auto checkThrow = [](path const& f, const std::error_code& ec)
     {
@@ -71,9 +68,9 @@ TEST_CASE(test_error_reporting)
     for (auto& p : testCases) {
         std::error_code ec;
 
-        TEST_CHECK(!fs::remove(p, ec));
-        TEST_CHECK(ec);
-        TEST_CHECK(checkThrow(p, ec));
+        assert(!fs::remove(p, ec));
+        assert(ec);
+        assert(checkThrow(p, ec));
     }
 
     // PR#35780
@@ -85,12 +82,12 @@ TEST_CASE(test_error_reporting)
     for (auto& p : testCasesNonexistant) {
         std::error_code ec;
 
-        TEST_CHECK(!fs::remove(p, ec));
-        TEST_CHECK(!ec);
+        assert(!fs::remove(p, ec));
+        assert(!ec);
     }
 }
 
-TEST_CASE(basic_remove_test)
+static void basic_remove_test()
 {
     scoped_test_env env;
     const path dne = env.make_env_path("dne");
@@ -105,10 +102,15 @@ TEST_CASE(basic_remove_test)
     };
     for (auto& p : testCases) {
         std::error_code ec = std::make_error_code(std::errc::address_in_use);
-        TEST_CHECK(remove(p, ec));
-        TEST_CHECK(!ec);
-        TEST_CHECK(!exists(symlink_status(p)));
+        assert(remove(p, ec));
+        assert(!ec);
+        assert(!exists(symlink_status(p)));
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_signatures();
+    test_error_reporting();
+    basic_remove_test();
+    return 0;
+}
index 7ac9ddc..a6842b2 100644 (file)
 #include "filesystem_include.h"
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_remove_all_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -36,7 +33,7 @@ TEST_CASE(test_signatures)
     ASSERT_NOT_NOEXCEPT(fs::remove_all(p, ec));
 }
 
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     scoped_test_env env;
     // Windows doesn't support setting perms::none to trigger failures
@@ -73,9 +70,9 @@ TEST_CASE(test_error_reporting)
     for (auto& p : testCases) {
         std::error_code ec;
 
-        TEST_CHECK(fs::remove_all(p, ec) == BadRet);
-        TEST_CHECK(ec);
-        TEST_CHECK(checkThrow(p, ec));
+        assert(fs::remove_all(p, ec) == BadRet);
+        assert(ec);
+        assert(checkThrow(p, ec));
     }
 #endif
 
@@ -87,12 +84,12 @@ TEST_CASE(test_error_reporting)
     for (auto &p : testCasesNonexistant) {
         std::error_code ec;
 
-        TEST_CHECK(fs::remove_all(p, ec) == 0);
-        TEST_CHECK(!ec);
+        assert(fs::remove_all(p, ec) == 0);
+        assert(!ec);
     }
 }
 
-TEST_CASE(basic_remove_all_test)
+static void basic_remove_all_test()
 {
     scoped_test_env env;
     const path dne = env.make_env_path("dne");
@@ -107,13 +104,13 @@ TEST_CASE(basic_remove_all_test)
     };
     for (auto& p : testCases) {
         std::error_code ec = std::make_error_code(std::errc::address_in_use);
-        TEST_CHECK(remove(p, ec));
-        TEST_CHECK(!ec);
-        TEST_CHECK(!exists(symlink_status(p)));
+        assert(remove(p, ec));
+        assert(!ec);
+        assert(!exists(symlink_status(p)));
     }
 }
 
-TEST_CASE(symlink_to_dir)
+static void symlink_to_dir()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir");
@@ -122,16 +119,16 @@ TEST_CASE(symlink_to_dir)
 
     {
         std::error_code ec = std::make_error_code(std::errc::address_in_use);
-        TEST_CHECK(remove_all(link, ec) == 1);
-        TEST_CHECK(!ec);
-        TEST_CHECK(!exists(symlink_status(link)));
-        TEST_CHECK(exists(dir));
-        TEST_CHECK(exists(file));
+        assert(remove_all(link, ec) == 1);
+        assert(!ec);
+        assert(!exists(symlink_status(link)));
+        assert(exists(dir));
+        assert(exists(file));
     }
 }
 
 
-TEST_CASE(nested_dir)
+static void nested_dir()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir");
@@ -147,12 +144,20 @@ TEST_CASE(nested_dir)
     const std::size_t expected_count = sizeof(all_files) / sizeof(all_files[0]);
 
     std::error_code ec = std::make_error_code(std::errc::address_in_use);
-    TEST_CHECK(remove_all(dir, ec) == expected_count);
-    TEST_CHECK(!ec);
+    assert(remove_all(dir, ec) == expected_count);
+    assert(!ec);
     for (auto const& p : all_files) {
-        TEST_CHECK(!exists(symlink_status(p)));
+        assert(!exists(symlink_status(p)));
     }
-    TEST_CHECK(exists(out_of_dir_file));
+    assert(exists(out_of_dir_file));
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_signatures();
+    test_error_reporting();
+    basic_remove_all_test();
+    symlink_to_dir();
+    nested_dir();
+
+    return 0;
+}
index c651bf1..b1ac260 100644 (file)
 #include "filesystem_include.h"
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_rename_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -34,7 +31,7 @@ TEST_CASE(test_signatures)
     ASSERT_NOEXCEPT(fs::rename(p, p, ec));
 }
 
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     auto checkThrow = [](path const& f, path const& t, const std::error_code& ec)
     {
@@ -75,14 +72,14 @@ TEST_CASE(test_error_reporting)
         auto to_before = status(TC.to);
         std::error_code ec;
         rename(TC.from, TC.to, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(from_before.type() == status(TC.from).type());
-        TEST_CHECK(to_before.type() == status(TC.to).type());
-        TEST_CHECK(checkThrow(TC.from, TC.to, ec));
+        assert(ec);
+        assert(from_before.type() == status(TC.from).type());
+        assert(to_before.type() == status(TC.to).type());
+        assert(checkThrow(TC.from, TC.to, ec));
     }
 }
 
-TEST_CASE(basic_rename_test)
+static void basic_rename_test()
 {
     scoped_test_env env;
 
@@ -91,28 +88,28 @@ TEST_CASE(basic_rename_test)
     { // same file
         std::error_code ec = set_ec;
         rename(file, file, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(is_regular_file(file));
-        TEST_CHECK(file_size(file) == 42);
+        assert(!ec);
+        assert(is_regular_file(file));
+        assert(file_size(file) == 42);
     }
     const path sym = env.create_symlink(file, "sym");
     { // file -> symlink
         std::error_code ec = set_ec;
         rename(file, sym, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(!exists(file));
-        TEST_CHECK(is_regular_file(symlink_status(sym)));
-        TEST_CHECK(file_size(sym) == 42);
+        assert(!ec);
+        assert(!exists(file));
+        assert(is_regular_file(symlink_status(sym)));
+        assert(file_size(sym) == 42);
     }
     const path file2 = env.create_file("file2", 42);
     const path file3 = env.create_file("file3", 100);
     { // file -> file
         std::error_code ec = set_ec;
         rename(file2, file3, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(!exists(file2));
-        TEST_CHECK(is_regular_file(file3));
-        TEST_CHECK(file_size(file3) == 42);
+        assert(!ec);
+        assert(!exists(file2));
+        assert(is_regular_file(file3));
+        assert(file_size(file3) == 42);
     }
     const path dne = env.make_env_path("dne");
     const path bad_sym = env.create_symlink(dne, "bad_sym");
@@ -120,14 +117,14 @@ TEST_CASE(basic_rename_test)
     { // bad-symlink
         std::error_code ec = set_ec;
         rename(bad_sym, bad_sym_dest, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(!exists(symlink_status(bad_sym)));
-        TEST_CHECK(is_symlink(bad_sym_dest));
-        TEST_CHECK(read_symlink(bad_sym_dest) == dne);
+        assert(!ec);
+        assert(!exists(symlink_status(bad_sym)));
+        assert(is_symlink(bad_sym_dest));
+        assert(read_symlink(bad_sym_dest) == dne);
     }
 }
 
-TEST_CASE(basic_rename_dir_test)
+static void basic_rename_dir_test()
 {
     static_test_env env;
     const std::error_code set_ec = std::make_error_code(std::errc::address_in_use);
@@ -135,10 +132,10 @@ TEST_CASE(basic_rename_dir_test)
     { // dir -> dir (with contents)
         std::error_code ec = set_ec;
         rename(env.Dir, new_dir, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(!exists(env.Dir));
-        TEST_CHECK(is_directory(new_dir));
-        TEST_CHECK(exists(new_dir / "file1"));
+        assert(!ec);
+        assert(!exists(env.Dir));
+        assert(is_directory(new_dir));
+        assert(exists(new_dir / "file1"));
     }
 #ifdef _WIN32
     // On Windows, renaming a directory over a file isn't an error (this
@@ -146,12 +143,19 @@ TEST_CASE(basic_rename_dir_test)
     { // dir -> file
         std::error_code ec = set_ec;
         rename(new_dir, env.NonEmptyFile, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(!exists(new_dir));
-        TEST_CHECK(is_directory(env.NonEmptyFile));
-        TEST_CHECK(exists(env.NonEmptyFile / "file1"));
+        assert(!ec);
+        assert(!exists(new_dir));
+        assert(is_directory(env.NonEmptyFile));
+        assert(exists(env.NonEmptyFile / "file1"));
     }
 #endif
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_signatures();
+    test_error_reporting();
+    basic_rename_test();
+    basic_rename_dir_test();
+
+    return 0;
+}
index 5045617..0b03bb8 100644 (file)
 #include "filesystem_include.h"
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_resize_file_test_suite)
-
-TEST_CASE(test_signatures)
+static void test_signatures()
 {
     const path p; ((void)p);
     std::uintmax_t i; ((void)i);
@@ -36,7 +33,7 @@ TEST_CASE(test_signatures)
     ASSERT_NOEXCEPT(fs::resize_file(p, i, ec));
 }
 
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     auto checkThrow = [](path const& f, std::uintmax_t s, const std::error_code& ec)
     {
@@ -64,12 +61,12 @@ TEST_CASE(test_error_reporting)
     for (auto& p : cases) {
         std::error_code ec;
         resize_file(p, 42, ec);
-        TEST_REQUIRE(ec);
-        TEST_CHECK(checkThrow(p, 42, ec));
+        assert(ec);
+        assert(checkThrow(p, 42, ec));
     }
 }
 
-TEST_CASE(basic_resize_file_test)
+static void basic_resize_file_test()
 {
     scoped_test_env env;
     const path file1 = env.create_file("file1", 42);
@@ -78,31 +75,36 @@ TEST_CASE(basic_resize_file_test)
         const std::uintmax_t new_s = 100;
         std::error_code ec = set_ec;
         resize_file(file1, new_s, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(file_size(file1) == new_s);
+        assert(!ec);
+        assert(file_size(file1) == new_s);
     }
     { // shrink file
         const std::uintmax_t new_s = 1;
         std::error_code ec = set_ec;
         resize_file(file1, new_s, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(file_size(file1) == new_s);
+        assert(!ec);
+        assert(file_size(file1) == new_s);
     }
     { // shrink file to zero
         const std::uintmax_t new_s = 0;
         std::error_code ec = set_ec;
         resize_file(file1, new_s, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(file_size(file1) == new_s);
+        assert(!ec);
+        assert(file_size(file1) == new_s);
     }
     const path sym = env.create_symlink(file1, "sym");
     { // grow file via symlink
         const std::uintmax_t new_s = 1024;
         std::error_code ec = set_ec;
         resize_file(sym, new_s, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(file_size(file1) == new_s);
+        assert(!ec);
+        assert(file_size(file1) == new_s);
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    test_signatures();
+    test_error_reporting();
+    basic_resize_file_test();
+    return 0;
+}
index c031796..7659cde 100644 (file)
@@ -16,7 +16,6 @@
 #include "filesystem_include.h"
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
@@ -29,9 +28,7 @@ bool EqualDelta(std::uintmax_t x, std::uintmax_t y, std::uintmax_t delta) {
     }
 }
 
-TEST_SUITE(filesystem_space_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -41,7 +38,7 @@ TEST_CASE(signature_test)
     ASSERT_NOEXCEPT(space(p, ec));
 }
 
-TEST_CASE(test_error_reporting)
+static void test_error_reporting()
 {
     static_test_env static_env;
     auto checkThrow = [](path const& f, const std::error_code& ec)
@@ -69,15 +66,15 @@ TEST_CASE(test_error_reporting)
         const auto expect = static_cast<std::uintmax_t>(-1);
         std::error_code ec;
         space_info info = space(p, ec);
-        TEST_CHECK(ec);
-        TEST_CHECK(info.capacity == expect);
-        TEST_CHECK(info.free == expect);
-        TEST_CHECK(info.available == expect);
-        TEST_CHECK(checkThrow(p, ec));
+        assert(ec);
+        assert(info.capacity == expect);
+        assert(info.free == expect);
+        assert(info.available == expect);
+        assert(checkThrow(p, ec));
     }
 }
 
-TEST_CASE(basic_space_test)
+static void basic_space_test()
 {
     static_test_env static_env;
 
@@ -88,7 +85,7 @@ TEST_CASE(basic_space_test)
     std::uintmax_t expect_capacity;
     std::uintmax_t expect_free;
     std::uintmax_t expect_avail;
-    TEST_REQUIRE(utils::space(static_env.Dir.string(), expect_capacity,
+    assert(utils::space(static_env.Dir.string(), expect_capacity,
                               expect_free, expect_avail));
 
     // Other processes running on the operating system may have changed
@@ -105,14 +102,20 @@ TEST_CASE(basic_space_test)
     for (auto& p : cases) {
         std::error_code ec = GetTestEC();
         space_info info = space(p, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(info.capacity != bad_value);
-        TEST_CHECK(expect_capacity == info.capacity);
-        TEST_CHECK(info.free != bad_value);
-        TEST_CHECK(EqualDelta(expect_free, info.free, delta));
-        TEST_CHECK(info.available != bad_value);
-        TEST_CHECK(EqualDelta(expect_avail, info.available, delta));
+        assert(!ec);
+        assert(info.capacity != bad_value);
+        assert(expect_capacity == info.capacity);
+        assert(info.free != bad_value);
+        assert(EqualDelta(expect_free, info.free, delta));
+        assert(info.available != bad_value);
+        assert(EqualDelta(expect_avail, info.available, delta));
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    test_error_reporting();
+    basic_space_test();
+
+    return 0;
+}
index 3fa9f58..17abaf7 100644 (file)
 
 #include "filesystem_include.h"
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_status_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -31,7 +29,7 @@ TEST_CASE(signature_test)
     ASSERT_NOEXCEPT(status(p, ec));
 }
 
-TEST_CASE(test_status_not_found)
+static void test_status_not_found()
 {
     static_test_env static_env;
     const std::errc expect_errc = std::errc::no_such_file_or_directory;
@@ -43,14 +41,14 @@ TEST_CASE(test_status_not_found)
         std::error_code ec = std::make_error_code(std::errc::address_in_use);
         // test non-throwing overload.
         file_status st = status(p, ec);
-        TEST_CHECK(ErrorIs(ec, expect_errc));
-        TEST_CHECK(st.type() == file_type::not_found);
-        TEST_CHECK(st.permissions() == perms::unknown);
+        assert(ErrorIs(ec, expect_errc));
+        assert(st.type() == file_type::not_found);
+        assert(st.permissions() == perms::unknown);
         // test throwing overload. It should not throw even though it reports
         // that the file was not found.
-        TEST_CHECK_NO_THROW(st = status(p));
-        TEST_CHECK(st.type() == file_type::not_found);
-        TEST_CHECK(st.permissions() == perms::unknown);
+        TEST_DOES_NOT_THROW(st = status(p));
+        assert(st.type() == file_type::not_found);
+        assert(st.permissions() == perms::unknown);
     }
 }
 
@@ -60,7 +58,7 @@ TEST_CASE(test_status_not_found)
 // for. Finally, status() for a too long file name doesn't return errors
 // on windows.
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
-TEST_CASE(test_status_cannot_resolve)
+static void test_status_cannot_resolve()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir");
@@ -85,26 +83,26 @@ TEST_CASE(test_status_cannot_resolve)
         { // test non-throwing case
             std::error_code ec = std::make_error_code(set_errc);
             file_status st = status(TC.p, ec);
-            TEST_CHECK(ErrorIs(ec, TC.expect_errc));
-            TEST_CHECK(st.type() == file_type::none);
-            TEST_CHECK(st.permissions() == perms::unknown);
+            assert(ErrorIs(ec, TC.expect_errc));
+            assert(st.type() == file_type::none);
+            assert(st.permissions() == perms::unknown);
         }
 #ifndef TEST_HAS_NO_EXCEPTIONS
         { // test throwing case
             try {
                 status(TC.p);
             } catch (filesystem_error const& err) {
-                TEST_CHECK(err.path1() == TC.p);
-                TEST_CHECK(err.path2() == "");
-                TEST_CHECK(ErrorIs(err.code(), TC.expect_errc));
+                assert(err.path1() == TC.p);
+                assert(err.path2() == "");
+                assert(ErrorIs(err.code(), TC.expect_errc));
             }
         }
 #endif
     }
 }
-#endif
+#endif // TEST_WIN_NO_FILESYSTEM_PERMS_NONE
 
-TEST_CASE(status_file_types_test)
+static void status_file_types_test()
 {
     static_test_env static_env;
     scoped_test_env env;
@@ -131,17 +129,17 @@ TEST_CASE(status_file_types_test)
         // test non-throwing case
         std::error_code ec = std::make_error_code(std::errc::address_in_use);
         file_status st = status(TC.p, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(st.type() == TC.expect_type);
-        TEST_CHECK(st.permissions() != perms::unknown);
+        assert(!ec);
+        assert(st.type() == TC.expect_type);
+        assert(st.permissions() != perms::unknown);
         // test throwing case
-        TEST_REQUIRE_NO_THROW(st = status(TC.p));
-        TEST_CHECK(st.type() == TC.expect_type);
-        TEST_CHECK(st.permissions() != perms::unknown);
+        TEST_DOES_NOT_THROW(st = status(TC.p));
+        assert(st.type() == TC.expect_type);
+        assert(st.permissions() != perms::unknown);
     }
 }
 
-TEST_CASE(test_block_file)
+static void test_block_file()
 {
     const path possible_paths[] = {
         "/dev/drive0", // Apple
@@ -157,18 +155,29 @@ TEST_CASE(test_block_file)
         }
     }
     if (p == path{}) {
-        TEST_UNSUPPORTED();
+        // No possible path found.
+        return;
     }
     // test non-throwing case
     std::error_code ec = std::make_error_code(std::errc::address_in_use);
     file_status st = status(p, ec);
-    TEST_CHECK(!ec);
-    TEST_CHECK(st.type() == file_type::block);
-    TEST_CHECK(st.permissions() != perms::unknown);
+    assert(!ec);
+    assert(st.type() == file_type::block);
+    assert(st.permissions() != perms::unknown);
     // test throwing case
-    TEST_REQUIRE_NO_THROW(st = status(p));
-    TEST_CHECK(st.type() == file_type::block);
-    TEST_CHECK(st.permissions() != perms::unknown);
+    TEST_DOES_NOT_THROW(st = status(p));
+    assert(st.type() == file_type::block);
+    assert(st.permissions() != perms::unknown);
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    test_status_not_found();
+#ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+    test_status_cannot_resolve();
+#endif
+    status_file_types_test();
+    test_block_file();
+
+    return 0;
+}
index e3763bb..1394c08 100644 (file)
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(status_known_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     file_status s; ((void)s);
     ASSERT_SAME_TYPE(decltype(status_known(s)), bool);
     ASSERT_NOEXCEPT(status_known(s));
 }
 
-TEST_CASE(status_known_test)
+static void status_known_test()
 {
     struct TestCase {
         file_type type;
@@ -51,8 +48,13 @@ TEST_CASE(status_known_test)
     };
     for (auto& TC : testCases) {
         file_status s(TC.type);
-        TEST_CHECK(status_known(s) == TC.expect);
+        assert(status_known(s) == TC.expect);
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    status_known_test();
+
+    return 0;
+}
index a1d8ba6..3ab50c3 100644 (file)
 
 #include "filesystem_include.h"
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
 
-TEST_SUITE(filesystem_symlink_status_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     const path p; ((void)p);
     std::error_code ec; ((void)ec);
@@ -31,7 +29,7 @@ TEST_CASE(signature_test)
     ASSERT_NOEXCEPT(symlink_status(p, ec));
 }
 
-TEST_CASE(test_symlink_status_not_found)
+static void test_symlink_status_not_found()
 {
     static_test_env static_env;
     const std::errc expect_errc = std::errc::no_such_file_or_directory;
@@ -42,14 +40,14 @@ TEST_CASE(test_symlink_status_not_found)
         std::error_code ec = std::make_error_code(std::errc::address_in_use);
         // test non-throwing overload.
         file_status st = symlink_status(p, ec);
-        TEST_CHECK(ErrorIs(ec, expect_errc));
-        TEST_CHECK(st.type() == file_type::not_found);
-        TEST_CHECK(st.permissions() == perms::unknown);
+        assert(ErrorIs(ec, expect_errc));
+        assert(st.type() == file_type::not_found);
+        assert(st.permissions() == perms::unknown);
         // test throwing overload. It should not throw even though it reports
         // that the file was not found.
-        TEST_CHECK_NO_THROW(st = status(p));
-        TEST_CHECK(st.type() == file_type::not_found);
-        TEST_CHECK(st.permissions() == perms::unknown);
+        TEST_DOES_NOT_THROW(st = status(p));
+        assert(st.type() == file_type::not_found);
+        assert(st.permissions() == perms::unknown);
     }
 }
 
@@ -59,7 +57,7 @@ TEST_CASE(test_symlink_status_not_found)
 // for. Finally, status() for a too long file name doesn't return errors
 // on windows.
 #ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
-TEST_CASE(test_symlink_status_cannot_resolve)
+static void test_symlink_status_cannot_resolve()
 {
     scoped_test_env env;
     const path dir = env.create_dir("dir");
@@ -79,18 +77,18 @@ TEST_CASE(test_symlink_status_cannot_resolve)
         { // test non-throwing case
             std::error_code ec = std::make_error_code(set_errc);
             file_status st = symlink_status(p, ec);
-            TEST_CHECK(ErrorIs(ec, expect_errc));
-            TEST_CHECK(st.type() == file_type::none);
-            TEST_CHECK(st.permissions() == perms::unknown);
+            assert(ErrorIs(ec, expect_errc));
+            assert(st.type() == file_type::none);
+            assert(st.permissions() == perms::unknown);
         }
 #ifndef TEST_HAS_NO_EXCEPTIONS
         { // test throwing case
             try {
                 (void)symlink_status(p);
             } catch (filesystem_error const& err) {
-                TEST_CHECK(err.path1() == p);
-                TEST_CHECK(err.path2() == "");
-                TEST_CHECK(ErrorIs(err.code(), expect_errc));
+                assert(err.path1() == p);
+                assert(err.path2() == "");
+                assert(ErrorIs(err.code(), expect_errc));
             }
         }
 #endif
@@ -100,19 +98,19 @@ TEST_CASE(test_symlink_status_cannot_resolve)
     {
         std::error_code ec = std::make_error_code(set_errc);
         file_status st = symlink_status(sym_points_in_dir, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(st.type() == file_type::symlink);
-        TEST_CHECK(st.permissions() != perms::unknown);
+        assert(!ec);
+        assert(st.type() == file_type::symlink);
+        assert(st.permissions() != perms::unknown);
         // test non-throwing version
-        TEST_REQUIRE_NO_THROW(st = symlink_status(sym_points_in_dir));
-        TEST_CHECK(st.type() == file_type::symlink);
-        TEST_CHECK(st.permissions() != perms::unknown);
+        TEST_DOES_NOT_THROW(st = symlink_status(sym_points_in_dir));
+        assert(st.type() == file_type::symlink);
+        assert(st.permissions() != perms::unknown);
     }
 }
-#endif
+#endif // TEST_WIN_NO_FILESYSTEM_PERMS_NONE
 
 
-TEST_CASE(symlink_status_file_types_test)
+static void symlink_status_file_types_test()
 {
     static_test_env static_env;
     scoped_test_env env;
@@ -140,17 +138,17 @@ TEST_CASE(symlink_status_file_types_test)
         // test non-throwing case
         std::error_code ec = std::make_error_code(std::errc::address_in_use);
         file_status st = symlink_status(TC.p, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(st.type() == TC.expect_type);
-        TEST_CHECK(st.permissions() != perms::unknown);
+        assert(!ec);
+        assert(st.type() == TC.expect_type);
+        assert(st.permissions() != perms::unknown);
         // test throwing case
-        TEST_REQUIRE_NO_THROW(st = symlink_status(TC.p));
-        TEST_CHECK(st.type() == TC.expect_type);
-        TEST_CHECK(st.permissions() != perms::unknown);
+        TEST_DOES_NOT_THROW(st = symlink_status(TC.p));
+        assert(st.type() == TC.expect_type);
+        assert(st.permissions() != perms::unknown);
     }
 }
 
-TEST_CASE(test_block_file)
+static void test_block_file()
 {
     const path possible_paths[] = {
         "/dev/drive0", // Apple
@@ -167,20 +165,21 @@ TEST_CASE(test_block_file)
         }
     }
     if (p == path{}) {
-        TEST_UNSUPPORTED();
+        // No possible path found.
+        return;
     }
     scoped_test_env env;
     { // test block file
         // test non-throwing case
         std::error_code ec = std::make_error_code(std::errc::address_in_use);
         file_status st = symlink_status(p, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(st.type() == file_type::block);
-        TEST_CHECK(st.permissions() != perms::unknown);
+        assert(!ec);
+        assert(st.type() == file_type::block);
+        assert(st.permissions() != perms::unknown);
         // test throwing case
-        TEST_REQUIRE_NO_THROW(st = symlink_status(p));
-        TEST_CHECK(st.type() == file_type::block);
-        TEST_CHECK(st.permissions() != perms::unknown);
+        TEST_DOES_NOT_THROW(st = symlink_status(p));
+        assert(st.type() == file_type::block);
+        assert(st.permissions() != perms::unknown);
     }
     const path sym = env.make_env_path("sym");
     create_symlink(p, sym);
@@ -188,14 +187,23 @@ TEST_CASE(test_block_file)
         // test non-throwing case
         std::error_code ec = std::make_error_code(std::errc::address_in_use);
         file_status st = symlink_status(sym, ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(st.type() == file_type::symlink);
-        TEST_CHECK(st.permissions() != perms::unknown);
+        assert(!ec);
+        assert(st.type() == file_type::symlink);
+        assert(st.permissions() != perms::unknown);
         // test throwing case
-        TEST_REQUIRE_NO_THROW(st = symlink_status(sym));
-        TEST_CHECK(st.type() == file_type::symlink);
-        TEST_CHECK(st.permissions() != perms::unknown);
+        TEST_DOES_NOT_THROW(st = symlink_status(sym));
+        assert(st.type() == file_type::symlink);
+        assert(st.permissions() != perms::unknown);
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    test_symlink_status_not_found();
+#ifndef TEST_WIN_NO_FILESYSTEM_PERMS_NONE
+    test_symlink_status_cannot_resolve();
+#endif
+    symlink_status_file_types_test();
+    test_block_file();
+    return 0;
+}
index 0b5018d..4bc4099 100644 (file)
@@ -20,7 +20,6 @@
 #include <cassert>
 
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "filesystem_test_helper.h"
 
 using namespace fs;
@@ -33,16 +32,14 @@ void UnsetEnv(std::string var) {
     assert(utils::unsetenv(var.c_str()) == 0);
 }
 
-TEST_SUITE(filesystem_temp_directory_path_test_suite)
-
-TEST_CASE(signature_test)
+static void signature_test()
 {
     std::error_code ec; ((void)ec);
     ASSERT_NOT_NOEXCEPT(temp_directory_path());
     ASSERT_NOT_NOEXCEPT(temp_directory_path(ec));
 }
 
-TEST_CASE(basic_tests)
+static void basic_tests()
 {
     scoped_test_env env;
     const path dne = env.make_env_path("dne");
@@ -87,45 +84,45 @@ TEST_CASE(basic_tests)
     for (auto& TC : cases) {
         std::error_code ec = GetTestEC();
         path ret = temp_directory_path(ec);
-        TEST_CHECK(!ec);
-        TEST_CHECK(ret == TC.p);
-        TEST_CHECK(is_directory(ret));
+        assert(!ec);
+        assert(ret == TC.p);
+        assert(is_directory(ret));
 
         // Set the env variable to a path that does not exist and check
         // that it fails.
         PutEnv(TC.name, dne);
         ec = GetTestEC();
         ret = temp_directory_path(ec);
-        LIBCPP_ONLY(TEST_CHECK(ErrorIs(ec, expect_errc)));
-        TEST_CHECK(ec != GetTestEC());
-        TEST_CHECK(ec);
-        TEST_CHECK(ret == "");
+        LIBCPP_ONLY(assert(ErrorIs(ec, expect_errc)));
+        assert(ec != GetTestEC());
+        assert(ec);
+        assert(ret == "");
 
         // Set the env variable to point to a file and check that it fails.
         PutEnv(TC.name, file);
         ec = GetTestEC();
         ret = temp_directory_path(ec);
-        LIBCPP_ONLY(TEST_CHECK(ErrorIs(ec, expect_errc)));
-        TEST_CHECK(ec != GetTestEC());
-        TEST_CHECK(ec);
-        TEST_CHECK(ret == "");
+        LIBCPP_ONLY(assert(ErrorIs(ec, expect_errc)));
+        assert(ec != GetTestEC());
+        assert(ec);
+        assert(ret == "");
 
         if (!inaccessible_dir.empty()) {
             // Set the env variable to point to a dir we can't access
             PutEnv(TC.name, inaccessible_dir);
             ec = GetTestEC();
             ret = temp_directory_path(ec);
-            TEST_CHECK(ErrorIs(ec, std::errc::permission_denied));
-            TEST_CHECK(ret == "");
+            assert(ErrorIs(ec, std::errc::permission_denied));
+            assert(ret == "");
         }
 
         // Set the env variable to point to a non-existent dir
         PutEnv(TC.name, TC.p / "does_not_exist");
         ec = GetTestEC();
         ret = temp_directory_path(ec);
-        TEST_CHECK(ec != GetTestEC());
-        TEST_CHECK(ec);
-        TEST_CHECK(ret == "");
+        assert(ec != GetTestEC());
+        assert(ec);
+        assert(ret == "");
 
         // Finally erase this env variable
         UnsetEnv(TC.name);
@@ -135,12 +132,12 @@ TEST_CASE(basic_tests)
     {
         std::error_code ec = GetTestEC();
         path ret = temp_directory_path(ec);
-        TEST_CHECK(!ec);
+        assert(!ec);
 #ifndef _WIN32
         // On Windows, the function falls back to the Windows folder.
-        TEST_CHECK(ret == "/tmp");
+        assert(ret == "/tmp");
 #endif
-        TEST_CHECK(is_directory(ret));
+        assert(is_directory(ret));
         fallback = ret;
     }
     for (auto& TC : ignored_cases) {
@@ -148,14 +145,18 @@ TEST_CASE(basic_tests)
         PutEnv(TC.name, TC.p);
         std::error_code ec = GetTestEC();
         path ret = temp_directory_path(ec);
-        TEST_CHECK(!ec);
+        assert(!ec);
 
         // Check that we return the same as above when no vars were defined.
-        TEST_CHECK(ret == fallback);
+        assert(ret == fallback);
 
         // Finally erase this env variable
         UnsetEnv(TC.name);
     }
 }
 
-TEST_SUITE_END()
+int main(int, char**) {
+    signature_test();
+    basic_tests();
+    return 0;
+}
index 1a2b822..eb14389 100644 (file)
@@ -41,17 +41,17 @@ void test_log(const char* condition, const char* file, int line, const F& functo
 }
 
 template <class Arg>
-[[noreturn]] void test_fail(const char* file, int line, Arg&& arg) {
-  test_log("", file, line, std::forward<Arg>(arg));
+[[noreturn]] void test_fail(const char* file, int line, const Arg& arg) {
+  test_log("", file, line, arg);
   std::abort();
 }
 
 template <class Arg>
-void test_require(bool condition, const char* condition_str, const char* file, int line, Arg&& arg) {
+void test_require(bool condition, const char* condition_str, const char* file, int line, const Arg& arg) {
   if (condition)
     return;
 
-  test_log(condition_str, file, line, std::forward<Arg>(arg));
+  test_log(condition_str, file, line, arg);
   std::abort();
 }
 
index d09b37e..98429aa 100644 (file)
@@ -21,9 +21,9 @@
 #include <system_error>
 #include <vector>
 
+#include "assert_macros.h"
 #include "make_string.h"
 #include "test_macros.h"
-#include "rapid-cxx-test.h"
 #include "format_string.h"
 
 // For creating socket files
@@ -672,9 +672,9 @@ struct ExceptionChecker {
         num_paths(2), func_name(fun_name), opt_message(opt_msg) {}
 
   void operator()(fs::filesystem_error const& Err) {
-    TEST_CHECK(ErrorIsImp(Err.code(), {expected_err}));
-    TEST_CHECK(Err.path1() == expected_path1);
-    TEST_CHECK(Err.path2() == expected_path2);
+    assert(ErrorIsImp(Err.code(), {expected_err}));
+    assert(Err.path1() == expected_path1);
+    assert(Err.path2() == expected_path2);
     LIBCPP_ONLY(check_libcxx_string(Err));
   }
 
@@ -703,11 +703,11 @@ struct ExceptionChecker {
                              transform_path(expected_path1).c_str(),
                              transform_path(expected_path2).c_str());
       default:
-        TEST_CHECK(false && "unexpected case");
+        TEST_FAIL("unexpected case");
         return "";
       }
     }();
-    TEST_CHECK(format == Err.what());
+    assert(format == Err.what());
     if (format != Err.what()) {
       fprintf(stderr,
               "filesystem_error::what() does not match expected output:\n");
diff --git a/libcxx/test/support/rapid-cxx-test.h b/libcxx/test/support/rapid-cxx-test.h
deleted file mode 100644 (file)
index 0f3dcd8..0000000
+++ /dev/null
@@ -1,866 +0,0 @@
-#ifndef RAPID_CXX_TEST_H
-#define RAPID_CXX_TEST_H
-
-# include <cstddef>
-# include <cstdlib>
-# include <cstdio>
-# include <cstring>
-# include <cassert>
-
-#include "test_macros.h"
-
-#if !defined(RAPID_CXX_TEST_NO_SYSTEM_HEADER) || !defined(__GNUC__)
-#pragma GCC system_header
-#endif
-
-# define RAPID_CXX_TEST_PP_CAT(x, y) RAPID_CXX_TEST_PP_CAT_2(x, y)
-# define RAPID_CXX_TEST_PP_CAT_2(x, y) x##y
-
-# define RAPID_CXX_TEST_PP_STR(...) RAPID_CXX_TEST_PP_STR_2(__VA_ARGS__)
-# define RAPID_CXX_TEST_PP_STR_2(...) #__VA_ARGS__
-
-# if defined(__GNUC__)
-#   define TEST_FUNC_NAME() __PRETTY_FUNCTION__
-#   define RAPID_CXX_TEST_UNUSED __attribute__((unused))
-# else
-#   define TEST_FUNC_NAME() __func__
-#   define RAPID_CXX_TEST_UNUSED
-# endif
-
-////////////////////////////////////////////////////////////////////////////////
-//                          TEST_SUITE
-////////////////////////////////////////////////////////////////////////////////
-# define TEST_SUITE(Name)                                           \
-namespace Name                                                      \
-{                                                                   \
-    inline ::rapid_cxx_test::test_suite & get_test_suite()          \
-    {                                                               \
-        static ::rapid_cxx_test::test_suite m_suite(#Name);         \
-        return m_suite;                                             \
-    }                                                               \
-                                                                    \
-    inline int unit_test_main(int, char**)                          \
-    {                                                               \
-        ::rapid_cxx_test::test_runner runner(get_test_suite());     \
-        return runner.run();                                        \
-    }                                                               \
-}                                                                   \
-int main(int argc, char **argv)                                     \
-{                                                                   \
-    return Name::unit_test_main(argc, argv);                        \
-}                                                                   \
-namespace Name                                                      \
-{ /* namespace closed in TEST_SUITE_END */
-#
-
-////////////////////////////////////////////////////////////////////////////////
-//                         TEST_SUITE_END
-////////////////////////////////////////////////////////////////////////////////
-# define TEST_SUITE_END()                                       \
-} /* namespace opened in TEST_SUITE(...) */
-#
-
-////////////////////////////////////////////////////////////////////////////////
-//                          TEST_CASE
-////////////////////////////////////////////////////////////////////////////////
-
-# if !defined(__clang__)
-#
-# define TEST_CASE(Name)                                                                                \
-    void Name();                                                                                        \
-    static void RAPID_CXX_TEST_PP_CAT(Name, _invoker)()                                                 \
-    {                                                                                                   \
-        Name();                                                                                         \
-    }                                                                                                   \
-    static ::rapid_cxx_test::registrar                                                                  \
-    RAPID_CXX_TEST_PP_CAT(rapid_cxx_test_registrar_, Name)(                                         \
-        get_test_suite()                                                                                \
-      , ::rapid_cxx_test::test_case(__FILE__, #Name, __LINE__, & RAPID_CXX_TEST_PP_CAT(Name, _invoker)) \
-      );                                                                                                \
-    void Name()
-#
-# else /* __clang__ */
-#
-# define TEST_CASE(Name)                                                                                \
-    void Name();                                                                                        \
-    static void RAPID_CXX_TEST_PP_CAT(Name, _invoker)()                                                 \
-    {                                                                                                   \
-        Name();                                                                                         \
-    }                                                                                                   \
-    _Pragma("clang diagnostic push")                                                                    \
-    _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"")                                       \
-    static ::rapid_cxx_test::registrar                                                                  \
-    RAPID_CXX_TEST_PP_CAT(rapid_cxx_test_registrar_, Name)(                                         \
-        get_test_suite()                                                                                \
-      , ::rapid_cxx_test::test_case(__FILE__, #Name, __LINE__, & RAPID_CXX_TEST_PP_CAT(Name, _invoker)) \
-      );                                                                                                \
-    _Pragma("clang diagnostic pop")                                                                     \
-    void Name()
-#
-# endif /* !defined(__clang__) */
-
-
-# define TEST_SET_CHECKPOINT() ::rapid_cxx_test::set_checkpoint(__FILE__, TEST_FUNC_NAME(), __LINE__)
-
-#define RAPID_CXX_TEST_OUTCOME()
-
-////////////////////////////////////////////////////////////////////////////////
-//                              TEST_UNSUPPORTED
-////////////////////////////////////////////////////////////////////////////////
-# define TEST_UNSUPPORTED()                                                                 \
-    do {                                                                                    \
-        TEST_SET_CHECKPOINT();                                                              \
-        ::rapid_cxx_test::test_outcome m_f(                                                 \
-          ::rapid_cxx_test::failure_type::unsupported, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-          , "", ""                                                                          \
-        );                                                                                  \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                       \
-        return;                                                                             \
-    } while (false)
-#
-
-
-////////////////////////////////////////////////////////////////////////////////
-//                            BASIC ASSERTIONS
-////////////////////////////////////////////////////////////////////////////////
-# define TEST_WARN(...)                                                                \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_WARN(" #__VA_ARGS__ ")", ""                                        \
-            );                                                                         \
-        if (not (__VA_ARGS__)) {                                                       \
-            m_f.type = ::rapid_cxx_test::failure_type::warn;                           \
-        }                                                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-    } while (false)
-#
-
-# define TEST_CHECK(...)                                                               \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_CHECK(" #__VA_ARGS__ ")", ""                                       \
-            );                                                                         \
-        if (not (__VA_ARGS__)) {                                                       \
-            m_f.type = ::rapid_cxx_test::failure_type::check;                          \
-        }                                                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-    } while (false)
-#
-
-# define TEST_REQUIRE(...)                                                             \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_REQUIRE(" #__VA_ARGS__ ")", ""                                     \
-            );                                                                         \
-        if (not (__VA_ARGS__)) {                                                       \
-            m_f.type = ::rapid_cxx_test::failure_type::require;                        \
-        }                                                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-        if (m_f.type != ::rapid_cxx_test::failure_type::none) {                        \
-            return;                                                                    \
-        }                                                                              \
-    } while (false)
-#
-
-# define TEST_ASSERT(...)                                                              \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_ASSERT(" #__VA_ARGS__ ")", ""                                      \
-            );                                                                         \
-        if (not (__VA_ARGS__)) {                                                       \
-            m_f.type = ::rapid_cxx_test::failure_type::assert;                         \
-        }                                                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-        if (m_f.type != ::rapid_cxx_test::failure_type::none) {                        \
-            std::abort();                                                              \
-        }                                                                              \
-    } while (false)
-#
-
-////////////////////////////////////////////////////////////////////////////////
-//                    TEST_CHECK_NO_THROW / TEST_CHECK_THROW
-////////////////////////////////////////////////////////////////////////////////
-#ifndef TEST_HAS_NO_EXCEPTIONS
-
-# define TEST_CHECK_NO_THROW(...)                                                      \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_CHECK_NO_THROW(" #__VA_ARGS__ ")", ""                              \
-            );                                                                         \
-        try {                                                                          \
-            (static_cast<void>(__VA_ARGS__));                                          \
-        } catch (...) {                                                                \
-            m_f.type = ::rapid_cxx_test::failure_type::check;                          \
-        }                                                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-    } while (false)
-#
-
-# define TEST_CHECK_THROW(Except, ...)                                                 \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_CHECK_THROW(" #Except "," #__VA_ARGS__ ")", ""                     \
-            );                                                                         \
-        try {                                                                          \
-            (static_cast<void>(__VA_ARGS__));                                          \
-            m_f.type = ::rapid_cxx_test::failure_type::check;                          \
-        } catch (Except const &) {}                                                    \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-    } while (false)
-#
-
-#define TEST_CHECK_THROW_RESULT(Except, Checker, ...)                          \
-  do {                                                                         \
-    TEST_SET_CHECKPOINT();                                                     \
-    ::rapid_cxx_test::test_outcome m_f(::rapid_cxx_test::failure_type::none,   \
-                                       __FILE__, TEST_FUNC_NAME(), __LINE__,   \
-                                       "TEST_CHECK_THROW_RESULT(" #Except      \
-                                       "," #Checker "," #__VA_ARGS__ ")",      \
-                                       "");                                    \
-    try {                                                                      \
-      (static_cast<void>(__VA_ARGS__));                                        \
-      m_f.type = ::rapid_cxx_test::failure_type::check;                        \
-    } catch (Except const& Caught) {                                           \
-      Checker(Caught);                                                         \
-    }                                                                          \
-    ::rapid_cxx_test::get_reporter().report(m_f);                              \
-  } while (false)
-#
-
-#else // TEST_HAS_NO_EXCEPTIONS
-
-# define TEST_CHECK_NO_THROW(...)                                                      \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_CHECK_NO_THROW(" #__VA_ARGS__ ")", ""                              \
-            );                                                                         \
-        (static_cast<void>(__VA_ARGS__));                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-    } while (false)
-#
-
-#define TEST_CHECK_THROW(Except, ...) ((void)0)
-#define TEST_CHECK_THROW_RESULT(Except, Checker, ...) ((void)0)
-
-#endif // TEST_HAS_NO_EXCEPTIONS
-
-
-////////////////////////////////////////////////////////////////////////////////
-//                    TEST_REQUIRE_NO_THROW / TEST_REQUIRE_THROWs
-////////////////////////////////////////////////////////////////////////////////
-#ifndef TEST_HAS_NO_EXCEPTIONS
-
-# define TEST_REQUIRE_NO_THROW(...)                                                    \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_REQUIRE_NO_THROW(" #__VA_ARGS__ ")", ""                            \
-            );                                                                         \
-        try {                                                                          \
-            (static_cast<void>(__VA_ARGS__));                                          \
-        } catch (...) {                                                                \
-            m_f.type = ::rapid_cxx_test::failure_type::require;                        \
-        }                                                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-        if (m_f.type != ::rapid_cxx_test::failure_type::none) {                        \
-            return;                                                                    \
-        }                                                                              \
-    } while (false)
-#
-
-# define TEST_REQUIRE_THROW(Except, ...)                                               \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_REQUIRE_THROW(" #Except "," #__VA_ARGS__ ")", ""                   \
-            );                                                                         \
-        try {                                                                          \
-            (static_cast<void>(__VA_ARGS__));                                          \
-            m_f.type = ::rapid_cxx_test::failure_type::require;                        \
-        } catch (Except const &) {}                                                    \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-        if (m_f.type != ::rapid_cxx_test::failure_type::none) {                        \
-            return;                                                                    \
-        }                                                                              \
-    } while (false)
-#
-
-#else // TEST_HAS_NO_EXCEPTIONS
-
-# define TEST_REQUIRE_NO_THROW(...)                                                    \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_REQUIRE_NO_THROW(" #__VA_ARGS__ ")", ""                            \
-            );                                                                         \
-        (static_cast<void>(__VA_ARGS__));                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-    } while (false)
-#
-
-#define TEST_REQUIRE_THROW(Except, ...) ((void)0)
-
-#endif // TEST_HAS_NO_EXCEPTIONS
-
-////////////////////////////////////////////////////////////////////////////////
-//                    TEST_ASSERT_NO_THROW / TEST_ASSERT_THROW
-////////////////////////////////////////////////////////////////////////////////
-#ifndef TEST_HAS_NO_EXCEPTIONS
-
-# define TEST_ASSERT_NO_THROW(...)                                                     \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_ASSERT_NO_THROW(" #__VA_ARGS__ ")", ""                             \
-            );                                                                         \
-        try {                                                                          \
-            (static_cast<void>(__VA_ARGS__));                                          \
-        } catch (...) {                                                                \
-            m_f.type = ::rapid_cxx_test::failure_type::assert;                         \
-        }                                                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-        if (m_f.type != ::rapid_cxx_test::failure_type::none) {                        \
-            std::abort();                                                              \
-        }                                                                              \
-    } while (false)
-#
-
-# define TEST_ASSERT_THROW(Except, ...)                                                \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_ASSERT_THROW(" #Except "," #__VA_ARGS__ ")", ""                    \
-            );                                                                         \
-        try {                                                                          \
-            (static_cast<void>(__VA_ARGS__));                                          \
-            m_f.type = ::rapid_cxx_test::failure_type::assert;                         \
-        } catch (Except const &) {}                                                    \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-        if (m_f.type != ::rapid_cxx_test::failure_type::none) {                        \
-            std::abort();                                                              \
-        }                                                                              \
-    } while (false)
-#
-
-#else // TEST_HAS_NO_EXCEPTIONS
-
-# define TEST_ASSERT_NO_THROW(...)                                                     \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-            ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__ \
-            , "TEST_ASSERT_NO_THROW(" #__VA_ARGS__ ")", ""                             \
-            );                                                                         \
-        (static_cast<void>(__VA_ARGS__));                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-    } while (false)
-#
-
-#define TEST_ASSERT_THROW(Except, ...) ((void)0)
-
-#endif // TEST_HAS_NO_EXCEPTIONS
-
-////////////////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////////////////
-
-# define TEST_WARN_EQUAL_COLLECTIONS(...)                                              \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-          ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__   \
-          , "TEST_WARN_EQUAL_COLLECTIONS(" #__VA_ARGS__ ")", ""                        \
-        );                                                                             \
-        if (not ::rapid_cxx_test::detail::check_equal_collections_impl(__VA_ARGS__)) { \
-            m_f.type = ::rapid_cxx_test::failure_type::warn;                           \
-        }                                                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-    } while (false)
-#
-
-# define TEST_CHECK_EQUAL_COLLECTIONS(...)                                             \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-          ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__   \
-          , "TEST_CHECK_EQUAL_COLLECTIONS(" #__VA_ARGS__ ")", ""                       \
-        );                                                                             \
-        if (not ::rapid_cxx_test::detail::check_equal_collections_impl(__VA_ARGS__)) { \
-            m_f.type = ::rapid_cxx_test::failure_type::check;                          \
-        }                                                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-    } while (false)
-#
-
-# define TEST_REQUIRE_EQUAL_COLLECTIONS(...)                                           \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-          ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__   \
-          , "TEST_REQUIRE_EQUAL_COLLECTIONS(" #__VA_ARGS__ ")", ""                     \
-        );                                                                             \
-        if (not ::rapid_cxx_test::detail::check_equal_collections_impl(__VA_ARGS__)) { \
-            m_f.type = ::rapid_cxx_test::failure_type::require;                        \
-        }                                                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-        if (m_f.type != ::rapid_cxx_test::failure_type::none) {                        \
-            return;                                                                    \
-        }                                                                              \
-    } while (false)
-#
-
-# define TEST_ASSERT_EQUAL_COLLECTIONS(...)                                            \
-    do {                                                                               \
-        TEST_SET_CHECKPOINT();                                                         \
-        ::rapid_cxx_test::test_outcome m_f(                                            \
-          ::rapid_cxx_test::failure_type::none, __FILE__, TEST_FUNC_NAME(), __LINE__   \
-          , "TEST_ASSERT_EQUAL_COLLECTIONS(" #__VA_ARGS__ ")", ""                      \
-        );                                                                             \
-        if (not ::rapid_cxx_test::detail::check_equal_collections_impl(__VA_ARGS__)) { \
-            m_f.type = ::rapid_cxx_test::failure_type::assert;                         \
-        }                                                                              \
-        ::rapid_cxx_test::get_reporter().report(m_f);                                  \
-        if (m_f.type != ::rapid_cxx_test::failure_type::none) {                        \
-          ::std::abort();                                                              \
-        }                                                                              \
-    } while (false)
-#
-
-namespace rapid_cxx_test
-{
-    typedef void (*invoker_t)();
-
-    ////////////////////////////////////////////////////////////////////////////
-    struct test_case
-    {
-        test_case()
-            : file(""), func(""), line(0), invoke(NULL)
-        {}
-
-        test_case(const char* file1, const char* func1, std::size_t line1,
-                  invoker_t invoke1)
-            : file(file1), func(func1), line(line1), invoke(invoke1)
-        {}
-
-        const char *file;
-        const char *func;
-        std::size_t line;
-        invoker_t invoke;
-    };
-
-    ////////////////////////////////////////////////////////////////////////////
-    struct failure_type
-    {
-        enum enum_type {
-            none,
-            unsupported,
-            warn,
-            check,
-            require,
-            assert,
-            uncaught_exception
-        };
-    };
-
-    typedef failure_type::enum_type failure_type_t;
-
-    ////////////////////////////////////////////////////////////////////////////
-    struct test_outcome
-    {
-        test_outcome()
-            : type(failure_type::none),
-              file(""), func(""), line(0),
-              expression(""), message("")
-        {}
-
-        test_outcome(failure_type_t type1, const char* file1, const char* func1,
-                     std::size_t line1, const char* expression1,
-                     const char* message1)
-            : type(type1), file(file1), func(func1), line(line1),
-              expression(expression1), message(message1)
-        {
-            trim_func_string();
-        }
-
-        failure_type_t type;
-        const char *file;
-        const char *func;
-        std::size_t line;
-        const char *expression;
-        const char *message;
-
-    private:
-        void trim_file_string() {
-            const char* f_start  = file;
-            const char* prev_start = f_start;
-            const char* last_start = f_start;
-            char last;
-            while ((last = *f_start) != '\0') {
-                ++f_start;
-                if (last == '/' && *f_start) {
-                    prev_start = last_start;
-                    last_start = f_start;
-                }
-            }
-            file = prev_start;
-        }
-      void trim_func_string() {
-          const char* void_loc = ::strstr(func, "void ");
-          if (void_loc == func) {
-              func += strlen("void ");
-          }
-          const char* namespace_loc = ::strstr(func, "::");
-          if (namespace_loc) {
-              func = namespace_loc + 2;
-          }
-      }
-    };
-
-    ////////////////////////////////////////////////////////////////////////////
-    struct checkpoint
-    {
-        const char *file;
-        const char *func;
-        std::size_t line;
-    };
-
-    namespace detail
-    {
-        inline checkpoint & global_checkpoint()
-        {
-            static checkpoint cp = {"", "", 0};
-            return cp;
-        }
-    }
-
-    ////////////////////////////////////////////////////////////////////////////
-    inline void set_checkpoint(const char* file, const char* func, std::size_t line)
-    {
-        checkpoint& cp = detail::global_checkpoint();
-        cp.file = file;
-        cp.func = func;
-        cp.line = line;
-    }
-
-    ////////////////////////////////////////////////////////////////////////////
-    inline checkpoint const & get_checkpoint()
-    {
-        return detail::global_checkpoint();
-    }
-
-    ////////////////////////////////////////////////////////////////////////////
-    class test_suite
-    {
-    public:
-        typedef test_case const* iterator;
-        typedef iterator const_iterator;
-
-    public:
-        test_suite(const char *xname)
-          : m_name(xname), m_tests(), m_size(0)
-        {
-            assert(xname);
-        }
-
-    public:
-        const char *name() const { return m_name; }
-
-        std::size_t size() const { return m_size; }
-
-        test_case const & operator[](std::size_t i) const
-        {
-            assert(i < m_size);
-            return m_tests[i];
-        }
-
-        const_iterator begin() const
-        { return m_tests; }
-
-        const_iterator end() const
-        {
-            return m_tests + m_size;
-        }
-
-    public:
-        std::size_t register_test(test_case tc)
-        {
-            static std::size_t test_case_max = sizeof(m_tests) / sizeof(test_case);
-            assert(m_size < test_case_max);
-            m_tests[m_size] = tc;
-            return m_size++;
-        }
-
-    private:
-        test_suite(test_suite const &);
-        test_suite & operator=(test_suite const &);
-
-    private:
-        const char* m_name;
-        // Since fast compile times in a priority, we use simple containers
-        // with hard limits.
-        test_case m_tests[256];
-        std::size_t m_size;
-    };
-
-    ////////////////////////////////////////////////////////////////////////////
-    class registrar
-    {
-    public:
-        registrar(test_suite & st, test_case tc)
-        {
-            st.register_test(tc);
-        }
-    };
-
-    ////////////////////////////////////////////////////////////////////////////
-    class test_reporter
-    {
-    public:
-        test_reporter()
-            : m_testcases(0), m_testcase_failures(0), m_unsupported(0),
-              m_assertions(0), m_warning_failures(0), m_check_failures(0),
-              m_require_failures(0), m_uncaught_exceptions(0), m_failure()
-        {
-        }
-
-        void test_case_begin()
-        {
-            ++m_testcases;
-            clear_failure();
-        }
-
-        void test_case_end()
-        {
-            if (m_failure.type != failure_type::none
-                && m_failure.type !=  failure_type::unsupported) {
-                ++m_testcase_failures;
-            }
-        }
-
-# if defined(__GNUC__)
-#   pragma GCC diagnostic push
-#   pragma GCC diagnostic ignored "-Wswitch-default"
-# endif
-        // Each assertion and failure is reported through this function.
-        void report(test_outcome o)
-        {
-            ++m_assertions;
-            switch (o.type)
-            {
-            case failure_type::none:
-                break;
-            case failure_type::unsupported:
-                ++m_unsupported;
-                m_failure = o;
-                break;
-            case failure_type::warn:
-                ++m_warning_failures;
-                report_error(o);
-                break;
-            case failure_type::check:
-                ++m_check_failures;
-                report_error(o);
-                m_failure = o;
-                break;
-            case failure_type::require:
-                ++m_require_failures;
-                report_error(o);
-                m_failure = o;
-                break;
-            case failure_type::assert:
-                report_error(o);
-                break;
-            case failure_type::uncaught_exception:
-                ++m_uncaught_exceptions;
-                std::fprintf(stderr
-                    , "Test case FAILED with uncaught exception:\n"
-                      "    last checkpoint near %s::%lu %s\n\n"
-                    , o.file, o.line, o.func
-                    );
-                m_failure = o;
-                break;
-            }
-        }
-# if defined(__GNUC__)
-#   pragma GCC diagnostic pop
-# endif
-
-        test_outcome current_failure() const
-        {
-            return m_failure;
-        }
-
-        void clear_failure()
-        {
-            m_failure.type = failure_type::none;
-            m_failure.file = "";
-            m_failure.func = "";
-            m_failure.line = 0;
-            m_failure.expression = "";
-            m_failure.message = "";
-        }
-
-        std::size_t test_case_count() const
-        { return m_testcases; }
-
-        std::size_t test_case_failure_count() const
-        { return m_testcase_failures; }
-
-        std::size_t unsupported_count() const
-        { return m_unsupported; }
-
-        std::size_t assertion_count() const
-        { return m_assertions; }
-
-        std::size_t warning_failure_count() const
-        { return m_warning_failures; }
-
-        std::size_t check_failure_count() const
-        { return m_check_failures; }
-
-        std::size_t require_failure_count() const
-        { return m_require_failures; }
-
-        std::size_t failure_count() const
-        { return m_check_failures + m_require_failures + m_uncaught_exceptions; }
-
-        // Print a summary of what was run and the outcome.
-        void print_summary(const char* suitename) const
-        {
-            FILE* out = failure_count() ? stderr : stdout;
-            std::size_t testcases_run = m_testcases - m_unsupported;
-            std::fprintf(out, "Summary for testsuite %s:\n", suitename);
-            std::fprintf(out, "    %lu of %lu test cases passed.\n", testcases_run - m_testcase_failures, testcases_run);
-            std::fprintf(out, "    %lu of %lu assertions passed.\n", m_assertions - (m_warning_failures + m_check_failures + m_require_failures), m_assertions);
-            std::fprintf(out, "    %lu unsupported test case%s.\n", m_unsupported, (m_unsupported != 1 ? "s" : ""));
-        }
-
-    private:
-        test_reporter(test_reporter const &);
-        test_reporter const & operator=(test_reporter const &);
-
-        void report_error(test_outcome o) const
-        {
-            std::fprintf(stderr, "In %s:%lu Assertion %s failed.\n    in file: %s\n    %s\n"
-                , o.func, o.line, o.expression, o.file,  o.message ? o.message : ""
-              );
-        }
-
-    private:
-        // counts of testcases, failed testcases, and unsupported testcases.
-        std::size_t m_testcases;
-        std::size_t m_testcase_failures;
-        std::size_t m_unsupported;
-
-        // counts of assertions and assertion failures.
-        std::size_t m_assertions;
-        std::size_t m_warning_failures;
-        std::size_t m_check_failures;
-        std::size_t m_require_failures;
-        std::size_t m_uncaught_exceptions;
-
-        // The last failure. This is cleared between testcases.
-        test_outcome m_failure;
-    };
-
-    ////////////////////////////////////////////////////////////////////////////
-    inline test_reporter & get_reporter()
-    {
-        static test_reporter o;
-        return o;
-    }
-
-    ////////////////////////////////////////////////////////////////////////////
-    class test_runner
-    {
-    public:
-        test_runner(test_suite & ts)
-          : m_ts(ts)
-        {}
-
-    public:
-        int run()
-        {
-            // for each testcase
-            for (test_suite::const_iterator b = m_ts.begin(), e = m_ts.end();
-                 b != e; ++b)
-            {
-                test_case const& tc = *b;
-                set_checkpoint(tc.file, tc.func, tc.line);
-                get_reporter().test_case_begin();
-#ifndef TEST_HAS_NO_EXCEPTIONS
-                try {
-#endif
-                    tc.invoke();
-#ifndef TEST_HAS_NO_EXCEPTIONS
-                } catch (...) {
-                    test_outcome o;
-                    o.type = failure_type::uncaught_exception;
-                    o.file = get_checkpoint().file;
-                    o.func = get_checkpoint().func;
-                    o.line = get_checkpoint().line;
-                    o.expression = "";
-                    o.message = "";
-                    get_reporter().report(o);
-                }
-#endif
-                get_reporter().test_case_end();
-            }
-            auto exit_code = get_reporter().failure_count() ? EXIT_FAILURE : EXIT_SUCCESS;
-            if (exit_code == EXIT_FAILURE || get_reporter().unsupported_count())
-              get_reporter().print_summary(m_ts.name());
-            return exit_code;
-        }
-
-    private:
-        test_runner(test_runner const &);
-        test_runner operator=(test_runner const &);
-
-        test_suite & m_ts;
-    };
-
-    namespace detail
-    {
-        template <class Iter1, class Iter2>
-        bool check_equal_collections_impl(
-            Iter1 start1, Iter1 const end1
-          , Iter2 start2, Iter2 const end2
-          )
-        {
-            while (start1 != end1 && start2 != end2) {
-                if (*start1 != *start2) {
-                    return false;
-                }
-                ++start1; ++start2;
-            }
-            return (start1 == end1 && start2 == end2);
-        }
-    }                                                       // namespace detail
-
-}                                                    // namespace rapid_cxx_test
-
-
-# if defined(__GNUC__)
-#   pragma GCC diagnostic pop
-# endif
-
-#endif /* RAPID_CXX_TEST_H */