program_test.cpp 718 Bytes
Newer Older
Paul's avatar
Paul committed
1

Paul's avatar
Paul committed
2
3
4
#include <migraphx/program.hpp>
#include <migraphx/iterator_for.hpp>
#include <migraphx/instruction.hpp>
Paul's avatar
Paul committed
5
6
7
8
#include <sstream>
#include "test.hpp"
#include <basic_ops.hpp>

Paul's avatar
Paul committed
9
migraphx::program create_program()
Paul's avatar
Paul committed
10
{
Paul's avatar
Paul committed
11
    migraphx::program p;
Paul's avatar
Paul committed
12

Paul's avatar
Paul committed
13
14
    auto x = p.add_parameter("x", {migraphx::shape::int64_type});
    auto y = p.add_parameter("y", {migraphx::shape::int64_type});
Paul's avatar
Paul committed
15
16

    auto sum = p.add_instruction(sum_op{}, x, y);
Paul's avatar
Paul committed
17
    auto one = p.add_literal(1);
Paul's avatar
Paul committed
18
19
20
21
22
    p.add_instruction(sum_op{}, sum, one);

    return p;
}

Paul's avatar
Paul committed
23
TEST_CASE(program_equality)
Paul's avatar
Paul committed
24
{
Paul's avatar
Paul committed
25
26
    migraphx::program x = create_program();
    migraphx::program y = create_program();
Paul's avatar
Paul committed
27
28
29
    EXPECT(x == y);
}

Paul's avatar
Paul committed
30
int main(int argc, const char* argv[]) { test::run(argc, argv); }