From 4b4578c67c5f8db356c69742bebef45bdc2c1f7e Mon Sep 17 00:00:00 2001 From: yunhanw Date: Mon, 23 Sep 2024 14:21:50 -0700 Subject: [PATCH] port test from pr 35734 --- .../icd/server/tests/TestICDMonitoringTable.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/app/icd/server/tests/TestICDMonitoringTable.cpp b/src/app/icd/server/tests/TestICDMonitoringTable.cpp index 177f8caba507e1..81fcb2af18a250 100644 --- a/src/app/icd/server/tests/TestICDMonitoringTable.cpp +++ b/src/app/icd/server/tests/TestICDMonitoringTable.cpp @@ -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::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 }; @@ -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;