Commit 661a6bbc authored by Paul's avatar Paul
Browse files

Some fixes for the unit tests

parent 9564b809
...@@ -27,11 +27,28 @@ ...@@ -27,11 +27,28 @@
#include <map> #include <map>
#include "test.hpp" #include "test.hpp"
template<class T>
auto msgpack_type(migraphx::rank<0>, T src)
{
if constexpr(std::is_class<T>{})
return std::vector<T>{src};
else
return src;
}
template<class T>
auto msgpack_type(migraphx::rank<1>, const T& src) -> decltype(src.empty(), std::vector<T>{})
{
if(src.empty())
return {};
return {src};
}
template <class T> template <class T>
std::vector<char> msgpack_buffer(const T& src) std::vector<char> msgpack_buffer(const T& src)
{ {
std::stringstream buffer; std::stringstream buffer;
msgpack::pack(buffer, src); msgpack::pack(buffer, msgpack_type(migraphx::rank<2>{}, src));
buffer.seekg(0); buffer.seekg(0);
std::string str = buffer.str(); std::string str = buffer.str();
return std::vector<char>(str.data(), str.data() + str.size()); // NOLINT return std::vector<char>(str.data(), str.data() + str.size()); // NOLINT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment