Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jepenven-silabs committed Sep 17, 2021
1 parent 8832118 commit 03d1f60
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 17 additions & 3 deletions src/lib/core/GroupId.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,27 @@ namespace chip {
// methods.
using GroupId = uint16_t;

constexpr GroupId kUndefinedGroupId = 0ULL;
constexpr GroupId kUndefinedGroupId = 0;

constexpr GroupId kMaxOperationalGroupId = 0xFFFFULL;
constexpr GroupId kMinUniversalGroupId = 0x8000;
constexpr GroupId kMaxUniversalGroupId = 0xFFFF;

constexpr GroupId kMinFabricGroupId = 0x0001;
constexpr GroupId kMaxFabricGroupId = 0x7FFF;

constexpr bool IsOperationalGroupId(GroupId aGroupId)
{
return (aGroupId != kUndefinedGroupId) && (aGroupId <= kMaxOperationalGroupId);
return (aGroupId != kUndefinedGroupId);
}

constexpr bool IsFabricGroupId(GroupId aGroupId)
{
return (aGroupId <= kMaxFabricGroupId) && (aGroupId >= kMinFabricGroupId);
}

constexpr bool IsUniversalGroupId(GroupId aGroupId)
{
return (aGroupId <= kMaxUniversalGroupId) && (aGroupId >= kMinUniversalGroupId);
}

} // namespace chip
2 changes: 1 addition & 1 deletion src/transport/raw/tests/TestMessageHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void TestPacketHeaderEncodeDecode(nlTestSuite * inSuite, void * inContext)
header.SetMessageCounter(222).SetSourceNodeId(1).SetDestinationGroupId(2);
NL_TEST_ASSERT(inSuite, header.Decode(buffer, &decodeLen) == CHIP_NO_ERROR);
NL_TEST_ASSERT(inSuite, header.GetMessageCounter() == 234);
NL_TEST_ASSERT(inSuite, header.GetDestinationGroupId() == Optional<uint16_t>::Value(45ull));
NL_TEST_ASSERT(inSuite, header.GetDestinationGroupId() == Optional<uint16_t>::Value((uint16_t)45));
NL_TEST_ASSERT(inSuite, header.GetSourceNodeId() == Optional<uint64_t>::Value(77ull));


Expand Down

0 comments on commit 03d1f60

Please sign in to comment.