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
f3f65985
Unverified
Commit
f3f65985
authored
Oct 07, 2023
by
tvukovic-amd
Committed by
GitHub
Oct 06, 2023
Browse files
Added fix for test_msgpack_float and test_msgpack_object (#2155)
parent
9316c007
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
test/msgpack.cpp
test/msgpack.cpp
+11
-8
No files found.
test/msgpack.cpp
View file @
f3f65985
...
...
@@ -97,9 +97,12 @@ TEST_CASE(test_msgpack_bool)
TEST_CASE
(
test_msgpack_float
)
{
migraphx
::
value
v
=
3.0
;
// changed all double values in this code to not end with .0 because on msgpack for Windows if
// input type is double and ends with .0 it could be converted to uint64_t or int64_t and the
// goal of these functions is to test double without conversions
migraphx
::
value
v
=
3.01
;
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
EXPECT
(
buffer
==
msgpack_buffer
(
3.0
));
EXPECT
(
buffer
==
msgpack_buffer
(
3.0
1
));
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
}
...
...
@@ -129,10 +132,10 @@ TEST_CASE(test_msgpack_empty_array)
TEST_CASE
(
test_msgpack_object
)
{
migraphx
::
value
v
=
{{
"one"
,
1.0
},
{
"three"
,
3.0
},
{
"two"
,
2.0
}};
migraphx
::
value
v
=
{{
"one"
,
1.0
1
},
{
"three"
,
3.0
1
},
{
"two"
,
2.0
1
}};
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
EXPECT
(
buffer
==
msgpack_buffer
(
std
::
map
<
std
::
string
,
double
>
{
{
"one"
,
1.0
},
{
"three"
,
3.0
},
{
"two"
,
2.0
}}));
{
"one"
,
1.0
1
},
{
"three"
,
3.0
1
},
{
"two"
,
2.0
1
}}));
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
}
...
...
@@ -157,17 +160,17 @@ struct foo
TEST_CASE
(
test_msgpack_object_class
)
{
migraphx
::
value
v
=
{{
"a"
,
1.0
},
{
"b"
,
"abc"
}};
migraphx
::
value
v
=
{{
"a"
,
1.0
1
},
{
"b"
,
"abc"
}};
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
EXPECT
(
buffer
==
msgpack_buffer
(
foo
{
1.0
,
"abc"
}));
EXPECT
(
buffer
==
msgpack_buffer
(
foo
{
1.0
1
,
"abc"
}));
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
}
TEST_CASE
(
test_msgpack_array_class
)
{
migraphx
::
value
v
=
{{{
"a"
,
1.0
},
{
"b"
,
"abc"
}},
{{
"a"
,
3.0
},
{
"b"
,
"xyz"
}}};
migraphx
::
value
v
=
{{{
"a"
,
1.0
1
},
{
"b"
,
"abc"
}},
{{
"a"
,
3.0
1
},
{
"b"
,
"xyz"
}}};
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
EXPECT
(
buffer
==
msgpack_buffer
(
std
::
vector
<
foo
>
{
foo
{
1.0
,
"abc"
},
foo
{
3.0
,
"xyz"
}}));
EXPECT
(
buffer
==
msgpack_buffer
(
std
::
vector
<
foo
>
{
foo
{
1.0
1
,
"abc"
},
foo
{
3.0
1
,
"xyz"
}}));
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
}
...
...
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