Skip to content

Commit

Permalink
port test from pr 35734
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhanw-google committed Sep 23, 2024
1 parent c06123b commit 4b4578c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/app/icd/server/tests/TestICDMonitoringTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ constexpr uint64_t kClientNodeId13 = 0x100003;
constexpr uint64_t kClientNodeId21 = 0x200001;
constexpr uint64_t kClientNodeId22 = 0x200002;

constexpr uint64_t kClientNodeMaxValue = std::numeric_limits<uint64_t>::max();

constexpr uint8_t kKeyBuffer0a[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
constexpr uint8_t kKeyBuffer0b[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
Expand Down Expand Up @@ -98,6 +100,20 @@ TEST(TestICDMonitoringTable, TestEntryAssignationOverload)
EXPECT_TRUE(entry2.IsKeyEquivalent(ByteSpan(kKeyBuffer1a)));
}

TEST(TestICDMonitoringTable, TestEntryMaximumSize)
{
TestPersistentStorageDelegate storage;
TestSessionKeystoreImpl keystore;
ICDMonitoringTable table(storage, kTestFabricIndex1, kMaxTestClients1, &keystore);

ICDMonitoringEntry entry(&keystore);
entry.checkInNodeID = kClientNodeMaxValue;
entry.monitoredSubject = kClientNodeMaxValue;
entry.clientType = ClientTypeEnum::kPermanent;
EXPECT_EQ(CHIP_NO_ERROR, entry.SetKey(ByteSpan(kKeyBuffer1a)));
EXPECT_EQ(CHIP_NO_ERROR, table.Set(0, entry));
}

TEST(TestICDMonitoringTable, TestEntryKeyFunctions)
{
TestSessionKeystoreImpl keystore;
Expand Down

0 comments on commit 4b4578c

Please sign in to comment.