19 const std::string error =
"Uh ah an error!";
21 auto s = mp::UnPack<decltype(r)>(mp::Pack(r));
24 ASSERT_TRUE(s.HasError());
25 ASSERT_EQ(s.GetError().What(), error);
27 s = mp::UnPack<decltype(r)>(mp::Pack(r));
29 ASSERT_EQ(r.
Get(), 42);
30 ASSERT_FALSE(s.HasError());
31 ASSERT_EQ(s.Get(), 42);
33 s = mp::UnPack<decltype(r)>(mp::Pack(r));
37 ASSERT_EQ(s.GetError().What(), error);
39 auto sv = mp::UnPack<decltype(rv)>(mp::Pack(rv));
40 ASSERT_TRUE(rv.HasError());
41 ASSERT_TRUE(sv.HasError());
43 ASSERT_TRUE(er.HasError());
45 auto es = mp::UnPack<decltype(er)>(mp::Pack(er));
46 ASSERT_FALSE(er.HasError());
47 ASSERT_FALSE(es.HasError());
49 es = mp::UnPack<decltype(er)>(mp::Pack(er));
51 ASSERT_EQ(er.GetError().What(), error);
53 ASSERT_EQ(es.GetError().What(), error);
65 auto buffer = c::MsgPack::Pack(actor);
66 auto result = c::MsgPack::UnPack<Actor>(buffer);
68 ASSERT_EQ(result.id, actor.
id);
77 boost::variant2::variant<bool, float, std::string> var;
80 auto result = mp::UnPack<decltype(var)>(mp::Pack(var));
81 ASSERT_EQ(result.index(), 0);
82 ASSERT_EQ(boost::variant2::get<bool>(result),
true);
85 result = mp::UnPack<decltype(var)>(mp::Pack(var));
86 ASSERT_EQ(result.index(), 1);
87 ASSERT_EQ(boost::variant2::get<float>(result), 42.0f);
89 var = std::string(
"hola!");
90 result = mp::UnPack<decltype(var)>(mp::Pack(var));
91 ASSERT_EQ(result.index(), 2);
92 ASSERT_EQ(boost::variant2::get<std::string>(result),
"hola!");
98 boost::optional<float> var;
100 auto result = mp::UnPack<decltype(var)>(mp::Pack(var));
101 ASSERT_FALSE(result.has_value());
104 result = mp::UnPack<decltype(var)>(mp::Pack(var));
105 ASSERT_TRUE(result.has_value());
106 ASSERT_EQ(*result, 42.0f);
void Reset(TValue &&value)
This file contains definitions of common data structures used in traffic manager. ...
ActorDescription description
geom::BoundingBox bounding_box
void SetError(Ts &&... args)
const std::string & What() const
const error_type & GetError() const