blob: faa4d90c8a7bb685b9889401dde1f5c40b8d5330 [file] [log] [blame]
Deepak Kodihalli1b24f972019-02-01 04:09:13 -06001#include <string.h>
2
3#include <array>
4
5#include "libpldm/base.h"
6
7#include <gtest/gtest.h>
8
Tom Joseph41251042019-02-07 16:17:07 +05309TEST(PackPLDMMessage, BadPathTest)
10{
11 struct pldm_header_info hdr;
12 struct pldm_header_info* hdr_ptr = NULL;
13 pldm_msg_hdr msg{};
14
15 // PLDM header information pointer is NULL
16 auto rc = pack_pldm_header(hdr_ptr, &msg);
17 ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
18
19 // PLDM message pointer is NULL
20 rc = pack_pldm_header(&hdr, nullptr);
21 ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
22
23 // PLDM header information pointer and PLDM message pointer is NULL
24 rc = pack_pldm_header(hdr_ptr, nullptr);
25 ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
26
27 // RESERVED message type
28 hdr.msg_type = PLDM_RESERVED;
29 rc = pack_pldm_header(&hdr, &msg);
30 ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
31
32 // Instance ID out of range
33 hdr.msg_type = PLDM_REQUEST;
34 hdr.instance = 32;
35 rc = pack_pldm_header(&hdr, &msg);
36 ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
37
38 // PLDM type out of range
39 hdr.msg_type = PLDM_REQUEST;
40 hdr.instance = 31;
41 hdr.pldm_type = 64;
42 rc = pack_pldm_header(&hdr, &msg);
43 ASSERT_EQ(rc, PLDM_ERROR_INVALID_PLDM_TYPE);
44}
45
46TEST(PackPLDMMessage, RequestMessageGoodPath)
47{
48 struct pldm_header_info hdr;
49 pldm_msg_hdr msg{};
50
51 // Message type is REQUEST and lower range of the field values
52 hdr.msg_type = PLDM_REQUEST;
53 hdr.instance = 0;
54 hdr.pldm_type = 0;
55 hdr.command = 0;
56
57 auto rc = pack_pldm_header(&hdr, &msg);
58 ASSERT_EQ(rc, PLDM_SUCCESS);
59 ASSERT_EQ(msg.request, 1);
60 ASSERT_EQ(msg.datagram, 0);
61 ASSERT_EQ(msg.instance_id, 0);
62 ASSERT_EQ(msg.type, 0);
63 ASSERT_EQ(msg.command, 0);
64
65 // Message type is REQUEST and upper range of the field values
66 hdr.instance = 31;
67 hdr.pldm_type = 63;
68 hdr.command = 255;
69
70 rc = pack_pldm_header(&hdr, &msg);
71 ASSERT_EQ(rc, PLDM_SUCCESS);
72 ASSERT_EQ(msg.request, 1);
73 ASSERT_EQ(msg.datagram, 0);
74 ASSERT_EQ(msg.instance_id, 31);
75 ASSERT_EQ(msg.type, 63);
76 ASSERT_EQ(msg.command, 255);
77
78 // Message type is PLDM_ASYNC_REQUEST_NOTIFY
79 hdr.msg_type = PLDM_ASYNC_REQUEST_NOTIFY;
80
81 rc = pack_pldm_header(&hdr, &msg);
82 ASSERT_EQ(rc, PLDM_SUCCESS);
83 ASSERT_EQ(msg.request, 1);
84 ASSERT_EQ(msg.datagram, 1);
85 ASSERT_EQ(msg.instance_id, 31);
86 ASSERT_EQ(msg.type, 63);
87 ASSERT_EQ(msg.command, 255);
88}
89
90TEST(PackPLDMMessage, ResponseMessageGoodPath)
91{
92 struct pldm_header_info hdr;
93 pldm_msg_hdr msg{};
94
95 // Message type is PLDM_RESPONSE and lower range of the field values
96 hdr.msg_type = PLDM_RESPONSE;
97 hdr.instance = 0;
98 hdr.pldm_type = 0;
99 hdr.command = 0;
100
101 auto rc = pack_pldm_header(&hdr, &msg);
102 ASSERT_EQ(rc, PLDM_SUCCESS);
103 ASSERT_EQ(msg.request, 0);
104 ASSERT_EQ(msg.datagram, 0);
105 ASSERT_EQ(msg.instance_id, 0);
106 ASSERT_EQ(msg.type, 0);
107 ASSERT_EQ(msg.command, 0);
108
109 // Message type is PLDM_RESPONSE and upper range of the field values
110 hdr.instance = 31;
111 hdr.pldm_type = 63;
112 hdr.command = 255;
113
114 rc = pack_pldm_header(&hdr, &msg);
115 ASSERT_EQ(rc, PLDM_SUCCESS);
116 ASSERT_EQ(msg.request, 0);
117 ASSERT_EQ(msg.datagram, 0);
118 ASSERT_EQ(msg.instance_id, 31);
119 ASSERT_EQ(msg.type, 63);
120 ASSERT_EQ(msg.command, 255);
121}
122
123TEST(UnpackPLDMMessage, BadPathTest)
124{
125 struct pldm_header_info hdr;
126
127 // PLDM message pointer is NULL
128 auto rc = unpack_pldm_header(nullptr, &hdr);
129 ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
130}
131
132TEST(UnpackPLDMMessage, RequestMessageGoodPath)
133{
134 struct pldm_header_info hdr;
135 pldm_msg_hdr msg{};
136
137 // Unpack PLDM request message and lower range of field values
138 msg.request = 1;
139 auto rc = unpack_pldm_header(&msg, &hdr);
140 ASSERT_EQ(rc, PLDM_SUCCESS);
141 ASSERT_EQ(hdr.msg_type, PLDM_REQUEST);
142 ASSERT_EQ(hdr.instance, 0);
143 ASSERT_EQ(hdr.pldm_type, 0);
144 ASSERT_EQ(hdr.command, 0);
145
146 // Unpack PLDM async request message and lower range of field values
147 msg.datagram = 1;
148 rc = unpack_pldm_header(&msg, &hdr);
149 ASSERT_EQ(rc, PLDM_SUCCESS);
150 ASSERT_EQ(hdr.msg_type, PLDM_ASYNC_REQUEST_NOTIFY);
151
152 // Unpack PLDM request message and upper range of field values
153 msg.datagram = 0;
154 msg.instance_id = 31;
155 msg.type = 63;
156 msg.command = 255;
157 rc = unpack_pldm_header(&msg, &hdr);
158 ASSERT_EQ(rc, PLDM_SUCCESS);
159 ASSERT_EQ(hdr.msg_type, PLDM_REQUEST);
160 ASSERT_EQ(hdr.instance, 31);
161 ASSERT_EQ(hdr.pldm_type, 63);
162 ASSERT_EQ(hdr.command, 255);
163}
164
165TEST(UnpackPLDMMessage, ResponseMessageGoodPath)
166{
167 struct pldm_header_info hdr;
168 pldm_msg_hdr msg{};
169
170 // Unpack PLDM response message and lower range of field values
171 auto rc = unpack_pldm_header(&msg, &hdr);
172 ASSERT_EQ(rc, PLDM_SUCCESS);
173 ASSERT_EQ(hdr.msg_type, PLDM_RESPONSE);
174 ASSERT_EQ(hdr.instance, 0);
175 ASSERT_EQ(hdr.pldm_type, 0);
176 ASSERT_EQ(hdr.command, 0);
177
178 // Unpack PLDM response message and upper range of field values
179 msg.instance_id = 31;
180 msg.type = 63;
181 msg.command = 255;
182 rc = unpack_pldm_header(&msg, &hdr);
183 ASSERT_EQ(rc, PLDM_SUCCESS);
184 ASSERT_EQ(hdr.msg_type, PLDM_RESPONSE);
185 ASSERT_EQ(hdr.instance, 31);
186 ASSERT_EQ(hdr.pldm_type, 63);
187 ASSERT_EQ(hdr.command, 255);
188}
189
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600190TEST(GetPLDMCommands, testEncodeRequest)
191{
192 uint8_t pldmType = 0x05;
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600193 ver32_t version{0xFF, 0xFF, 0xFF, 0xFF};
vkaverapa6575b82019-04-03 05:33:52 -0500194 std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_COMMANDS_REQ_BYTES>
195 requestMsg{};
196 auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600197
vkaverapa6575b82019-04-03 05:33:52 -0500198 auto rc = encode_get_commands_req(0, pldmType, version, request);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600199 ASSERT_EQ(rc, PLDM_SUCCESS);
vkaverapa6575b82019-04-03 05:33:52 -0500200 ASSERT_EQ(0, memcmp(request->payload, &pldmType, sizeof(pldmType)));
201 ASSERT_EQ(0, memcmp(request->payload + sizeof(pldmType), &version,
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600202 sizeof(version)));
203}
204
205TEST(GetPLDMCommands, testDecodeRequest)
206{
207 uint8_t pldmType = 0x05;
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600208 ver32_t version{0xFF, 0xFF, 0xFF, 0xFF};
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600209 uint8_t pldmTypeOut{};
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600210 ver32_t versionOut{0xFF, 0xFF, 0xFF, 0xFF};
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600211 std::array<uint8_t, PLDM_GET_COMMANDS_REQ_BYTES> requestMsg{};
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600212
vkaverapa6575b82019-04-03 05:33:52 -0500213 memcpy(requestMsg.data(), &pldmType, sizeof(pldmType));
214 memcpy(requestMsg.data() + sizeof(pldmType), &version, sizeof(version));
215 auto rc = decode_get_commands_req(requestMsg.data(), requestMsg.size(),
216 &pldmTypeOut, &versionOut);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600217 ASSERT_EQ(rc, PLDM_SUCCESS);
218 ASSERT_EQ(pldmTypeOut, pldmType);
219 ASSERT_EQ(0, memcmp(&versionOut, &version, sizeof(version)));
220}
221
222TEST(GetPLDMCommands, testEncodeResponse)
223{
224 uint8_t completionCode = 0;
vkaverapa6575b82019-04-03 05:33:52 -0500225 std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_COMMANDS_RESP_BYTES>
226 responseMsg{};
227 auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600228 std::array<bitfield8_t, PLDM_MAX_CMDS_PER_TYPE / 8> commands{};
229 commands[0].byte = 1;
230 commands[1].byte = 2;
231 commands[2].byte = 3;
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600232
233 auto rc =
vkaverapa6575b82019-04-03 05:33:52 -0500234 encode_get_commands_resp(0, PLDM_SUCCESS, commands.data(), response);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600235 ASSERT_EQ(rc, PLDM_SUCCESS);
vkaverapa6575b82019-04-03 05:33:52 -0500236 uint8_t* payload_ptr = response->payload;
237 ASSERT_EQ(completionCode, payload_ptr[0]);
238 ASSERT_EQ(1, payload_ptr[sizeof(completionCode)]);
239 ASSERT_EQ(2,
240 payload_ptr[sizeof(completionCode) + sizeof(commands[0].byte)]);
241 ASSERT_EQ(3, payload_ptr[sizeof(completionCode) + sizeof(commands[0].byte) +
242 sizeof(commands[1].byte)]);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600243}
244
245TEST(GetPLDMTypes, testEncodeResponse)
246{
247 uint8_t completionCode = 0;
vkaverapa6575b82019-04-03 05:33:52 -0500248 std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_TYPES_RESP_BYTES>
249 responseMsg{};
250 auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600251 std::array<bitfield8_t, PLDM_MAX_TYPES / 8> types{};
252 types[0].byte = 1;
253 types[1].byte = 2;
254 types[2].byte = 3;
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600255
vkaverapa6575b82019-04-03 05:33:52 -0500256 auto rc = encode_get_types_resp(0, PLDM_SUCCESS, types.data(), response);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600257 ASSERT_EQ(rc, PLDM_SUCCESS);
vkaverapa6575b82019-04-03 05:33:52 -0500258 uint8_t* payload_ptr = response->payload;
259 ASSERT_EQ(completionCode, payload_ptr[0]);
260 ASSERT_EQ(1, payload_ptr[sizeof(completionCode)]);
261 ASSERT_EQ(2, payload_ptr[sizeof(completionCode) + sizeof(types[0].byte)]);
262 ASSERT_EQ(3, payload_ptr[sizeof(completionCode) + sizeof(types[0].byte) +
263 sizeof(types[1].byte)]);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600264}
265
266TEST(GetPLDMTypes, testDecodeResponse)
267{
268 std::array<uint8_t, PLDM_GET_TYPES_RESP_BYTES> responseMsg{};
vkaverapa6575b82019-04-03 05:33:52 -0500269 responseMsg[1] = 1;
270 responseMsg[2] = 2;
271 responseMsg[3] = 3;
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600272 std::array<bitfield8_t, PLDM_MAX_TYPES / 8> outTypes{};
Deepak Kodihalli8c643462019-02-21 10:43:36 -0600273 uint8_t completion_code;
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600274
vkaverapa6575b82019-04-03 05:33:52 -0500275 auto rc = decode_get_types_resp(responseMsg.data(), responseMsg.size(),
276 &completion_code, outTypes.data());
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600277
278 ASSERT_EQ(rc, PLDM_SUCCESS);
Deepak Kodihalli8c643462019-02-21 10:43:36 -0600279 ASSERT_EQ(completion_code, PLDM_SUCCESS);
vkaverapa6575b82019-04-03 05:33:52 -0500280 ASSERT_EQ(responseMsg[1], outTypes[0].byte);
281 ASSERT_EQ(responseMsg[2], outTypes[1].byte);
282 ASSERT_EQ(responseMsg[3], outTypes[2].byte);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600283}
284
285TEST(GetPLDMCommands, testDecodeResponse)
286{
vkaverapa6575b82019-04-03 05:33:52 -0500287 std::array<uint8_t, PLDM_GET_COMMANDS_RESP_BYTES> responseMsg{};
288 responseMsg[1] = 1;
289 responseMsg[2] = 2;
290 responseMsg[3] = 3;
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600291 std::array<bitfield8_t, PLDM_MAX_CMDS_PER_TYPE / 8> outTypes{};
Deepak Kodihalli8c643462019-02-21 10:43:36 -0600292 uint8_t completion_code;
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600293
vkaverapa6575b82019-04-03 05:33:52 -0500294 auto rc = decode_get_commands_resp(responseMsg.data(), responseMsg.size(),
295 &completion_code, outTypes.data());
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600296
297 ASSERT_EQ(rc, PLDM_SUCCESS);
Deepak Kodihalli8c643462019-02-21 10:43:36 -0600298 ASSERT_EQ(completion_code, PLDM_SUCCESS);
vkaverapa6575b82019-04-03 05:33:52 -0500299 ASSERT_EQ(responseMsg[1], outTypes[0].byte);
300 ASSERT_EQ(responseMsg[2], outTypes[1].byte);
301 ASSERT_EQ(responseMsg[3], outTypes[2].byte);
Deepak Kodihalli1b24f972019-02-01 04:09:13 -0600302}
Sampa Misra432e1872019-02-13 03:49:43 -0600303
Sampa Misra94d704b2019-02-22 03:36:02 -0600304TEST(GetPLDMVersion, testGoodEncodeRequest)
Sampa Misra432e1872019-02-13 03:49:43 -0600305{
vkaverapa6575b82019-04-03 05:33:52 -0500306 std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_VERSION_REQ_BYTES>
307 requestMsg{};
308 auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
Sampa Misra432e1872019-02-13 03:49:43 -0600309 uint8_t pldmType = 0x03;
310 uint32_t transferHandle = 0x0;
311 uint8_t opFlag = 0x01;
312
313 auto rc =
vkaverapa6575b82019-04-03 05:33:52 -0500314 encode_get_version_req(0, transferHandle, opFlag, pldmType, request);
Sampa Misra432e1872019-02-13 03:49:43 -0600315 ASSERT_EQ(rc, PLDM_SUCCESS);
vkaverapa6575b82019-04-03 05:33:52 -0500316 ASSERT_EQ(
317 0, memcmp(request->payload, &transferHandle, sizeof(transferHandle)));
318 ASSERT_EQ(0, memcmp(request->payload + sizeof(transferHandle), &opFlag,
Sampa Misra432e1872019-02-13 03:49:43 -0600319 sizeof(opFlag)));
vkaverapa6575b82019-04-03 05:33:52 -0500320 ASSERT_EQ(0,
321 memcmp(request->payload + sizeof(transferHandle) + sizeof(opFlag),
322 &pldmType, sizeof(pldmType)));
Sampa Misra432e1872019-02-13 03:49:43 -0600323}
324
Sampa Misra94d704b2019-02-22 03:36:02 -0600325TEST(GetPLDMVersion, testBadEncodeRequest)
326{
327 uint8_t pldmType = 0x03;
328 uint32_t transferHandle = 0x0;
329 uint8_t opFlag = 0x01;
330
331 auto rc =
332 encode_get_version_req(0, transferHandle, opFlag, pldmType, nullptr);
333
334 ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
335}
336
Sampa Misra432e1872019-02-13 03:49:43 -0600337TEST(GetPLDMVersion, testEncodeResponse)
338{
Sampa Misra432e1872019-02-13 03:49:43 -0600339 uint8_t completionCode = 0;
340 uint32_t transferHandle = 0;
341 uint8_t flag = PLDM_START_AND_END;
vkaverapa6575b82019-04-03 05:33:52 -0500342 std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_VERSION_RESP_BYTES>
343 responseMsg{};
344 auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600345 ver32_t version = {0xFF, 0xFF, 0xFF, 0xFF};
Sampa Misra432e1872019-02-13 03:49:43 -0600346
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600347 auto rc = encode_get_version_resp(0, PLDM_SUCCESS, 0, PLDM_START_AND_END,
vkaverapa6575b82019-04-03 05:33:52 -0500348 &version, sizeof(ver32_t), response);
Sampa Misra432e1872019-02-13 03:49:43 -0600349
350 ASSERT_EQ(rc, PLDM_SUCCESS);
vkaverapa6575b82019-04-03 05:33:52 -0500351 ASSERT_EQ(completionCode, response->payload[0]);
352 ASSERT_EQ(0, memcmp(response->payload + sizeof(response->payload[0]),
353 &transferHandle, sizeof(transferHandle)));
354 ASSERT_EQ(0, memcmp(response->payload + sizeof(response->payload[0]) +
355 sizeof(transferHandle),
356 &flag, sizeof(flag)));
357 ASSERT_EQ(0, memcmp(response->payload + sizeof(response->payload[0]) +
358 sizeof(transferHandle) + sizeof(flag),
359 &version, sizeof(version)));
Sampa Misra432e1872019-02-13 03:49:43 -0600360}
361
362TEST(GetPLDMVersion, testDecodeRequest)
363{
364 std::array<uint8_t, PLDM_GET_VERSION_REQ_BYTES> requestMsg{};
Sampa Misra432e1872019-02-13 03:49:43 -0600365 uint32_t transferHandle = 0x0;
366 uint32_t retTransferHandle = 0x0;
367 uint8_t flag = PLDM_GET_FIRSTPART;
368 uint8_t retFlag = PLDM_GET_FIRSTPART;
369 uint8_t pldmType = PLDM_BASE;
370 uint8_t retType = PLDM_BASE;
371
vkaverapa6575b82019-04-03 05:33:52 -0500372 memcpy(requestMsg.data(), &transferHandle, sizeof(transferHandle));
373 memcpy(requestMsg.data() + sizeof(transferHandle), &flag, sizeof(flag));
374 memcpy(requestMsg.data() + sizeof(transferHandle) + sizeof(flag), &pldmType,
Sampa Misra432e1872019-02-13 03:49:43 -0600375 sizeof(pldmType));
376
vkaverapa6575b82019-04-03 05:33:52 -0500377 auto rc = decode_get_version_req(requestMsg.data(), requestMsg.size(),
378 &retTransferHandle, &retFlag, &retType);
Sampa Misra432e1872019-02-13 03:49:43 -0600379
380 ASSERT_EQ(rc, PLDM_SUCCESS);
381 ASSERT_EQ(transferHandle, retTransferHandle);
382 ASSERT_EQ(flag, retFlag);
383 ASSERT_EQ(pldmType, retType);
384}
385
386TEST(GetPLDMVersion, testDecodeResponse)
387{
388 std::array<uint8_t, PLDM_GET_VERSION_RESP_BYTES> responseMsg{};
Sampa Misra432e1872019-02-13 03:49:43 -0600389 uint32_t transferHandle = 0x0;
390 uint32_t retTransferHandle = 0x0;
391 uint8_t flag = PLDM_START_AND_END;
392 uint8_t retFlag = PLDM_START_AND_END;
393 uint8_t completionCode = 0;
Deepak Kodihalli97e0bd52019-02-21 03:54:22 -0600394 ver32_t version = {0xFF, 0xFF, 0xFF, 0xFF};
395 ver32_t versionOut;
Deepak Kodihalli8c643462019-02-21 10:43:36 -0600396 uint8_t completion_code;
Sampa Misra432e1872019-02-13 03:49:43 -0600397
vkaverapa6575b82019-04-03 05:33:52 -0500398 memcpy(responseMsg.data() + sizeof(completionCode), &transferHandle,
Sampa Misra432e1872019-02-13 03:49:43 -0600399 sizeof(transferHandle));
vkaverapa6575b82019-04-03 05:33:52 -0500400 memcpy(responseMsg.data() + sizeof(completionCode) + sizeof(transferHandle),
Sampa Misra432e1872019-02-13 03:49:43 -0600401 &flag, sizeof(flag));
vkaverapa6575b82019-04-03 05:33:52 -0500402 memcpy(responseMsg.data() + sizeof(completionCode) +
403 sizeof(transferHandle) + sizeof(flag),
Sampa Misra432e1872019-02-13 03:49:43 -0600404 &version, sizeof(version));
405
vkaverapa6575b82019-04-03 05:33:52 -0500406 auto rc = decode_get_version_resp(responseMsg.data(), responseMsg.size(),
407 &completion_code, &retTransferHandle,
408 &retFlag, &versionOut);
Sampa Misra432e1872019-02-13 03:49:43 -0600409 ASSERT_EQ(rc, PLDM_SUCCESS);
410 ASSERT_EQ(transferHandle, retTransferHandle);
411 ASSERT_EQ(flag, retFlag);
412
413 ASSERT_EQ(versionOut.major, version.major);
414 ASSERT_EQ(versionOut.minor, version.minor);
415 ASSERT_EQ(versionOut.update, version.update);
416 ASSERT_EQ(versionOut.alpha, version.alpha);
417}