]> granicus.if.org Git - graphviz/commitdiff
tests: idiomatic use of Catch2’s 'INFO' macro
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 28 Sep 2022 15:32:45 +0000 (08:32 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 30 Sep 2022 00:03:22 +0000 (17:03 -0700)
This is slightly more concise, efficient, and readable.

27 files changed:
tests/test_clusters.cpp
tests/test_edge_color.cpp
tests/test_edge_fillcolor.cpp
tests/test_edge_node_overlap_all_edge_arrows.cpp
tests/test_edge_node_overlap_all_node_shapes.cpp
tests/test_edge_node_overlap_all_primitive_edge_arrows.cpp
tests/test_edge_node_overlap_cylinder_node_shape.cpp
tests/test_edge_node_overlap_ellipse_node_shapes_except_point.cpp
tests/test_edge_node_overlap_normal_and_inv_edge_arrows.cpp
tests/test_edge_node_overlap_normal_and_inv_edge_arrows_all_modifiers.cpp
tests/test_edge_node_overlap_point_node_shape.cpp
tests/test_edge_node_overlap_polygon_node_shapes.cpp
tests/test_edge_penwidth.cpp
tests/test_engines.cpp
tests/test_max_edge_node_overlap_polygon_node_shapes.cpp
tests/test_min_edge_node_overlap_polygon_node_shapes.cpp
tests/test_neatopack.cpp
tests/test_node_color.cpp
tests/test_node_fillcolor.cpp
tests/test_node_penwidth.cpp
tests/test_rankdir.cpp
tests/test_subgraph_layout.cpp
tests/test_subgraphs.cpp
tests/test_svg_analyzer.cpp
tests/test_svg_analyzer_color.cpp
tests/test_svg_analyzer_fillcolor.cpp
tests/test_svg_analyzer_penwidth.cpp

index 9a0d3a819eee2f4f3892766cb2f351beb4ecf5ec..4a8658f21f289810d9a797706008479caafd7e4b 100644 (file)
@@ -24,7 +24,7 @@ TEST_CASE(
           : fmt::format("{} {{subgraph cluster_0 {{a {} b}}; subgraph "
                         "cluster_1 {{c {} d }}}}",
                         graph_type, edge_op, edge_op);
-  INFO(fmt::format("DOT source: {}", dot));
+  INFO("DOT source: " << dot);
 
   auto g = agmemread(dot.c_str());
   REQUIRE(g != nullptr);
@@ -38,7 +38,7 @@ TEST_CASE(
                                       "osage",    //
                                       "patchwork" //
   );
-  INFO("Layout engine: " + engine);
+  INFO("Layout engine: " << engine);
 
   auto gvc = gvContextPlugins(lt_preloaded_symbols, false);
 
index 0ef3c072bceadbfcbe06c11b52e5717012e02ed9..012fe2a1d3375c98fc138bdb145a8460ef03829f 100644 (file)
@@ -11,12 +11,12 @@ TEST_CASE("Edge color",
 
   const auto primitive_arrow_shape =
       GENERATE(from_range(all_primitive_arrow_shapes));
-  INFO(fmt::format("Primitive arrow shape: {}", primitive_arrow_shape));
+  INFO("Primitive arrow shape: " << primitive_arrow_shape);
 
   const auto edge_rgb_color = GENERATE("#000000", "#ffffff", "#5580aa");
   const auto opacity = GENERATE(0, 100, 255);
   const auto edge_rgba_color = fmt::format("{}{:02x}", edge_rgb_color, opacity);
-  INFO(fmt::format("Edge color: {}", edge_rgba_color));
+  INFO("Edge color: " << edge_rgba_color);
 
   auto dot =
       fmt::format("digraph g1 {{edge [arrowhead={} color=\"{}\"]; a -> b}}",
index 5a7afd5611be682c738d13d617b28680232e391b..d071c500e5a825c70d51d06a7f68bab40d179c79 100644 (file)
@@ -13,13 +13,13 @@ TEST_CASE("Edge color",
 
   const auto primitive_arrow_shape =
       GENERATE(from_range(all_primitive_arrow_shapes));
-  INFO(fmt::format("Primitive arrow shape: {}", primitive_arrow_shape));
+  INFO("Primitive arrow shape: " << primitive_arrow_shape);
 
   const auto edge_rgb_fillcolor = GENERATE("#000000", "#ffffff", "#5580aa");
   const auto opacity = GENERATE(0, 100, 255);
   const auto edge_rgba_fillcolor =
       fmt::format("{}{:02x}", edge_rgb_fillcolor, opacity);
-  INFO(fmt::format("Edge fillcolor: {}", edge_rgba_fillcolor));
+  INFO("Edge fillcolor: " << edge_rgba_fillcolor);
 
   auto dot =
       fmt::format("digraph g1 {{edge [arrowhead={} fillcolor=\"{}\"]; a -> b}}",
index 5503ee5997500681e8db482279267136cf1da7d1..15f03cc93925ff78857c67c31de9542085cd4297 100644 (file)
@@ -18,15 +18,15 @@ TEST_CASE("Edge node overlap for all arrow shapes",
 
   const auto primitive_arrow_shape =
       GENERATE(from_range(all_primitive_arrow_shapes));
-  INFO(fmt::format("Edge primitive arrow shape: {}", primitive_arrow_shape));
+  INFO("Edge primitive arrow shape: " << primitive_arrow_shape);
 
   const auto arrow_shape_modifier =
       GENERATE(from_range(all_arrow_shape_modifiers));
-  INFO(fmt::format("Edge arrow shape modifier: {}", arrow_shape_modifier));
+  INFO("Edge arrow shape modifier: " << arrow_shape_modifier);
 
   const auto arrow_shape =
       fmt::format("{}{}", arrow_shape_modifier, primitive_arrow_shape);
-  INFO(fmt::format("Edge arrow shape: {}", arrow_shape));
+  INFO("Edge arrow shape: " << arrow_shape);
   filename_base += fmt::format("_arrow_shape{}", arrow_shape);
 
   const graph_options graph_options = {
index 944421561d572ee8f47c65a0ad3b14b65e486c5e..e927d461b82de82db0f9a551dc893db9459d0243 100644 (file)
@@ -13,7 +13,7 @@ TEST_CASE(
     "does not overlap it too much, regardless of the node shape") {
 
   const auto shape = GENERATE(from_range(all_node_shapes));
-  INFO(fmt::format("Node shape: {}", shape));
+  INFO("Node shape: " << shape);
 
   const graph_options graph_options = {
       .node_shape = shape,
index 03ea2ffb580321a28ac3638c94bbe4cf95c63136..74663a5d01c745c372df9fd8c55fe86646d0322e 100644 (file)
@@ -17,9 +17,9 @@ TEST_CASE("Edge node overlap for all primitive arrow shapes",
 
   const auto primitive_arrow_shape =
       GENERATE(from_range(all_primitive_arrow_shapes));
-  INFO(fmt::format("Edge primitive arrow shape: {}", primitive_arrow_shape));
+  INFO("Edge primitive arrow shape: " << primitive_arrow_shape);
 
-  INFO(fmt::format("Edge arrow shape: {}", primitive_arrow_shape));
+  INFO("Edge arrow shape: " << primitive_arrow_shape);
   filename_base += fmt::format("_arrow_shape{}", primitive_arrow_shape);
 
   const graph_options graph_options = {
index 9b265aab641b111c3b07c909aa3a8f591437d75c..db2d428b3524ee028756fed4667d4680fe6b4410 100644 (file)
@@ -2,7 +2,6 @@
 #include <string>
 
 #include <catch2/catch.hpp>
-#include <fmt/format.h>
 
 #include "test_edge_node_overlap_utilities.h"
 #include "test_utilities.h"
@@ -12,10 +11,10 @@ TEST_CASE("Overlap cylinder node shape",
           "node touches that node and does not overlap it too much") {
 
   const auto shape = "cylinder";
-  INFO(fmt::format("Node shape: {}", shape));
+  INFO("Node shape: " << shape);
 
   const auto rankdir = GENERATE(from_range(all_rank_directions));
-  INFO(fmt::format("Rank direction: {}", rankdir));
+  INFO("Rank direction: " << rankdir);
 
   const graph_options graph_options = {
       .rankdir = rankdir,
index eb2ab7739a3f07f1ec3899533185b32a8094df8e..567f39e6d34fe080b69963c7126d67d7c5eb96b5 100644 (file)
@@ -16,10 +16,10 @@ TEST_CASE("Overlap ellipse node shapes",
       filter([](const std::string_view shape) { return shape != "point"; },
              from_range(node_shapes_consisting_of_ellipse)));
 
-  INFO(fmt::format("Node shape: {}", shape));
+  INFO("Node shape: " << shape);
 
   const auto rankdir = GENERATE(from_range(all_rank_directions));
-  INFO(fmt::format("Rank direction: {}", rankdir));
+  INFO("Rank direction: " << rankdir);
 
   const graph_options graph_options = {
       .rankdir = rankdir,
index f80e4451682141297310e9310e14febde57faa36..f96a25a69e27785fa6545e1d15873f0eb10426ef 100644 (file)
@@ -14,7 +14,7 @@ TEST_CASE("Edge node overlap for normal and inv arrow",
 
   const std::string_view primitive_arrow_shape = GENERATE("normal", "inv");
 
-  INFO(fmt::format("Edge arrowhead: {}", primitive_arrow_shape));
+  INFO("Edge arrowhead: " << primitive_arrow_shape);
   filename_base += fmt::format("_arrow_shape_{}", primitive_arrow_shape);
 
   const graph_options graph_options = {
index 742037c4d5b19931bdee366c5db0be150ac1c863..584e5b1ab14242ddfe22080d7881f452cbdf9511 100644 (file)
@@ -17,15 +17,15 @@ TEST_CASE(
   std::string filename_base = "test_edge_node_overlap_all_edge_arrows";
 
   const std::string_view primitive_arrow_shape = GENERATE("normal", "inv");
-  INFO(fmt::format("Edge primitive arrow shape: {}", primitive_arrow_shape));
+  INFO("Edge primitive arrow shape: " << primitive_arrow_shape);
 
   const auto arrow_shape_modifier =
       GENERATE(from_range(all_arrow_shape_modifiers));
-  INFO(fmt::format("Edge arrow shape modifier: {}", arrow_shape_modifier));
+  INFO("Edge arrow shape modifier: " << arrow_shape_modifier);
 
   const auto arrow_shape =
       fmt::format("{}{}", arrow_shape_modifier, primitive_arrow_shape);
-  INFO(fmt::format("Edge arrow shape: {}", arrow_shape));
+  INFO("Edge arrow shape: " << arrow_shape);
   filename_base += fmt::format("_arrow_{}", arrow_shape);
 
   const graph_options graph_options = {
index fe31aafabd02c9733250dbda88ac234703ae393e..acf4b7122d2b4e63c5dddbda459ecb34c95ad362 100644 (file)
@@ -2,7 +2,6 @@
 #include <string>
 
 #include <catch2/catch.hpp>
-#include <fmt/format.h>
 
 #include "test_edge_node_overlap_utilities.h"
 #include "test_utilities.h"
@@ -12,10 +11,10 @@ TEST_CASE("Overlap point node shape",
           "touches that node and does not overlap it too much") {
 
   const auto shape = "point";
-  INFO(fmt::format("Node shape: {}", shape));
+  INFO("Node shape: " << shape);
 
   const auto rankdir = GENERATE(from_range(all_rank_directions));
-  INFO(fmt::format("Rank direction: {}", rankdir));
+  INFO("Rank direction: " << rankdir);
 
   const graph_options graph_options = {
       .rankdir = rankdir,
index 08db19aacb73a403c6d086cedac462db895a827b..a38d7e9dd0bef4043b7c55e9de8dc7966015e59f 100644 (file)
@@ -11,10 +11,10 @@ TEST_CASE(
     "shape") {
 
   const auto shape = GENERATE(from_range(node_shapes_consisting_of_polygon));
-  INFO(fmt::format("Node shape: {}", shape));
+  INFO("Node shape: " << shape);
 
   const auto rankdir = GENERATE(from_range(all_rank_directions));
-  INFO(fmt::format("Rank direction: {}", rankdir));
+  INFO("Rank direction: " << rankdir);
 
   const graph_options graph_options = {
       .rankdir = rankdir,
index e37ce8c108701a64f5286f6ebbc7a99c49e5343a..05c6534052d34a178eddaa414bdcd6ac6ff65910 100644 (file)
@@ -10,10 +10,10 @@ TEST_CASE("Edge penwidth",
 
   const auto primitive_arrow_shape =
       GENERATE(from_range(all_primitive_arrow_shapes));
-  INFO(fmt::format("Primitive arrow shape: {}", primitive_arrow_shape));
+  INFO("Primitive arrow shape: " << primitive_arrow_shape);
 
   const auto edge_penwidth = GENERATE(0.5, 1.0, 2.0);
-  INFO(fmt::format("Edge penwidth: {}", edge_penwidth));
+  INFO("Edge penwidth: " << edge_penwidth);
 
   auto dot =
       fmt::format("digraph g1 {{edge [arrowhead={} penwidth={}]; a -> b}}",
index 02454cdacdece1e3fda7186131527eda9a99ee92..9f01a5ab44ad46cefb52e8f6d8a7d30aad5122b3 100644 (file)
@@ -16,7 +16,7 @@ TEST_CASE(
   const std::string edge_op = directed_graph ? "->" : "--";
 
   std::string dot = fmt::format("{} {{a {} b}}", graph_type, edge_op);
-  INFO(fmt::format("DOT source: {}", dot));
+  INFO("DOT source: " << dot);
 
   auto g = agmemread(dot.c_str());
   REQUIRE(g != nullptr);
@@ -30,7 +30,7 @@ TEST_CASE(
                                       "osage",    //
                                       "patchwork" //
   );
-  INFO("Layout engine: " + engine);
+  INFO("Layout engine: " << engine);
 
   auto gvc = gvContextPlugins(lt_preloaded_symbols, false);
 
index 692cc16c37a070e07227c3d3d0d5338dad9b1f2d..182666e56c8b29c021e1f7774f111a66842c006f 100644 (file)
@@ -10,7 +10,7 @@ TEST_CASE(
     "not overlap that node, regardless of the node shape") {
 
   const auto shape = GENERATE(from_range(node_shapes_consisting_of_polygon));
-  INFO(fmt::format("Node shape: {}", shape));
+  INFO("Node shape: " << shape);
 
   const graph_options graph_options = {
       .node_shape = shape,
index 11d8d1b9a8d4eab984f7588e524da8eb64236338..db12e5b9cb4f60ff70cb78909b6427cb46cedc12 100644 (file)
@@ -9,7 +9,7 @@ TEST_CASE("Minimum edge and node overlap for polygon node shapes",
           "node, regardless of the node shape") {
 
   const auto shape = GENERATE(from_range(node_shapes_consisting_of_polygon));
-  INFO(fmt::format("Node shape: {}", shape));
+  INFO("Node shape: " << shape);
 
   const graph_options graph_options = {
       .node_shape = shape,
index 4843e0dcfc336c38e5749e198e487104772cfa43..2b9b1460d9fde5207a13d5806999da59930b9320 100644 (file)
@@ -24,7 +24,7 @@ TEST_CASE("take an input graph, compute its connected components, lay out each "
       num_subgraphs == 1
           ? fmt::format("{} {{a {} b}}", graph_type, edge_op)
           : fmt::format("{} {{a {} b; c {} d}}", graph_type, edge_op, edge_op);
-  INFO(fmt::format("DOT source: {}", dot));
+  INFO("DOT source: " << dot);
 
   auto *g = agmemread(dot.c_str());
   REQUIRE(g != nullptr);
index e65ef9da8d3802a2ca7e9893433d2cc7b725a8a9..a0755863579077444b4520dea5a1666bb2897e8f 100644 (file)
@@ -16,12 +16,12 @@ TEST_CASE("Node color",
         return !node_shapes_without_svg_shape.contains(shape);
       },
       from_range(all_node_shapes)));
-  INFO(fmt::format("Shape: {}", shape));
+  INFO("Shape: " << shape);
 
   const auto node_rgb_color = GENERATE("#000000", "#ffffff", "#5580aa");
   const auto opacity = GENERATE(0, 100, 255);
   const auto node_rgba_color = fmt::format("{}{:02x}", node_rgb_color, opacity);
-  INFO(fmt::format("Node color: {}", node_rgba_color));
+  INFO("Node color: " << node_rgba_color);
 
   auto dot = fmt::format("digraph g1 {{node [shape={} color=\"{}\"]; a -> b}}",
                          shape, node_rgba_color);
index d3e1bb519ad1ee2c540ea1c9c38fc6ae639248f8..96ef744369d75e2398cafb57aac3336553426227 100644 (file)
@@ -16,14 +16,14 @@ TEST_CASE("Node fillcolor",
         return !node_shapes_without_svg_shape.contains(shape);
       },
       from_range(all_node_shapes)));
-  INFO(fmt::format("Shape: {}", shape));
+  INFO("Shape: " << shape);
 
   const auto node_rgb_fillcolor =
       GENERATE("#000000", "#ffffff", "#ff0000", "#aa0f55");
   const auto opacity = GENERATE(0, 200, 255);
   const auto node_rgba_fillcolor =
       fmt::format("{}{:02x}", node_rgb_fillcolor, opacity);
-  INFO(fmt::format("Node fillcolor: {}", node_rgba_fillcolor));
+  INFO("Node fillcolor: " << node_rgba_fillcolor);
 
   auto dot = fmt::format(
       "digraph g1 {{node [shape={} style=filled fillcolor=\"{}\"]; a -> b}}",
index cfae76361e7551112ca2ca12ad2d3c8ba8725604..919d794212d6d05227efc19a53e77267847ffe91 100644 (file)
@@ -15,10 +15,10 @@ TEST_CASE("Node penwidth",
         return !node_shapes_without_svg_shape.contains(shape);
       },
       from_range(all_node_shapes)));
-  INFO(fmt::format("Shape: {}", shape));
+  INFO("Shape: " << shape);
 
   const auto node_penwidth = GENERATE(0.5, 1.0, 2.0);
-  INFO(fmt::format("Node penwidth: {}", node_penwidth));
+  INFO("Node penwidth: " << node_penwidth);
 
   auto dot = fmt::format("digraph g1 {{node [shape={} penwidth={}]; a -> b}}",
                          shape, node_penwidth);
index 34c194cfd763b2f7d80d4c54760a651261a3471a..fd735ca8fa7365fc4f2321d23f74d5fa69f581df 100644 (file)
@@ -11,14 +11,14 @@ TEST_CASE("Graph rankdir", "Test that the Graphviz `rankdir` attribute affects "
                            "correctly when the 'dot` layout engine is used") {
 
   const auto rankdir = GENERATE(from_range(all_rank_directions));
-  INFO(fmt::format("Rankdir: {}", rankdir));
+  INFO("Rankdir: " << rankdir);
 
   const auto shape = GENERATE(filter(
       [](std::string_view shape) {
         return !node_shapes_without_svg_shape.contains(shape);
       },
       from_range(all_node_shapes)));
-  INFO(fmt::format("Shape: {}", shape));
+  INFO("Shape: " << shape);
 
   auto dot = fmt::format(
       "digraph g1 {{rankdir={}; node [shape={} fontname=Courier]; a -> b}}",
index 0c9241edad09b74a0095df02eaa534d87d0fd000..ed1aaa216e082a464b567ece7a2d862207d2f92d 100644 (file)
@@ -23,7 +23,7 @@ TEST_CASE("subgraph layout in directed and undirected graphs with different "
           : fmt::format(
                 "{} {{subgraph s0 {{a {} b}}; subgraph s1 {{c {} d }}}}",
                 graph_type, edge_op, edge_op);
-  INFO(fmt::format("DOT source: {}", dot));
+  INFO("DOT source: " << dot);
 
   auto g = agmemread(dot.c_str());
   REQUIRE(g != nullptr);
@@ -37,7 +37,7 @@ TEST_CASE("subgraph layout in directed and undirected graphs with different "
                                       "osage",    //
                                       "patchwork" //
   );
-  INFO("Layout engine: " + engine);
+  INFO("Layout engine: " << engine);
 
   auto gvc = gvContextPlugins(lt_preloaded_symbols, false);
 
index 4e42ffc77552662bc6d908a96316ba5ead3f788c..d6e74370ccfc9c131bdf85e51d7433055173c9c5 100644 (file)
@@ -23,7 +23,7 @@ TEST_CASE("subgraphs in directed and undirected graphs with different layout "
           : fmt::format(
                 "{} {{subgraph s0 {{a {} b}}; subgraph s1 {{c {} d }}}}",
                 graph_type, edge_op, edge_op);
-  INFO(fmt::format("DOT source: {}", dot));
+  INFO("DOT source: " << dot);
 
   auto g = agmemread(dot.c_str());
   REQUIRE(g != nullptr);
@@ -37,7 +37,7 @@ TEST_CASE("subgraphs in directed and undirected graphs with different layout "
                                       "osage",    //
                                       "patchwork" //
   );
-  INFO("Layout engine: " + engine);
+  INFO("Layout engine: " << engine);
 
   auto gvc = gvContextPlugins(lt_preloaded_symbols, false);
   {
index 3e83be88d72ec916c0e4c25b67bb1cebe4e408a9..c5dc850b80f68bee9d6c1024efa55f85b11037e8 100644 (file)
@@ -11,7 +11,7 @@ TEST_CASE("SvgAnalyzer",
           "from that data structure") {
 
   const auto shape = GENERATE(from_range(all_node_shapes));
-  INFO(fmt::format("Shape: {}", shape));
+  INFO("Shape: " << shape);
 
   auto dot = fmt::format("digraph g1 {{node [shape={}]; a -> b}}", shape);
 
index 685e600abb637b842a61b49c6579dd8e74d7ba32..e30c1ecf40873c57529dc272f72f9f12b043465d 100644 (file)
@@ -12,11 +12,11 @@ TEST_CASE("SvgAnalyzer color",
           "the Graphviz `color` attribute is used for nodes and edges ") {
 
   const auto shape = GENERATE(from_range(all_node_shapes));
-  INFO(fmt::format("Shape: {}", shape));
+  INFO("Shape: " << shape);
 
   const std::string_view color =
       GENERATE("", "\"#10204000\"", "\"#10204080\"", "\"#102040ff\"");
-  INFO(fmt::format("Color: {}", color));
+  INFO("Color: " << color);
   const auto color_attr = color.empty() ? "" : fmt::format(" color={}", color);
 
   auto dot = fmt::format("digraph g1 {{node [shape={}{}]; edge [{}]; a -> b}}",
index 3f31f3bc542fae10935b30943acdf3f37ef7c5c3..23d7c3317f15cb5f8d101d7a2788aae98a9599b3 100644 (file)
@@ -12,11 +12,11 @@ TEST_CASE("SvgAnalyzer fillcolor",
           "`fillcolor` attribute is used for nodes and edges ") {
 
   const auto shape = GENERATE(from_range(all_node_shapes));
-  INFO(fmt::format("Shape: {}", shape));
+  INFO("Shape: " << shape);
 
   const std::string_view fillcolor =
       GENERATE("", "\"#10204000\"", "\"#10204080\"", "\"#102040ff\"");
-  INFO(fmt::format("Fillcolor: {}", fillcolor));
+  INFO("Fillcolor: " << fillcolor);
   const auto fillcolor_attr =
       fillcolor.empty() ? "" : fmt::format(" fillcolor={}", fillcolor);
   const std::string_view node_style = fillcolor.empty() ? "" : "filled";
index 7f42a2c6a5b10293484f39604e9fc8799b9b4a51..1a1c645922f8d1e0f26eba13f0e254da285c8f8d 100644 (file)
@@ -10,10 +10,10 @@ TEST_CASE("SvgAnalyzer penwidth",
           "attribute is used for nodes and edges") {
 
   const auto shape = GENERATE(from_range(all_node_shapes));
-  INFO(fmt::format("Shape: {}", shape));
+  INFO("Shape: " << shape);
 
   const auto penwidth = GENERATE(0.5, 1.0, 2.0);
-  INFO(fmt::format("Node and edge penwidth: {}", penwidth));
+  INFO("Node and edge penwidth: " << penwidth);
 
   auto dot = fmt::format(
       "digraph g1 {{node [shape={} penwidth={}]; edge [penwidth={}]; a -> b}}",