17#ifndef __TEST_HELPER_H__
18#define __TEST_HELPER_H__
31#include <gtest/gtest.h>
36#define EXO_TEST_ASSERT_NODE_COUNT(OUTPUTS, COUNT) \
38 auto v = loco::postorder_traversal(OUTPUTS); \
39 ASSERT_EQ(v.size(), (COUNT)); \
57 _phase.emplace_back(std::make_unique<::exo::TypeInferencePass>());
58 _phase.emplace_back(std::make_unique<::exo::ShapeInferencePass>());
61 template <
typename PassT>
void add_pass() { _phase.emplace_back(std::make_unique<PassT>()); }
69 phase_runner.attach(&prog);
70 phase_runner.run(_phase);
86 EXO_ASSERT(succs.size() == 1,
"parent has more than 1 succs.");
88 return dynamic_cast<LocoNodeT *
>(*succs.begin());
93 T *first_node =
nullptr;
95 uint32_t count = nodes->
size();
97 for (uint32_t i = 0; i < count; ++i)
99 first_node =
dynamic_cast<T *
>(nodes->
at(i));
100 if (first_node !=
nullptr)
Phase for test, that is used to test pass. This phase initially adds TypeInferencePass and ShapeInfer...
Logical unit of computation.
T * at(uint32_t n) const
Access N-th object.
uint32_t size(void) const
Return the number of objects.
#define EXO_ASSERT(condition, msg)
LocoNodeT * get_only_succ(loco::Node *parent)
Get the only succ object of type LocoNodeT. (The name only succ comes from English word only child....
T * find_first_node_bytype(loco::Graph *g)
std::set< Node * > succs(const Node *node)
Enumerate all the successors of a given node.
std::vector< std::unique_ptr< Pass > > Phase