This ensures that the generated artifact file names begin with the
same name as the test case file (thanks @smattr).
#include <catch2/catch.hpp>
#include "test_edge_node_overlap_utilities.h"
+#include "test_utilities.h"
TEST_CASE(
"Overlap",
std::string dot =
"digraph {node[shape=polygon penwidth=2 fontname=Courier] a -> b}";
- test_edge_node_overlap(dot);
+ const auto filename_base = AUTO_NAME();
+
+ test_edge_node_overlap(dot, {.filename_base = filename_base});
}
#pragma once
#include <filesystem>
+#include <string.h>
+#include <string>
#include <string_view>
#include <unordered_set>
/// misc utilities
+/// get the base name of the test case file without file extension
+#define AUTO_NAME() \
+ ({ \
+ std::string s_{strrchr(__FILE__, '/')}; \
+ s_.substr(1, s_.rfind('.') - 1); \
+ })
+
void write_to_file(const std::filesystem::path &directory,
const std::filesystem::path &filename,
std::string_view text);