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
552a144a
Commit
552a144a
authored
Nov 06, 2018
by
Paul
Browse files
Formatting
parent
9b3bc656
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
test/include/test.hpp
test/include/test.hpp
+11
-14
No files found.
test/include/test.hpp
View file @
552a144a
...
...
@@ -193,10 +193,7 @@ inline void add_test_case(std::string name, std::function<void()> f)
struct
auto_register
{
auto_register
(
std
::
string
name
,
std
::
function
<
void
()
>
f
)
{
add_test_case
(
name
,
f
);
}
auto_register
(
std
::
string
name
,
std
::
function
<
void
()
>
f
)
{
add_test_case
(
name
,
f
);
}
};
inline
void
run_test_case
(
std
::
string
name
,
std
::
function
<
void
()
>
f
)
...
...
@@ -210,19 +207,18 @@ inline void run(int argc, const char* argv[])
{
std
::
vector
<
std
::
string
>
as
(
argv
+
1
,
argv
+
argc
);
auto
args
=
parse
(
as
,
[](
auto
&&
)
->
std
::
vector
<
std
::
string
>
{
return
{};
});
auto
args
=
parse
(
as
,
[](
auto
&&
)
->
std
::
vector
<
std
::
string
>
{
return
{};
});
auto
cases
=
args
[
""
];
if
(
cases
.
empty
())
{
for
(
auto
&&
tc
:
get_test_cases
())
for
(
auto
&&
tc
:
get_test_cases
())
run_test_case
(
tc
.
first
,
tc
.
second
);
}
else
{
std
::
unordered_map
<
std
::
string
,
std
::
function
<
void
()
>>
m
(
get_test_cases
().
begin
(),
get_test_cases
().
end
());
for
(
auto
&&
name
:
cases
)
std
::
unordered_map
<
std
::
string
,
std
::
function
<
void
()
>>
m
(
get_test_cases
().
begin
(),
get_test_cases
().
end
());
for
(
auto
&&
name
:
cases
)
run_test_case
(
name
,
m
[
name
]);
}
}
...
...
@@ -245,10 +241,11 @@ inline void run(int argc, const char* argv[])
// NOLINTNEXTLINE
#define STATUS(...) EXPECT((__VA_ARGS__) == 0)
#define TEST_CASE(...) \
void __VA_ARGS__ (); \
static test::auto_register __VA_ARGS__ ## _register = test::auto_register(#__VA_ARGS__, &__VA_ARGS__); \
void __VA_ARGS__ ()
#define TEST_CASE(...) \
void __VA_ARGS__(); \
static test::auto_register __VA_ARGS__##_register = \
test::auto_register(#__VA_ARGS__, &__VA_ARGS__); \
void __VA_ARGS__()
#ifdef __clang__
#pragma clang diagnostic push
...
...
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