Move type definitions to test namespace

This commit is contained in:
r0qs 2023-08-22 16:43:59 +02:00
parent 5e68617a2e
commit 2ab40e3fb3
No known key found for this signature in database
GPG Key ID: 61503DBA6667276C

View File

@ -28,8 +28,8 @@ using namespace solidity::yul;
namespace solidity::yul::test namespace solidity::yul::test
{ {
struct ImmediateDominatorTest typedef std::pair<std::string, std::string> Edge;
{
struct Vertex { struct Vertex {
std::string name; std::string name;
std::vector<std::shared_ptr<Vertex>> successors; std::vector<std::shared_ptr<Vertex>> successors;
@ -40,8 +40,6 @@ struct ImmediateDominatorTest
} }
}; };
typedef std::pair<std::string, std::string> Edge;
struct ForEachVertexSuccessorTest { struct ForEachVertexSuccessorTest {
template<typename Callable> template<typename Callable>
void operator()(Vertex _v, Callable&& _callable) const void operator()(Vertex _v, Callable&& _callable) const
@ -51,6 +49,8 @@ struct ImmediateDominatorTest
} }
}; };
struct ImmediateDominatorTest
{
size_t numVertices; size_t numVertices;
std::shared_ptr<Vertex> entry; std::shared_ptr<Vertex> entry;
std::map<std::string, std::shared_ptr<Vertex>> vertices; std::map<std::string, std::shared_ptr<Vertex>> vertices;
@ -60,11 +60,10 @@ struct ImmediateDominatorTest
class DominatorFixture class DominatorFixture
{ {
typedef ImmediateDominatorTest::Vertex Vertex;
protected: protected:
static std::shared_ptr<ImmediateDominatorTest> prepareTestDefinition( static std::shared_ptr<ImmediateDominatorTest> prepareTestDefinition(
std::vector<std::string> _vertices, std::vector<std::string> _vertices,
std::vector<ImmediateDominatorTest::Edge> _edges, std::vector<Edge> _edges,
std::vector<size_t> _expectedIdom, std::vector<size_t> _expectedIdom,
std::map<std::string, size_t> _expectedDFSIndices std::map<std::string, size_t> _expectedDFSIndices
) )
@ -97,11 +96,7 @@ protected:
} }
}; };
typedef ImmediateDominatorTest::Edge Edge; typedef Dominator<Vertex, ForEachVertexSuccessorTest> DominatorFinder;
typedef Dominator<
ImmediateDominatorTest::Vertex,
ImmediateDominatorTest::ForEachVertexSuccessorTest
> DominatorFinder;
BOOST_AUTO_TEST_SUITE(Dominators) BOOST_AUTO_TEST_SUITE(Dominators)