Commit a330d428 authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

Add additional test for coverage

parent 08ffe31b
...@@ -250,7 +250,7 @@ insert_generic_instructions(module& m, ...@@ -250,7 +250,7 @@ insert_generic_instructions(module& m,
else if(sins->name() == "@divzero") else if(sins->name() == "@divzero")
{ {
shape s = sins->get_shape(); shape s = sins->get_shape();
copy_ins = m.add_divzero(inputs, {s}); copy_ins = m.add_divzero(copy_inputs, {s});
} }
else else
{ {
......
...@@ -367,6 +367,32 @@ TEST_CASE(add_instructions_range) ...@@ -367,6 +367,32 @@ TEST_CASE(add_instructions_range)
EXPECT(not contains(m1.get_parameter_shapes(), "x2")); EXPECT(not contains(m1.get_parameter_shapes(), "x2"));
} }
TEST_CASE(add_instructions_range2)
{
migraphx::shape s{migraphx::shape::int32_type, {1}};
migraphx::module m1("m1");
auto x1 = m1.add_parameter("x1", s);
auto zero = m1.add_literal(0);
m1.add_instruction(migraphx::make_op("sqrt"), {x1});
migraphx::module m2("m2");
auto x2 = m2.add_parameter("x2", s);
auto divzero = m2.add_divzero({x2, zero}, s);
m1.add_instructions(divzero, m2.end(), {{x2, x1}});
EXPECT(std::any_of(
m1.begin(), m1.end(), [&](auto&& ins) { return migraphx::contains(ins.inputs(), x1); }));
EXPECT(std::count_if(
m1.begin(), m1.end(), [](auto&& ins) { return ins.name() == "@divzero"; }) == 1);
EXPECT(std::count_if(m1.begin(), m1.end(), [](auto&& ins) { return ins.name() == "sqrt"; }) ==
1);
EXPECT(std::count_if(m1.begin(), m1.end(), [](auto&& ins) { return ins.name() == "@param"; }) ==
1);
EXPECT(contains(m1.get_parameter_shapes(), "x1"));
EXPECT(not contains(m1.get_parameter_shapes(), "x2"));
}
TEST_CASE(add_instructions_vector) TEST_CASE(add_instructions_vector)
{ {
migraphx::shape s{migraphx::shape::int32_type, {1}}; migraphx::shape s{migraphx::shape::int32_type, {1}};
......
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