| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 1 | #include "utils.hpp" | 
|  | 2 |  | 
| Pavithra Barithaya | 0f74c98 | 2020-04-27 02:17:10 -0500 | [diff] [blame] | 3 | #include "libpldm/platform.h" | 
|  | 4 |  | 
| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 5 | #include <gtest/gtest.h> | 
|  | 6 |  | 
|  | 7 | using namespace pldm::utils; | 
|  | 8 |  | 
|  | 9 | TEST(decodeDate, testGooduintToDate) | 
|  | 10 | { | 
|  | 11 | uint64_t data = 20191212115959; | 
|  | 12 | uint16_t year = 2019; | 
|  | 13 | uint8_t month = 12; | 
|  | 14 | uint8_t day = 12; | 
|  | 15 | uint8_t hours = 11; | 
|  | 16 | uint8_t minutes = 59; | 
|  | 17 | uint8_t seconds = 59; | 
|  | 18 |  | 
|  | 19 | uint16_t retyear = 0; | 
|  | 20 | uint8_t retmonth = 0; | 
|  | 21 | uint8_t retday = 0; | 
|  | 22 | uint8_t rethours = 0; | 
|  | 23 | uint8_t retminutes = 0; | 
|  | 24 | uint8_t retseconds = 0; | 
|  | 25 |  | 
|  | 26 | auto ret = uintToDate(data, &retyear, &retmonth, &retday, &rethours, | 
|  | 27 | &retminutes, &retseconds); | 
|  | 28 |  | 
|  | 29 | EXPECT_EQ(ret, true); | 
|  | 30 | EXPECT_EQ(year, retyear); | 
|  | 31 | EXPECT_EQ(month, retmonth); | 
|  | 32 | EXPECT_EQ(day, retday); | 
|  | 33 | EXPECT_EQ(hours, rethours); | 
|  | 34 | EXPECT_EQ(minutes, retminutes); | 
|  | 35 | EXPECT_EQ(seconds, retseconds); | 
|  | 36 | } | 
|  | 37 |  | 
|  | 38 | TEST(decodeDate, testBaduintToDate) | 
|  | 39 | { | 
|  | 40 | uint64_t data = 10191212115959; | 
|  | 41 |  | 
|  | 42 | uint16_t retyear = 0; | 
|  | 43 | uint8_t retmonth = 0; | 
|  | 44 | uint8_t retday = 0; | 
|  | 45 | uint8_t rethours = 0; | 
|  | 46 | uint8_t retminutes = 0; | 
|  | 47 | uint8_t retseconds = 0; | 
|  | 48 |  | 
|  | 49 | auto ret = uintToDate(data, &retyear, &retmonth, &retday, &rethours, | 
|  | 50 | &retminutes, &retseconds); | 
|  | 51 |  | 
|  | 52 | EXPECT_EQ(ret, false); | 
|  | 53 | } | 
|  | 54 |  | 
| George Liu | ba4c1fb | 2020-02-05 14:13:30 +0800 | [diff] [blame] | 55 | TEST(parseEffecterData, testGoodDecodeEffecterData) | 
| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 56 | { | 
| George Liu | ba4c1fb | 2020-02-05 14:13:30 +0800 | [diff] [blame] | 57 | std::vector<uint8_t> effecterData = {1, 1, 0, 1}; | 
|  | 58 | uint8_t effecterCount = 2; | 
| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 59 | set_effecter_state_field stateField0 = {1, 1}; | 
| George Liu | ba4c1fb | 2020-02-05 14:13:30 +0800 | [diff] [blame] | 60 | set_effecter_state_field stateField1 = {0, 1}; | 
| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 61 |  | 
| George Liu | ba4c1fb | 2020-02-05 14:13:30 +0800 | [diff] [blame] | 62 | auto effecterField = parseEffecterData(effecterData, effecterCount); | 
|  | 63 | EXPECT_NE(effecterField, std::nullopt); | 
|  | 64 | EXPECT_EQ(effecterCount, effecterField->size()); | 
| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 65 |  | 
| George Liu | ba4c1fb | 2020-02-05 14:13:30 +0800 | [diff] [blame] | 66 | std::vector<set_effecter_state_field> stateField = effecterField.value(); | 
| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 67 | EXPECT_EQ(stateField[0].set_request, stateField0.set_request); | 
|  | 68 | EXPECT_EQ(stateField[0].effecter_state, stateField0.effecter_state); | 
|  | 69 | EXPECT_EQ(stateField[1].set_request, stateField1.set_request); | 
|  | 70 | EXPECT_EQ(stateField[1].effecter_state, stateField1.effecter_state); | 
| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 71 | } | 
|  | 72 |  | 
| George Liu | ba4c1fb | 2020-02-05 14:13:30 +0800 | [diff] [blame] | 73 | TEST(parseEffecterData, testBadDecodeEffecterData) | 
| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 74 | { | 
| George Liu | ba4c1fb | 2020-02-05 14:13:30 +0800 | [diff] [blame] | 75 | std::vector<uint8_t> effecterData = {0, 1, 0, 1, 0, 1}; | 
|  | 76 | uint8_t effecterCount = 2; | 
| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 77 |  | 
| George Liu | ba4c1fb | 2020-02-05 14:13:30 +0800 | [diff] [blame] | 78 | auto effecterField = parseEffecterData(effecterData, effecterCount); | 
| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 79 |  | 
| George Liu | ba4c1fb | 2020-02-05 14:13:30 +0800 | [diff] [blame] | 80 | EXPECT_EQ(effecterField, std::nullopt); | 
| George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 81 | } | 
| Pavithra Barithaya | 0f74c98 | 2020-04-27 02:17:10 -0500 | [diff] [blame] | 82 |  | 
|  | 83 | TEST(FindStateEffecterPDR, testOneMatch) | 
|  | 84 | { | 
|  | 85 |  | 
|  | 86 | auto repo = pldm_pdr_init(); | 
|  | 87 | uint8_t tid = 1; | 
|  | 88 | uint16_t entityID = 33; | 
|  | 89 | uint16_t stateSetId = 196; | 
|  | 90 |  | 
|  | 91 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) - | 
|  | 92 | sizeof(uint8_t) + | 
|  | 93 | sizeof(struct state_effecter_possible_states)); | 
|  | 94 |  | 
|  | 95 | auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data()); | 
|  | 96 |  | 
|  | 97 | auto state = | 
|  | 98 | reinterpret_cast<state_effecter_possible_states*>(rec->possible_states); | 
|  | 99 |  | 
|  | 100 | rec->hdr.type = 11; | 
|  | 101 | rec->hdr.record_handle = 1; | 
|  | 102 | rec->entity_type = 33; | 
|  | 103 | rec->container_id = 0; | 
|  | 104 | rec->composite_effecter_count = 1; | 
|  | 105 | state->state_set_id = 196; | 
|  | 106 | state->possible_states_size = 1; | 
|  | 107 |  | 
|  | 108 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 109 |  | 
|  | 110 | auto record = findStateEffecterPDR(tid, entityID, stateSetId, repo); | 
|  | 111 |  | 
|  | 112 | EXPECT_EQ(pdr, record[0]); | 
|  | 113 |  | 
|  | 114 | pldm_pdr_destroy(repo); | 
|  | 115 | } | 
|  | 116 |  | 
|  | 117 | TEST(FindStateEffecterPDR, testNoMatch) | 
|  | 118 | { | 
|  | 119 |  | 
|  | 120 | auto repo = pldm_pdr_init(); | 
|  | 121 | uint8_t tid = 1; | 
|  | 122 | uint16_t entityID = 44; | 
|  | 123 | uint16_t stateSetId = 196; | 
|  | 124 |  | 
|  | 125 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) - | 
|  | 126 | sizeof(uint8_t) + | 
|  | 127 | sizeof(struct state_effecter_possible_states)); | 
|  | 128 |  | 
|  | 129 | auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data()); | 
|  | 130 |  | 
|  | 131 | auto state = | 
|  | 132 | reinterpret_cast<state_effecter_possible_states*>(rec->possible_states); | 
|  | 133 |  | 
|  | 134 | rec->hdr.type = 11; | 
|  | 135 | rec->hdr.record_handle = 1; | 
|  | 136 | rec->entity_type = 33; | 
|  | 137 | rec->container_id = 0; | 
|  | 138 | rec->composite_effecter_count = 1; | 
|  | 139 | state->state_set_id = 196; | 
|  | 140 | state->possible_states_size = 1; | 
|  | 141 |  | 
|  | 142 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 143 |  | 
|  | 144 | auto record = findStateEffecterPDR(tid, entityID, stateSetId, repo); | 
|  | 145 |  | 
|  | 146 | EXPECT_EQ(record.empty(), true); | 
|  | 147 |  | 
|  | 148 | pldm_pdr_destroy(repo); | 
|  | 149 | } | 
|  | 150 |  | 
|  | 151 | TEST(FindStateEffecterPDR, testEmptyRepo) | 
|  | 152 | { | 
|  | 153 |  | 
|  | 154 | auto repo = pldm_pdr_init(); | 
|  | 155 | uint8_t tid = 1; | 
|  | 156 | uint16_t entityID = 33; | 
|  | 157 | uint16_t stateSetId = 196; | 
|  | 158 |  | 
|  | 159 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) - | 
|  | 160 | sizeof(uint8_t) + | 
|  | 161 | sizeof(struct state_effecter_possible_states)); | 
|  | 162 |  | 
|  | 163 | auto record = findStateEffecterPDR(tid, entityID, stateSetId, repo); | 
|  | 164 |  | 
|  | 165 | EXPECT_EQ(record.empty(), true); | 
|  | 166 |  | 
|  | 167 | pldm_pdr_destroy(repo); | 
|  | 168 | } | 
|  | 169 |  | 
|  | 170 | TEST(FindStateEffecterPDR, testMoreMatch) | 
|  | 171 | { | 
|  | 172 |  | 
|  | 173 | auto repo = pldm_pdr_init(); | 
|  | 174 | uint8_t tid = 1; | 
|  | 175 |  | 
|  | 176 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) - | 
|  | 177 | sizeof(uint8_t) + | 
|  | 178 | sizeof(struct state_effecter_possible_states)); | 
|  | 179 |  | 
|  | 180 | auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data()); | 
|  | 181 |  | 
|  | 182 | auto state = | 
|  | 183 | reinterpret_cast<state_effecter_possible_states*>(rec->possible_states); | 
|  | 184 |  | 
|  | 185 | rec->hdr.type = 11; | 
|  | 186 | rec->hdr.record_handle = 1; | 
|  | 187 | rec->entity_type = 31; | 
|  | 188 | rec->container_id = 0; | 
|  | 189 | rec->composite_effecter_count = 1; | 
|  | 190 | state->state_set_id = 129; | 
|  | 191 | state->possible_states_size = 1; | 
|  | 192 |  | 
|  | 193 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 194 |  | 
|  | 195 | std::vector<uint8_t> pdr_second( | 
|  | 196 | sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) + | 
|  | 197 | sizeof(struct state_effecter_possible_states)); | 
|  | 198 |  | 
|  | 199 | auto rec_second = | 
|  | 200 | reinterpret_cast<pldm_state_effecter_pdr*>(pdr_second.data()); | 
|  | 201 |  | 
|  | 202 | auto state_second = reinterpret_cast<state_effecter_possible_states*>( | 
|  | 203 | rec_second->possible_states); | 
|  | 204 |  | 
|  | 205 | rec_second->hdr.type = 11; | 
|  | 206 | rec_second->hdr.record_handle = 2; | 
|  | 207 | rec_second->entity_type = 31; | 
|  | 208 | rec_second->container_id = 0; | 
|  | 209 | rec_second->composite_effecter_count = 1; | 
|  | 210 | state_second->state_set_id = 129; | 
|  | 211 | state_second->possible_states_size = 1; | 
|  | 212 |  | 
|  | 213 | pldm_pdr_add(repo, pdr_second.data(), pdr_second.size(), 0, false); | 
|  | 214 |  | 
|  | 215 | uint16_t entityID_ = 31; | 
|  | 216 | uint16_t stateSetId_ = 129; | 
|  | 217 |  | 
|  | 218 | auto record = findStateEffecterPDR(tid, entityID_, stateSetId_, repo); | 
|  | 219 |  | 
|  | 220 | EXPECT_EQ(pdr, record[0]); | 
|  | 221 | EXPECT_EQ(pdr_second, record[1]); | 
|  | 222 |  | 
|  | 223 | pldm_pdr_destroy(repo); | 
|  | 224 | } | 
|  | 225 |  | 
|  | 226 | TEST(FindStateEffecterPDR, testManyNoMatch) | 
|  | 227 | { | 
|  | 228 |  | 
|  | 229 | auto repo = pldm_pdr_init(); | 
|  | 230 | uint8_t tid = 1; | 
|  | 231 | uint16_t entityID = 33; | 
|  | 232 | uint16_t stateSetId = 196; | 
|  | 233 |  | 
|  | 234 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) - | 
|  | 235 | sizeof(uint8_t) + | 
|  | 236 | sizeof(struct state_effecter_possible_states)); | 
|  | 237 |  | 
|  | 238 | auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data()); | 
|  | 239 |  | 
|  | 240 | auto state = | 
|  | 241 | reinterpret_cast<state_effecter_possible_states*>(rec->possible_states); | 
|  | 242 |  | 
|  | 243 | rec->hdr.type = 11; | 
|  | 244 | rec->hdr.record_handle = 1; | 
|  | 245 | rec->entity_type = 34; | 
|  | 246 | rec->container_id = 0; | 
|  | 247 | rec->composite_effecter_count = 1; | 
|  | 248 | state->state_set_id = 198; | 
|  | 249 | state->possible_states_size = 1; | 
|  | 250 |  | 
|  | 251 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 252 |  | 
|  | 253 | std::vector<uint8_t> pdr_second( | 
|  | 254 | sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) + | 
|  | 255 | sizeof(struct state_effecter_possible_states)); | 
|  | 256 |  | 
|  | 257 | auto rec_second = | 
|  | 258 | reinterpret_cast<pldm_state_effecter_pdr*>(pdr_second.data()); | 
|  | 259 |  | 
|  | 260 | auto state_second = reinterpret_cast<state_effecter_possible_states*>( | 
|  | 261 | rec_second->possible_states); | 
|  | 262 |  | 
|  | 263 | rec_second->hdr.type = 11; | 
|  | 264 | rec_second->hdr.record_handle = 2; | 
|  | 265 | rec_second->entity_type = 39; | 
|  | 266 | rec_second->container_id = 0; | 
|  | 267 | rec_second->composite_effecter_count = 1; | 
|  | 268 | state_second->state_set_id = 169; | 
|  | 269 | state_second->possible_states_size = 1; | 
|  | 270 |  | 
|  | 271 | pldm_pdr_add(repo, pdr_second.data(), pdr_second.size(), 0, false); | 
|  | 272 |  | 
|  | 273 | auto record = findStateEffecterPDR(tid, entityID, stateSetId, repo); | 
|  | 274 |  | 
|  | 275 | EXPECT_EQ(record.empty(), true); | 
|  | 276 |  | 
|  | 277 | pldm_pdr_destroy(repo); | 
|  | 278 | } | 
|  | 279 |  | 
|  | 280 | TEST(FindStateEffecterPDR, testOneMatchOneNoMatch) | 
|  | 281 | { | 
|  | 282 | auto repo = pldm_pdr_init(); | 
|  | 283 | uint8_t tid = 1; | 
|  | 284 | uint16_t entityID = 67; | 
|  | 285 | uint16_t stateSetId = 192; | 
|  | 286 |  | 
|  | 287 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) - | 
|  | 288 | sizeof(uint8_t) + | 
|  | 289 | sizeof(struct state_effecter_possible_states)); | 
|  | 290 |  | 
|  | 291 | auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data()); | 
|  | 292 |  | 
|  | 293 | auto state = | 
|  | 294 | reinterpret_cast<state_effecter_possible_states*>(rec->possible_states); | 
|  | 295 |  | 
|  | 296 | rec->hdr.type = 11; | 
|  | 297 | rec->hdr.record_handle = 1; | 
|  | 298 | rec->entity_type = 32; | 
|  | 299 | rec->container_id = 0; | 
|  | 300 | rec->composite_effecter_count = 1; | 
|  | 301 | state->state_set_id = 198; | 
|  | 302 | state->possible_states_size = 1; | 
|  | 303 |  | 
|  | 304 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 305 |  | 
|  | 306 | std::vector<uint8_t> pdr_second( | 
|  | 307 | sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) + | 
|  | 308 | sizeof(struct state_effecter_possible_states)); | 
|  | 309 |  | 
|  | 310 | auto rec_second = | 
|  | 311 | reinterpret_cast<pldm_state_effecter_pdr*>(pdr_second.data()); | 
|  | 312 |  | 
|  | 313 | auto state_second = reinterpret_cast<state_effecter_possible_states*>( | 
|  | 314 | rec_second->possible_states); | 
|  | 315 |  | 
|  | 316 | rec_second->hdr.type = 11; | 
|  | 317 | rec_second->hdr.record_handle = 2; | 
|  | 318 | rec_second->entity_type = 67; | 
|  | 319 | rec_second->container_id = 0; | 
|  | 320 | rec_second->composite_effecter_count = 1; | 
|  | 321 | state_second->state_set_id = 192; | 
|  | 322 | state_second->possible_states_size = 1; | 
|  | 323 |  | 
|  | 324 | pldm_pdr_add(repo, pdr_second.data(), pdr_second.size(), 0, false); | 
|  | 325 |  | 
|  | 326 | auto record = findStateEffecterPDR(tid, entityID, stateSetId, repo); | 
|  | 327 |  | 
|  | 328 | EXPECT_EQ(pdr_second, record[0]); | 
|  | 329 | EXPECT_EQ(record.size(), 1); | 
|  | 330 |  | 
|  | 331 | pldm_pdr_destroy(repo); | 
|  | 332 | } | 
|  | 333 |  | 
|  | 334 | TEST(FindStateEffecterPDR, testOneMatchManyNoMatch) | 
|  | 335 | { | 
|  | 336 | auto repo = pldm_pdr_init(); | 
|  | 337 | uint8_t tid = 1; | 
|  | 338 | uint16_t entityID = 67; | 
|  | 339 | uint16_t stateSetId = 192; | 
|  | 340 |  | 
|  | 341 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) - | 
|  | 342 | sizeof(uint8_t) + | 
|  | 343 | sizeof(struct state_effecter_possible_states)); | 
|  | 344 |  | 
|  | 345 | auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data()); | 
|  | 346 |  | 
|  | 347 | auto state = | 
|  | 348 | reinterpret_cast<state_effecter_possible_states*>(rec->possible_states); | 
|  | 349 |  | 
|  | 350 | rec->hdr.type = 11; | 
|  | 351 | rec->hdr.record_handle = 1; | 
|  | 352 | rec->entity_type = 32; | 
|  | 353 | rec->container_id = 0; | 
|  | 354 | rec->composite_effecter_count = 1; | 
|  | 355 | state->state_set_id = 198; | 
|  | 356 | state->possible_states_size = 1; | 
|  | 357 |  | 
|  | 358 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 359 |  | 
|  | 360 | std::vector<uint8_t> pdr_second( | 
|  | 361 | sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) + | 
|  | 362 | sizeof(struct state_effecter_possible_states)); | 
|  | 363 |  | 
|  | 364 | auto rec_second = | 
|  | 365 | reinterpret_cast<pldm_state_effecter_pdr*>(pdr_second.data()); | 
|  | 366 |  | 
|  | 367 | auto state_second = reinterpret_cast<state_effecter_possible_states*>( | 
|  | 368 | rec_second->possible_states); | 
|  | 369 |  | 
|  | 370 | rec_second->hdr.type = 11; | 
|  | 371 | rec_second->hdr.record_handle = 2; | 
|  | 372 | rec_second->entity_type = 67; | 
|  | 373 | rec_second->container_id = 0; | 
|  | 374 | rec_second->composite_effecter_count = 1; | 
|  | 375 | state_second->state_set_id = 192; | 
|  | 376 | state_second->possible_states_size = 1; | 
|  | 377 |  | 
|  | 378 | pldm_pdr_add(repo, pdr_second.data(), pdr_second.size(), 0, false); | 
|  | 379 |  | 
|  | 380 | std::vector<uint8_t> pdr_third( | 
|  | 381 | sizeof(struct pldm_state_effecter_pdr) - sizeof(uint8_t) + | 
|  | 382 | sizeof(struct state_effecter_possible_states)); | 
|  | 383 |  | 
|  | 384 | auto rec_third = | 
|  | 385 | reinterpret_cast<pldm_state_effecter_pdr*>(pdr_third.data()); | 
|  | 386 |  | 
|  | 387 | auto state_third = reinterpret_cast<state_effecter_possible_states*>( | 
|  | 388 | rec_third->possible_states); | 
|  | 389 |  | 
|  | 390 | rec_third->hdr.type = 11; | 
|  | 391 | rec_third->hdr.record_handle = 3; | 
|  | 392 | rec_third->entity_type = 69; | 
|  | 393 | rec_third->container_id = 0; | 
|  | 394 | rec_third->composite_effecter_count = 1; | 
|  | 395 | state_third->state_set_id = 199; | 
|  | 396 | state_third->possible_states_size = 1; | 
|  | 397 |  | 
|  | 398 | auto record = findStateEffecterPDR(tid, entityID, stateSetId, repo); | 
|  | 399 |  | 
|  | 400 | EXPECT_EQ(pdr_second, record[0]); | 
|  | 401 | EXPECT_EQ(record.size(), 1); | 
|  | 402 |  | 
|  | 403 | pldm_pdr_destroy(repo); | 
|  | 404 | } | 
|  | 405 |  | 
|  | 406 | TEST(FindStateEffecterPDR, testCompositeEffecter) | 
|  | 407 | { | 
|  | 408 | auto repo = pldm_pdr_init(); | 
|  | 409 | uint8_t tid = 1; | 
|  | 410 | uint16_t entityID = 67; | 
|  | 411 | uint16_t stateSetId = 192; | 
|  | 412 |  | 
|  | 413 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) - | 
|  | 414 | sizeof(uint8_t) + | 
|  | 415 | sizeof(struct state_effecter_possible_states)); | 
|  | 416 |  | 
|  | 417 | auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data()); | 
|  | 418 |  | 
|  | 419 | auto state = | 
|  | 420 | reinterpret_cast<state_effecter_possible_states*>(rec->possible_states); | 
|  | 421 |  | 
|  | 422 | rec->hdr.type = 11; | 
|  | 423 | rec->hdr.record_handle = 1; | 
|  | 424 | rec->entity_type = 67; | 
|  | 425 | rec->container_id = 0; | 
|  | 426 | rec->composite_effecter_count = 3; | 
|  | 427 | state->state_set_id = 198; | 
|  | 428 | state->possible_states_size = 1; | 
|  | 429 |  | 
|  | 430 | state->state_set_id = 193; | 
|  | 431 | state->possible_states_size = 1; | 
|  | 432 |  | 
|  | 433 | state->state_set_id = 192; | 
|  | 434 | state->possible_states_size = 1; | 
|  | 435 |  | 
|  | 436 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 437 |  | 
|  | 438 | auto record = findStateEffecterPDR(tid, entityID, stateSetId, repo); | 
|  | 439 |  | 
|  | 440 | EXPECT_EQ(pdr, record[0]); | 
|  | 441 |  | 
|  | 442 | pldm_pdr_destroy(repo); | 
|  | 443 | } | 
|  | 444 |  | 
|  | 445 | TEST(FindStateEffecterPDR, testNoMatchCompositeEffecter) | 
|  | 446 | { | 
|  | 447 | auto repo = pldm_pdr_init(); | 
|  | 448 | uint8_t tid = 1; | 
|  | 449 | uint16_t entityID = 67; | 
|  | 450 | uint16_t stateSetId = 192; | 
|  | 451 |  | 
|  | 452 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_effecter_pdr) - | 
|  | 453 | sizeof(uint8_t) + | 
|  | 454 | sizeof(struct state_effecter_possible_states)); | 
|  | 455 |  | 
|  | 456 | auto rec = reinterpret_cast<pldm_state_effecter_pdr*>(pdr.data()); | 
|  | 457 |  | 
|  | 458 | auto state = | 
|  | 459 | reinterpret_cast<state_effecter_possible_states*>(rec->possible_states); | 
|  | 460 |  | 
|  | 461 | rec->hdr.type = 11; | 
|  | 462 | rec->hdr.record_handle = 1; | 
|  | 463 | rec->entity_type = 34; | 
|  | 464 | rec->container_id = 0; | 
|  | 465 | rec->composite_effecter_count = 3; | 
|  | 466 | state->state_set_id = 198; | 
|  | 467 | state->possible_states_size = 1; | 
|  | 468 |  | 
|  | 469 | state->state_set_id = 193; | 
|  | 470 | state->possible_states_size = 1; | 
|  | 471 |  | 
|  | 472 | state->state_set_id = 123; | 
|  | 473 | state->possible_states_size = 1; | 
|  | 474 |  | 
|  | 475 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 476 |  | 
|  | 477 | auto record = findStateEffecterPDR(tid, entityID, stateSetId, repo); | 
|  | 478 |  | 
|  | 479 | EXPECT_EQ(record.empty(), true); | 
|  | 480 |  | 
|  | 481 | pldm_pdr_destroy(repo); | 
|  | 482 | } | 
| Chicago Duan | 738e4d8 | 2020-05-28 16:39:19 +0800 | [diff] [blame^] | 483 |  | 
|  | 484 | TEST(FindStateSensorPDR, testOneMatch) | 
|  | 485 | { | 
|  | 486 |  | 
|  | 487 | auto repo = pldm_pdr_init(); | 
|  | 488 | uint8_t tid = 1; | 
|  | 489 | uint16_t entityID = 5; | 
|  | 490 | uint16_t stateSetId = 1; | 
|  | 491 |  | 
|  | 492 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) - | 
|  | 493 | sizeof(uint8_t) + | 
|  | 494 | sizeof(struct state_sensor_possible_states)); | 
|  | 495 |  | 
|  | 496 | auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data()); | 
|  | 497 |  | 
|  | 498 | auto state = | 
|  | 499 | reinterpret_cast<state_sensor_possible_states*>(rec->possible_states); | 
|  | 500 |  | 
|  | 501 | rec->hdr.type = 4; | 
|  | 502 | rec->hdr.record_handle = 1; | 
|  | 503 | rec->entity_type = 5; | 
|  | 504 | rec->container_id = 0; | 
|  | 505 | rec->composite_sensor_count = 1; | 
|  | 506 | state->state_set_id = 1; | 
|  | 507 | state->possible_states_size = 1; | 
|  | 508 |  | 
|  | 509 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 510 |  | 
|  | 511 | auto record = findStateSensorPDR(tid, entityID, stateSetId, repo); | 
|  | 512 |  | 
|  | 513 | EXPECT_EQ(pdr, record[0]); | 
|  | 514 |  | 
|  | 515 | pldm_pdr_destroy(repo); | 
|  | 516 | } | 
|  | 517 |  | 
|  | 518 | TEST(FindStateSensorPDR, testNoMatch) | 
|  | 519 | { | 
|  | 520 |  | 
|  | 521 | auto repo = pldm_pdr_init(); | 
|  | 522 | uint8_t tid = 1; | 
|  | 523 | uint16_t entityID = 5; | 
|  | 524 | uint16_t stateSetId = 1; | 
|  | 525 |  | 
|  | 526 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) - | 
|  | 527 | sizeof(uint8_t) + | 
|  | 528 | sizeof(struct state_sensor_possible_states)); | 
|  | 529 |  | 
|  | 530 | auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data()); | 
|  | 531 |  | 
|  | 532 | auto state = | 
|  | 533 | reinterpret_cast<state_sensor_possible_states*>(rec->possible_states); | 
|  | 534 |  | 
|  | 535 | rec->hdr.type = 4; | 
|  | 536 | rec->hdr.record_handle = 1; | 
|  | 537 | rec->entity_type = 55; | 
|  | 538 | rec->container_id = 0; | 
|  | 539 | rec->composite_sensor_count = 1; | 
|  | 540 | state->state_set_id = 1; | 
|  | 541 | state->possible_states_size = 1; | 
|  | 542 |  | 
|  | 543 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 544 |  | 
|  | 545 | auto record = findStateSensorPDR(tid, entityID, stateSetId, repo); | 
|  | 546 |  | 
|  | 547 | EXPECT_EQ(record.empty(), true); | 
|  | 548 |  | 
|  | 549 | pldm_pdr_destroy(repo); | 
|  | 550 | } | 
|  | 551 |  | 
|  | 552 | TEST(FindStateSensorPDR, testEmptyRepo) | 
|  | 553 | { | 
|  | 554 |  | 
|  | 555 | auto repo = pldm_pdr_init(); | 
|  | 556 | uint8_t tid = 1; | 
|  | 557 | uint16_t entityID = 5; | 
|  | 558 | uint16_t stateSetId = 1; | 
|  | 559 |  | 
|  | 560 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) - | 
|  | 561 | sizeof(uint8_t) + | 
|  | 562 | sizeof(struct state_sensor_possible_states)); | 
|  | 563 |  | 
|  | 564 | auto record = findStateSensorPDR(tid, entityID, stateSetId, repo); | 
|  | 565 |  | 
|  | 566 | EXPECT_EQ(record.empty(), true); | 
|  | 567 |  | 
|  | 568 | pldm_pdr_destroy(repo); | 
|  | 569 | } | 
|  | 570 |  | 
|  | 571 | TEST(FindStateSensorPDR, testMoreMatch) | 
|  | 572 | { | 
|  | 573 |  | 
|  | 574 | auto repo = pldm_pdr_init(); | 
|  | 575 | uint8_t tid = 1; | 
|  | 576 |  | 
|  | 577 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) - | 
|  | 578 | sizeof(uint8_t) + | 
|  | 579 | sizeof(struct state_sensor_possible_states)); | 
|  | 580 |  | 
|  | 581 | auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data()); | 
|  | 582 |  | 
|  | 583 | auto state = | 
|  | 584 | reinterpret_cast<state_sensor_possible_states*>(rec->possible_states); | 
|  | 585 |  | 
|  | 586 | rec->hdr.type = 4; | 
|  | 587 | rec->hdr.record_handle = 1; | 
|  | 588 | rec->entity_type = 5; | 
|  | 589 | rec->container_id = 0; | 
|  | 590 | rec->composite_sensor_count = 1; | 
|  | 591 | state->state_set_id = 1; | 
|  | 592 | state->possible_states_size = 1; | 
|  | 593 |  | 
|  | 594 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 595 |  | 
|  | 596 | std::vector<uint8_t> pdr_second( | 
|  | 597 | sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) + | 
|  | 598 | sizeof(struct state_sensor_possible_states)); | 
|  | 599 |  | 
|  | 600 | auto rec_second = | 
|  | 601 | reinterpret_cast<pldm_state_sensor_pdr*>(pdr_second.data()); | 
|  | 602 |  | 
|  | 603 | auto state_second = reinterpret_cast<state_sensor_possible_states*>( | 
|  | 604 | rec_second->possible_states); | 
|  | 605 |  | 
|  | 606 | rec_second->hdr.type = 4; | 
|  | 607 | rec_second->hdr.record_handle = 2; | 
|  | 608 | rec_second->entity_type = 5; | 
|  | 609 | rec_second->container_id = 0; | 
|  | 610 | rec_second->composite_sensor_count = 1; | 
|  | 611 | state_second->state_set_id = 1; | 
|  | 612 | state_second->possible_states_size = 1; | 
|  | 613 |  | 
|  | 614 | pldm_pdr_add(repo, pdr_second.data(), pdr_second.size(), 0, false); | 
|  | 615 |  | 
|  | 616 | uint16_t entityID_ = 5; | 
|  | 617 | uint16_t stateSetId_ = 1; | 
|  | 618 |  | 
|  | 619 | auto record = findStateSensorPDR(tid, entityID_, stateSetId_, repo); | 
|  | 620 |  | 
|  | 621 | EXPECT_EQ(pdr, record[0]); | 
|  | 622 | EXPECT_EQ(pdr_second, record[1]); | 
|  | 623 |  | 
|  | 624 | pldm_pdr_destroy(repo); | 
|  | 625 | } | 
|  | 626 |  | 
|  | 627 | TEST(FindStateSensorPDR, testManyNoMatch) | 
|  | 628 | { | 
|  | 629 |  | 
|  | 630 | auto repo = pldm_pdr_init(); | 
|  | 631 | uint8_t tid = 1; | 
|  | 632 | uint16_t entityID = 5; | 
|  | 633 | uint16_t stateSetId = 1; | 
|  | 634 |  | 
|  | 635 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) - | 
|  | 636 | sizeof(uint8_t) + | 
|  | 637 | sizeof(struct state_sensor_possible_states)); | 
|  | 638 |  | 
|  | 639 | auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data()); | 
|  | 640 |  | 
|  | 641 | auto state = | 
|  | 642 | reinterpret_cast<state_sensor_possible_states*>(rec->possible_states); | 
|  | 643 |  | 
|  | 644 | rec->hdr.type = 4; | 
|  | 645 | rec->hdr.record_handle = 1; | 
|  | 646 | rec->entity_type = 56; | 
|  | 647 | rec->container_id = 0; | 
|  | 648 | rec->composite_sensor_count = 1; | 
|  | 649 | state->state_set_id = 2; | 
|  | 650 | state->possible_states_size = 1; | 
|  | 651 |  | 
|  | 652 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 653 |  | 
|  | 654 | std::vector<uint8_t> pdr_second( | 
|  | 655 | sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) + | 
|  | 656 | sizeof(struct state_sensor_possible_states)); | 
|  | 657 |  | 
|  | 658 | auto rec_second = | 
|  | 659 | reinterpret_cast<pldm_state_sensor_pdr*>(pdr_second.data()); | 
|  | 660 |  | 
|  | 661 | auto state_second = reinterpret_cast<state_sensor_possible_states*>( | 
|  | 662 | rec_second->possible_states); | 
|  | 663 |  | 
|  | 664 | rec_second->hdr.type = 4; | 
|  | 665 | rec_second->hdr.record_handle = 2; | 
|  | 666 | rec_second->entity_type = 66; | 
|  | 667 | rec_second->container_id = 0; | 
|  | 668 | rec_second->composite_sensor_count = 1; | 
|  | 669 | state_second->state_set_id = 3; | 
|  | 670 | state_second->possible_states_size = 1; | 
|  | 671 |  | 
|  | 672 | pldm_pdr_add(repo, pdr_second.data(), pdr_second.size(), 0, false); | 
|  | 673 |  | 
|  | 674 | auto record = findStateSensorPDR(tid, entityID, stateSetId, repo); | 
|  | 675 |  | 
|  | 676 | EXPECT_EQ(record.empty(), true); | 
|  | 677 |  | 
|  | 678 | pldm_pdr_destroy(repo); | 
|  | 679 | } | 
|  | 680 |  | 
|  | 681 | TEST(FindStateSensorPDR, testOneMatchOneNoMatch) | 
|  | 682 | { | 
|  | 683 | auto repo = pldm_pdr_init(); | 
|  | 684 | uint8_t tid = 1; | 
|  | 685 | uint16_t entityID = 5; | 
|  | 686 | uint16_t stateSetId = 1; | 
|  | 687 |  | 
|  | 688 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) - | 
|  | 689 | sizeof(uint8_t) + | 
|  | 690 | sizeof(struct state_sensor_possible_states)); | 
|  | 691 |  | 
|  | 692 | auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data()); | 
|  | 693 |  | 
|  | 694 | auto state = | 
|  | 695 | reinterpret_cast<state_sensor_possible_states*>(rec->possible_states); | 
|  | 696 |  | 
|  | 697 | rec->hdr.type = 4; | 
|  | 698 | rec->hdr.record_handle = 1; | 
|  | 699 | rec->entity_type = 10; | 
|  | 700 | rec->container_id = 0; | 
|  | 701 | rec->composite_sensor_count = 1; | 
|  | 702 | state->state_set_id = 20; | 
|  | 703 | state->possible_states_size = 1; | 
|  | 704 |  | 
|  | 705 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 706 |  | 
|  | 707 | std::vector<uint8_t> pdr_second( | 
|  | 708 | sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) + | 
|  | 709 | sizeof(struct state_sensor_possible_states)); | 
|  | 710 |  | 
|  | 711 | auto rec_second = | 
|  | 712 | reinterpret_cast<pldm_state_sensor_pdr*>(pdr_second.data()); | 
|  | 713 |  | 
|  | 714 | auto state_second = reinterpret_cast<state_sensor_possible_states*>( | 
|  | 715 | rec_second->possible_states); | 
|  | 716 |  | 
|  | 717 | rec_second->hdr.type = 4; | 
|  | 718 | rec_second->hdr.record_handle = 2; | 
|  | 719 | rec_second->entity_type = 5; | 
|  | 720 | rec_second->container_id = 0; | 
|  | 721 | rec_second->composite_sensor_count = 1; | 
|  | 722 | state_second->state_set_id = 1; | 
|  | 723 | state_second->possible_states_size = 1; | 
|  | 724 |  | 
|  | 725 | pldm_pdr_add(repo, pdr_second.data(), pdr_second.size(), 0, false); | 
|  | 726 |  | 
|  | 727 | auto record = findStateSensorPDR(tid, entityID, stateSetId, repo); | 
|  | 728 |  | 
|  | 729 | EXPECT_EQ(pdr_second, record[0]); | 
|  | 730 | EXPECT_EQ(record.size(), 1); | 
|  | 731 |  | 
|  | 732 | pldm_pdr_destroy(repo); | 
|  | 733 | } | 
|  | 734 |  | 
|  | 735 | TEST(FindStateSensorPDR, testOneMatchManyNoMatch) | 
|  | 736 | { | 
|  | 737 | auto repo = pldm_pdr_init(); | 
|  | 738 | uint8_t tid = 1; | 
|  | 739 | uint16_t entityID = 5; | 
|  | 740 | uint16_t stateSetId = 1; | 
|  | 741 |  | 
|  | 742 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) - | 
|  | 743 | sizeof(uint8_t) + | 
|  | 744 | sizeof(struct state_sensor_possible_states)); | 
|  | 745 |  | 
|  | 746 | auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data()); | 
|  | 747 |  | 
|  | 748 | auto state = | 
|  | 749 | reinterpret_cast<state_sensor_possible_states*>(rec->possible_states); | 
|  | 750 |  | 
|  | 751 | rec->hdr.type = 4; | 
|  | 752 | rec->hdr.record_handle = 1; | 
|  | 753 | rec->entity_type = 6; | 
|  | 754 | rec->container_id = 0; | 
|  | 755 | rec->composite_sensor_count = 1; | 
|  | 756 | state->state_set_id = 9; | 
|  | 757 | state->possible_states_size = 1; | 
|  | 758 |  | 
|  | 759 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 760 |  | 
|  | 761 | std::vector<uint8_t> pdr_second( | 
|  | 762 | sizeof(struct pldm_state_sensor_pdr) - sizeof(uint8_t) + | 
|  | 763 | sizeof(struct state_sensor_possible_states)); | 
|  | 764 |  | 
|  | 765 | auto rec_second = | 
|  | 766 | reinterpret_cast<pldm_state_sensor_pdr*>(pdr_second.data()); | 
|  | 767 |  | 
|  | 768 | auto state_second = reinterpret_cast<state_sensor_possible_states*>( | 
|  | 769 | rec_second->possible_states); | 
|  | 770 |  | 
|  | 771 | rec_second->hdr.type = 4; | 
|  | 772 | rec_second->hdr.record_handle = 2; | 
|  | 773 | rec_second->entity_type = 5; | 
|  | 774 | rec_second->container_id = 0; | 
|  | 775 | rec_second->composite_sensor_count = 1; | 
|  | 776 | state_second->state_set_id = 1; | 
|  | 777 | state_second->possible_states_size = 1; | 
|  | 778 |  | 
|  | 779 | pldm_pdr_add(repo, pdr_second.data(), pdr_second.size(), 0, false); | 
|  | 780 |  | 
|  | 781 | std::vector<uint8_t> pdr_third(sizeof(struct pldm_state_sensor_pdr) - | 
|  | 782 | sizeof(uint8_t) + | 
|  | 783 | sizeof(struct state_sensor_possible_states)); | 
|  | 784 |  | 
|  | 785 | auto rec_third = reinterpret_cast<pldm_state_sensor_pdr*>(pdr_third.data()); | 
|  | 786 |  | 
|  | 787 | auto state_third = reinterpret_cast<state_sensor_possible_states*>( | 
|  | 788 | rec_third->possible_states); | 
|  | 789 |  | 
|  | 790 | rec_third->hdr.type = 4; | 
|  | 791 | rec_third->hdr.record_handle = 3; | 
|  | 792 | rec_third->entity_type = 7; | 
|  | 793 | rec_third->container_id = 0; | 
|  | 794 | rec_third->composite_sensor_count = 1; | 
|  | 795 | state_third->state_set_id = 12; | 
|  | 796 | state_third->possible_states_size = 1; | 
|  | 797 |  | 
|  | 798 | auto record = findStateSensorPDR(tid, entityID, stateSetId, repo); | 
|  | 799 |  | 
|  | 800 | EXPECT_EQ(pdr_second, record[0]); | 
|  | 801 | EXPECT_EQ(record.size(), 1); | 
|  | 802 |  | 
|  | 803 | pldm_pdr_destroy(repo); | 
|  | 804 | } | 
|  | 805 |  | 
|  | 806 | TEST(FindStateSensorPDR, testCompositeSensor) | 
|  | 807 | { | 
|  | 808 | auto repo = pldm_pdr_init(); | 
|  | 809 | uint8_t tid = 1; | 
|  | 810 | uint16_t entityID = 5; | 
|  | 811 | uint16_t stateSetId = 1; | 
|  | 812 |  | 
|  | 813 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) - | 
|  | 814 | sizeof(uint8_t) + | 
|  | 815 | sizeof(struct state_sensor_possible_states)); | 
|  | 816 |  | 
|  | 817 | auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data()); | 
|  | 818 |  | 
|  | 819 | auto state = | 
|  | 820 | reinterpret_cast<state_sensor_possible_states*>(rec->possible_states); | 
|  | 821 |  | 
|  | 822 | rec->hdr.type = 4; | 
|  | 823 | rec->hdr.record_handle = 1; | 
|  | 824 | rec->entity_type = 5; | 
|  | 825 | rec->container_id = 0; | 
|  | 826 | rec->composite_sensor_count = 3; | 
|  | 827 | state->state_set_id = 2; | 
|  | 828 | state->possible_states_size = 1; | 
|  | 829 |  | 
|  | 830 | state->state_set_id = 7; | 
|  | 831 | state->possible_states_size = 1; | 
|  | 832 |  | 
|  | 833 | state->state_set_id = 1; | 
|  | 834 | state->possible_states_size = 1; | 
|  | 835 |  | 
|  | 836 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 837 |  | 
|  | 838 | auto record = findStateSensorPDR(tid, entityID, stateSetId, repo); | 
|  | 839 |  | 
|  | 840 | EXPECT_EQ(pdr, record[0]); | 
|  | 841 |  | 
|  | 842 | pldm_pdr_destroy(repo); | 
|  | 843 | } | 
|  | 844 |  | 
|  | 845 | TEST(FindStateSensorPDR, testNoMatchCompositeSensor) | 
|  | 846 | { | 
|  | 847 | auto repo = pldm_pdr_init(); | 
|  | 848 | uint8_t tid = 1; | 
|  | 849 | uint16_t entityID = 5; | 
|  | 850 | uint16_t stateSetId = 1; | 
|  | 851 |  | 
|  | 852 | std::vector<uint8_t> pdr(sizeof(struct pldm_state_sensor_pdr) - | 
|  | 853 | sizeof(uint8_t) + | 
|  | 854 | sizeof(struct state_sensor_possible_states)); | 
|  | 855 |  | 
|  | 856 | auto rec = reinterpret_cast<pldm_state_sensor_pdr*>(pdr.data()); | 
|  | 857 |  | 
|  | 858 | auto state = | 
|  | 859 | reinterpret_cast<state_sensor_possible_states*>(rec->possible_states); | 
|  | 860 |  | 
|  | 861 | rec->hdr.type = 4; | 
|  | 862 | rec->hdr.record_handle = 1; | 
|  | 863 | rec->entity_type = 21; | 
|  | 864 | rec->container_id = 0; | 
|  | 865 | rec->composite_sensor_count = 3; | 
|  | 866 | state->state_set_id = 15; | 
|  | 867 | state->possible_states_size = 1; | 
|  | 868 |  | 
|  | 869 | state->state_set_id = 19; | 
|  | 870 | state->possible_states_size = 1; | 
|  | 871 |  | 
|  | 872 | state->state_set_id = 39; | 
|  | 873 | state->possible_states_size = 1; | 
|  | 874 |  | 
|  | 875 | pldm_pdr_add(repo, pdr.data(), pdr.size(), 0, false); | 
|  | 876 |  | 
|  | 877 | auto record = findStateSensorPDR(tid, entityID, stateSetId, repo); | 
|  | 878 |  | 
|  | 879 | EXPECT_EQ(record.empty(), true); | 
|  | 880 |  | 
|  | 881 | pldm_pdr_destroy(repo); | 
|  | 882 | } |