--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TEST_HELPER_H__
+#define __TEST_HELPER_H__
+
+#include "ProgressReporter.h"
+#include "Conversion/TypeInferencePass.h"
+#include "Conversion/ShapeInferencePass.h"
+
+#include <logo/Pass.h>
+#include <logo/Phase.h>
+
+#include <loco.h>
+
+#include <stdex/Memory.h>
+
+#include <gtest/gtest.h>
+
+/**
+ * @brief Check the number of nodes in a graph starting from OUTPUTS
+ */
+#define EXO_TEST_ASSERT_NODE_COUNT(OUTPUTS, COUNT) \
+ { \
+ auto v = loco::postorder_traversal((OUTPUTS)); \
+ ASSERT_EQ(v.size(), (COUNT)); \
+ }
+
+namespace exo
+{
+namespace test
+{
+
+/**
+ * @brief Phase for test, that is used to test pass. This phase initially adds TypeInferencePass
+ * and ShapeInferencePass
+ */
+class TypeShapeReadyPhase
+{
+public:
+ TypeShapeReadyPhase()
+ {
+ // Type and Shape inference is prerequisite for run other test
+ _phase.emplace_back(stdex::make_unique<::exo::TypeInferencePass>());
+ _phase.emplace_back(stdex::make_unique<::exo::ShapeInferencePass>());
+ }
+
+ template <typename PassT> void add_pass() { _phase.emplace_back(stdex::make_unique<PassT>()); }
+
+ void run(loco::Graph *g)
+ {
+ logo::PhaseRunner<logo::PhaseStrategy::Saturate> phase_runner{g};
+
+ ::exo::ProgressReporter prog(g, logo::PhaseStrategy::Saturate);
+ phase_runner.attach(&prog);
+ phase_runner.run(_phase);
+ }
+
+private:
+ logo::Phase _phase;
+};
+
+} // namespace test
+} // namespace exo
+
+#endif // __TEST_HELPER_H__