Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
6c7565dc
Commit
6c7565dc
authored
Jan 16, 2019
by
Paul
Browse files
Add tests for finalize
parent
875bb4f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
test/operation.cpp
test/operation.cpp
+62
-0
No files found.
test/operation.cpp
View file @
6c7565dc
...
...
@@ -103,4 +103,66 @@ TEST_CASE(operation_default_print)
EXPECT
(
s
==
"simple"
);
}
struct
final_operation
{
std
::
string
name
()
const
{
return
"final"
;
}
migraphx
::
shape
compute_shape
(
const
std
::
vector
<
migraphx
::
shape
>&
)
const
{
MIGRAPHX_THROW
(
"not computable"
);
}
void
finalize
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
const
std
::
vector
<
migraphx
::
shape
>&
)
const
{}
};
struct
final_operation_throw
{
std
::
string
name
()
const
{
return
"final"
;
}
migraphx
::
shape
compute_shape
(
const
std
::
vector
<
migraphx
::
shape
>&
)
const
{
MIGRAPHX_THROW
(
"not computable"
);
}
[[
gnu
::
noreturn
]]
void
finalize
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
const
std
::
vector
<
migraphx
::
shape
>&
)
const
{
MIGRAPHX_THROW
(
"finalize"
);
}
};
TEST_CASE
(
check_has_finalize_simple
)
{
migraphx
::
operation
op
=
simple_operation
{};
EXPECT
(
not
migraphx
::
has_finalize
(
op
));
}
TEST_CASE
(
check_has_finalize
)
{
migraphx
::
operation
op
=
final_operation
{};
EXPECT
(
migraphx
::
has_finalize
(
op
));
}
TEST_CASE
(
check_run_finalize
)
{
migraphx
::
operation
op
=
final_operation
{};
migraphx
::
context
ctx
{};
op
.
finalize
(
ctx
,
{},
{});
}
TEST_CASE
(
check_run_finalize_simple
)
{
migraphx
::
operation
op
=
simple_operation
{};
migraphx
::
context
ctx
{};
op
.
finalize
(
ctx
,
{},
{});
}
TEST_CASE
(
check_run_finalize_throw
)
{
migraphx
::
operation
op
=
final_operation_throw
{};
migraphx
::
context
ctx
{};
EXPECT
(
test
::
throws
([
&
]{
op
.
finalize
(
ctx
,
{},
{});
}));
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment