object-introspection/test/type_graph_utils.h
Alastair Robertson ff31971bd3 Printer: Use NodeIds for stable IDs when printing graphs
This removes Printer's legacy behaviour of generating an ID for each
node as it gets printed. This old method meant that if new nodes were
added to or removed from a graph, every ID after the new/removed node
would change.

Now IDs are stable so it is easier to follow specific nodes through
multiple transformation passes in CodeGen.
2023-08-16 12:19:14 +01:00

30 lines
784 B
C++

#pragma once
#include <functional>
#include <string_view>
#include <vector>
#include "oi/type_graph/Types.h"
namespace oi::detail::type_graph {
class Pass;
class TypeGraph;
} // namespace oi::detail::type_graph
using namespace oi::detail;
void check(const type_graph::TypeGraph& typeGraph,
std::string_view expected,
std::string_view comment);
void test(type_graph::Pass pass,
std::string_view input,
std::string_view expectedAfter);
void testNoChange(type_graph::Pass pass, std::string_view input);
type_graph::Container getVector(type_graph::NodeId id = 0);
type_graph::Container getMap(type_graph::NodeId id = 0);
type_graph::Container getList(type_graph::NodeId id = 0);
type_graph::Container getPair(type_graph::NodeId id = 0);