1 #include "helper.hpp"
2 
3 #include "ipmi.hpp"
4 
5 #include <ipmid/api-types.hpp>
6 #include <optional>
7 #include <span>
8 #include <tuple>
9 #include <utility>
10 #include <vector>
11 
12 #include <gtest/gtest.h>
13 
14 namespace blobs
15 {
16 std::vector<std::uint8_t>
17     validateReply(ipmi::RspType<std::vector<uint8_t>> reply, bool hasData)
18 {
19     // Reply is in the form of
20     // std::tuple<ipmi::Cc, std::optional<std::tuple<RetTypes...>>>
21     EXPECT_EQ(::ipmi::ccSuccess, std::get<0>(reply));
22 
23     auto actualReply = std::get<1>(reply);
24     EXPECT_TRUE(actualReply.has_value());
25 
26     auto data = std::get<0>(*actualReply);
27     EXPECT_EQ(hasData, !data.empty());
28 
29     return hasData ? data : std::vector<uint8_t>{};
30 }
31 
32 } // namespace blobs
33