Skip to content

Commit

Permalink
[matter_yamltests] Reproduce the c++ behavior for hasMasksSet (#27253)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple authored Jun 15, 2023
1 parent 2eef730 commit 815c2ae
Show file tree
Hide file tree
Showing 4 changed files with 320 additions and 220 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ def __init__(self, context, has_masks_set):
self._has_masks_set = has_masks_set

def check_response(self, value, value_type_name) -> bool:
return all([(value & mask) == mask for mask in self._has_masks_set])
return all([(value & mask) != 0 for mask in self._has_masks_set])

def get_reason(self, value, value_type_name) -> str:
expected_masks = []
Expand Down
16 changes: 16 additions & 0 deletions src/app/tests/suites/TestConstraints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,22 @@ tests:
constraints:
hasMasksSet: [0x01, 0x04] # [MaskVal1, MaskVal3]

- label: "Write attribute BITMAP32 with MaskVal1"
command: "writeAttribute"
attribute: "bitmap32"
arguments:
value: 1 # MaskVal1

- label:
"Read attribute BITMAP32 with MaskVal1 and ensure Maskval1 or MaskVal3
are set"
command: "readAttribute"
attribute: "bitmap32"
response:
value: 1 # MaskVal1
constraints:
hasMasksSet: [0x05] # [MaskVal1, MaskVal3]

- label: "Write attribute BITMAP32 Back to Default Value"
command: "writeAttribute"
attribute: "bitmap32"
Expand Down
Loading

0 comments on commit 815c2ae

Please sign in to comment.