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
ac8ed940
"git@developer.sourcefind.cn:dadigang/Ventoy.git" did not exist on "db892d5e12fd7eeef70736d3f03f35a2a4d09297"
Commit
ac8ed940
authored
Aug 11, 2023
by
Tijana Vukovic
Committed by
Artur Wojcik
Aug 17, 2023
Browse files
Fixed msgpack float and map test issues
parent
0d2c9f49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
test/msgpack.cpp
test/msgpack.cpp
+8
-2
No files found.
test/msgpack.cpp
View file @
ac8ed940
...
@@ -76,7 +76,7 @@ TEST_CASE(test_msgpack_float)
...
@@ -76,7 +76,7 @@ TEST_CASE(test_msgpack_float)
migraphx
::
value
v
=
3.0
;
migraphx
::
value
v
=
3.0
;
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
EXPECT
(
buffer
==
msgpack_buffer
(
3.0
));
EXPECT
(
buffer
==
msgpack_buffer
(
3.0
));
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
.
to
<
float
>
()
==
v
.
to
<
float
>
()
);
}
}
TEST_CASE
(
test_msgpack_string
)
TEST_CASE
(
test_msgpack_string
)
...
@@ -109,7 +109,11 @@ TEST_CASE(test_msgpack_object)
...
@@ -109,7 +109,11 @@ TEST_CASE(test_msgpack_object)
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
EXPECT
(
buffer
==
msgpack_buffer
(
std
::
map
<
std
::
string
,
double
>
{
EXPECT
(
buffer
==
msgpack_buffer
(
std
::
map
<
std
::
string
,
double
>
{
{
"one"
,
1.0
},
{
"three"
,
3.0
},
{
"two"
,
2.0
}}));
{
"one"
,
1.0
},
{
"three"
,
3.0
},
{
"two"
,
2.0
}}));
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
// converted to vector in the following line because in value.cpp value constructor with
// unordered map is creating vector<value> with map items as vector elements
// value(std::vector<value>(m.begin(), m.end()), false)
EXPECT
(
migraphx
::
from_msgpack
(
buffer
).
to_vector
<
double
>
()
==
v
.
to_vector
<
double
>
());
}
}
TEST_CASE
(
test_msgpack_empty_object
)
TEST_CASE
(
test_msgpack_empty_object
)
...
@@ -136,6 +140,7 @@ TEST_CASE(test_msgpack_object_class)
...
@@ -136,6 +140,7 @@ TEST_CASE(test_msgpack_object_class)
migraphx
::
value
v
=
{{
"a"
,
1.0
},
{
"b"
,
"abc"
}};
migraphx
::
value
v
=
{{
"a"
,
1.0
},
{
"b"
,
"abc"
}};
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
EXPECT
(
buffer
==
msgpack_buffer
(
foo
{
1.0
,
"abc"
}));
EXPECT
(
buffer
==
msgpack_buffer
(
foo
{
1.0
,
"abc"
}));
// TODO: here need to change how to convert value to foo object
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
}
}
...
@@ -144,6 +149,7 @@ TEST_CASE(test_msgpack_array_class)
...
@@ -144,6 +149,7 @@ 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
},
{
"b"
,
"abc"
}},
{{
"a"
,
3.0
},
{
"b"
,
"xyz"
}}};
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
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
,
"abc"
},
foo
{
3.0
,
"xyz"
}}));
// TODO: here need to change how to convert value to foo vector
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
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