Commit 886eb1ec authored by Robert Kimball's avatar Robert Kimball

add some new unit tests that are failing

parent b95135c6
......@@ -34,7 +34,31 @@ using namespace std;
using namespace ngraph;
namespace ng = ngraph;
TEST(pass, liveness)
TEST(liveness, constant)
{
auto shape = Shape{1};
auto c = make_shared<op::Constant>(element::i32, Shape{}, "5");
auto rt = make_shared<TensorViewType>(element::Float32::element_type(), shape);
auto f = make_shared<Function>(make_shared<op::Negative>(c), rt, op::Parameters{});
pass::Manager pass_manager;
pass_manager.register_pass<pass::TopologicalSort>();
pass_manager.register_pass<pass::Liveness>();
pass_manager.run_passes(f);
auto tmp = f->get_ordered_ops();
vector<shared_ptr<Node>> sorted{tmp.begin(), tmp.end()};
ASSERT_EQ(2, sorted.size());
EXPECT_EQ(0, sorted[0]->liveness_live_list.size());
EXPECT_EQ(0, sorted[0]->liveness_new_list.size());
EXPECT_EQ(0, sorted[0]->liveness_free_list.size());
EXPECT_EQ(0, sorted[1]->liveness_live_list.size());
EXPECT_EQ(0, sorted[1]->liveness_new_list.size());
EXPECT_EQ(0, sorted[1]->liveness_free_list.size());
}
TEST(liveness, liveness)
{
string image = "liveness.png";
string dump_file = "liveness.txt";
......
......@@ -218,3 +218,23 @@ TEST(memory_layout, basic)
size_t temporary_pool_size = pass_manager.get_state().get_temporary_pool_size();
EXPECT_EQ(12, temporary_pool_size);
}
TEST(memory_layout, constant)
{
string dump_file = "constant.txt";
pass::Manager pass_manager;
pass_manager.register_pass<pass::TopologicalSort>();
pass_manager.register_pass<pass::Liveness>();
pass_manager.register_pass<pass::MemoryLayout>();
pass_manager.register_pass<pass::DumpSorted>(dump_file);
auto shape = Shape{1};
auto c = make_shared<op::Constant>(element::i32, Shape{}, "5");
auto rt = make_shared<TensorViewType>(element::Float32::element_type(), shape);
auto f = make_shared<Function>(make_shared<op::Negative>(c), rt, op::Parameters{});
pass_manager.run_passes(f);
auto sorted = f->get_ordered_ops();
size_t temporary_pool_size = pass_manager.get_state().get_temporary_pool_size();
EXPECT_EQ(0, temporary_pool_size);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment