Debian Codegraph @

tests/test_utilities.h

raw
1 #pragma once
2
3 #include <filesystem>
4 #include <string.h>
5 #include <string>
6 #include <string_view>
7 #include <unordered_set>
8
9 /// node shapes
10
11 extern const std::unordered_set<std::string_view> all_node_shapes;
12 extern const std::unordered_set<std::string_view>
13 node_shapes_consisting_of_ellipse;
14 extern const std::unordered_set<std::string_view>
15 node_shapes_consisting_of_ellipse_and_polyline;
16 extern const std::unordered_set<std::string_view>
17 node_shapes_consisting_of_path;
18 extern const std::unordered_set<std::string_view>
19 node_shapes_consisting_of_polygon;
20 extern const std::unordered_set<std::string_view>
21 node_shapes_consisting_of_polygon_and_polyline;
22 extern const std::unordered_set<std::string_view> node_shapes_without_svg_shape;
23
24 bool contains_ellipse_shape(std::string_view shape);
25 bool contains_multiple_shapes_with_different_fill(std::string_view shape);
26 bool contains_polygon_shape(std::string_view shape);
27 bool contains_polyline_shape(std::string_view shape);
28
29 bool is_polygon_shape(std::string_view shape);
30
31 /// arrow shapes
32 extern const std::unordered_set<std::string_view>
33 primitive_polygon_arrow_shapes;
34 extern const std::unordered_set<std::string_view>
35 primitive_polygon_and_polyline_arrow_shapes;
36 extern const std::unordered_set<std::string_view> all_primitive_arrow_shapes;
37 extern const std::unordered_set<std::string_view>
38 primitive_arrow_shapes_without_closed_svg_shape;
39
40 /// arrow shape modifiers
41 extern const std::unordered_set<std::string_view> all_arrow_shape_modifiers;
42
43 /// rank directions
44 extern const std::unordered_set<std::string_view> all_rank_directions;
45
46 /// edge directions
47 extern const std::unordered_set<std::string_view> all_edge_directions;
48
49 /// misc utilities
50
51 /// get the base name of the test case file without file extension
52 #define AUTO_NAME() std::filesystem::path(__FILE__).stem().string()
53
54 void write_to_file(const std::filesystem::path &directory,
55 const std::filesystem::path &filename,
56 std::string_view text);