"driver/olCompiling/include/write_file.hpp" did not exist on "d2315b0dfcd6f31cca4328819eaf60d77e952dd6"
Commit b9e55afe authored by Paul's avatar Paul
Browse files

Add more tests for compute overloads

parent 9b40d1f8
...@@ -33,6 +33,22 @@ struct sum_cf_op ...@@ -33,6 +33,22 @@ struct sum_cf_op
} }
}; };
struct non_computable_cf
{
std::string name() const { return "non_computable"; }
migraphx::shape compute_shape(std::vector<migraphx::shape> inputs) const
{
if(inputs.empty())
return {};
return inputs.front();
}
};
struct test_context
{
void finish() const {}
};
TEST_CASE(literal_test) TEST_CASE(literal_test)
{ {
migraphx::program p; migraphx::program p;
...@@ -75,4 +91,29 @@ TEST_CASE(op_test3) ...@@ -75,4 +91,29 @@ TEST_CASE(op_test3)
CHECK(sum2->eval().empty()); CHECK(sum2->eval().empty());
} }
TEST_CASE(compute_op_c)
{
migraphx::operation op = sum_op{};
auto one = migraphx::literal{1}.get_argument();
auto two = migraphx::literal{2}.get_argument();
EXPECT(test::throws([&] { op.compute(migraphx::shape{migraphx::shape::float_type, {1}}, {one, two}); }));
}
TEST_CASE(compute_nop_c)
{
migraphx::operation op = non_computable_cf{};
auto one = migraphx::literal{1}.get_argument();
auto two = migraphx::literal{2}.get_argument();
EXPECT(test::throws([&] { op.compute(migraphx::shape{migraphx::shape::float_type, {1}}, {one, two}); }));
}
TEST_CASE(compute_nop_context)
{
migraphx::operation op = non_computable_cf{};
auto one = migraphx::literal{1}.get_argument();
auto two = migraphx::literal{2}.get_argument();
migraphx::context ctx = test_context{};
EXPECT(test::throws([&] { op.compute(ctx, migraphx::shape{migraphx::shape::float_type, {1}}, {one, two}); }));
}
int main(int argc, const char* argv[]) { test::run(argc, argv); } int main(int argc, const char* argv[]) { test::run(argc, argv); }
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