Skip to content

Commit

Permalink
[TestConstraints] Add some tests for the hasValue constraints (#25087)
Browse files Browse the repository at this point in the history
* [TestConstraints] Add some tests for the hasValue constraints

* Update generated tests content
  • Loading branch information
vivien-apple authored and pull[bot] committed Aug 1, 2023
1 parent 29b6efd commit 1151028
Show file tree
Hide file tree
Showing 3 changed files with 571 additions and 2 deletions.
78 changes: 78 additions & 0 deletions src/app/tests/suites/TestConstraints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,81 @@ tests:
attribute: "char_string"
arguments:
value: ""

# Tests for hasValue attribute

- label: "Read attribute NULLABLE_INT8U Default Value"
command: "readAttribute"
attribute: "nullable_int8u"
response:
value: 0

- label: "Write attribute NULLABLE_INT8U with a value"
command: "writeAttribute"
attribute: "nullable_int8u"
arguments:
value: 0

- label: "Read attribute NULLABLE_INT8U with a value"
command: "readAttribute"
attribute: "nullable_int8u"
response:
constraints:
hasValue: true

- label: "Write attribute NULLABLE_INT8U without a value"
command: "writeAttribute"
attribute: "nullable_int8u"
arguments:
value: null

- label: "Read attribute NULLABLE_INT8U with a value"
command: "readAttribute"
attribute: "nullable_int8u"
response:
constraints:
hasValue: false

- label: "Write attribute NULLABLE_INT8U back to Default Value"
command: "writeAttribute"
attribute: "nullable_int8u"
arguments:
value: 0

- label: "Read attribute NULLABLE_OCTET_STRING Default Value"
command: "readAttribute"
attribute: "nullable_octet_string"
response:
value: ""

- label: "Write attribute NULLABLE_OCTET_STRING"
command: "writeAttribute"
attribute: "nullable_octet_string"
arguments:
value: "TestValue"

- label: "Read attribute NULLABLE_OCTET_STRING"
command: "readAttribute"
attribute: "nullable_octet_string"
response:
constraints:
hasValue: true

- label: "Write attribute NULLABLE_OCTET_STRING"
command: "writeAttribute"
attribute: "nullable_octet_string"
arguments:
value: null

- label: "Read attribute NULLABLE_OCTET_STRING"
command: "readAttribute"
attribute: "nullable_octet_string"
response:
constraints:
hasValue: false

- label: "Write attribute NULLABLE_OCTET_STRING back to Default Value"
command: "writeAttribute"
attribute: "nullable_octet_string"
arguments:
value: ""
149 changes: 148 additions & 1 deletion zzz_generated/chip-tool/zap-generated/test/Commands.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1151028

Please sign in to comment.