Skip to content

Commit 4230467

Browse files
vivien-applepull[bot]
authored andcommitted
[matter_yamltests] Reproduce the c++ behavior for hasMasksSet (#27253)
1 parent 1f191b9 commit 4230467

File tree

4 files changed

+320
-220
lines changed

4 files changed

+320
-220
lines changed

scripts/py_matter_yamltests/matter_yamltests/constraints.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ def __init__(self, context, has_masks_set):
728728
self._has_masks_set = has_masks_set
729729

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

733733
def get_reason(self, value, value_type_name) -> str:
734734
expected_masks = []

src/app/tests/suites/TestConstraints.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,22 @@ tests:
112112
constraints:
113113
hasMasksSet: [0x01, 0x04] # [MaskVal1, MaskVal3]
114114

115+
- label: "Write attribute BITMAP32 with MaskVal1"
116+
command: "writeAttribute"
117+
attribute: "bitmap32"
118+
arguments:
119+
value: 1 # MaskVal1
120+
121+
- label:
122+
"Read attribute BITMAP32 with MaskVal1 and ensure Maskval1 or MaskVal3
123+
are set"
124+
command: "readAttribute"
125+
attribute: "bitmap32"
126+
response:
127+
value: 1 # MaskVal1
128+
constraints:
129+
hasMasksSet: [0x05] # [MaskVal1, MaskVal3]
130+
115131
- label: "Write attribute BITMAP32 Back to Default Value"
116132
command: "writeAttribute"
117133
attribute: "bitmap32"

0 commit comments

Comments
 (0)