Skip to content

Commit

Permalink
Add some tests for SetRegulatoryConfig. (#28063)
Browse files Browse the repository at this point in the history
We didn't seem to have any, apparently.

This exercises the code changes made in
#27949
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Feb 8, 2024
1 parent d44eff9 commit 4145190
Show file tree
Hide file tree
Showing 3 changed files with 551 additions and 3 deletions.
89 changes: 89 additions & 0 deletions src/app/tests/suites/TestGeneralCommissioning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,92 @@ tests:
response:
constraints:
type: boolean

- label: "Read original regulatory location"
command: "readAttribute"
attribute: "RegulatoryConfig"
response:
saveAs: originalRegulatoryConfig

- label: "Read original location"
command: "readAttribute"
cluster: "Basic Information"
attribute: "Location"
response:
value: "XX"
saveAs: originalLocation

- label: "Try to SetRegulatoryConfig with 0-length country code"
command: "SetRegulatoryConfig"
arguments:
values:
- name: "NewRegulatoryConfig"
value: 0
- name: "CountryCode"
value: ""
- name: "Breadcrumb"
value: 0
response:
error: CONSTRAINT_ERROR

- label: "Read back location"
command: "readAttribute"
cluster: "Basic Information"
attribute: "Location"
response:
value: originalLocation

- label: "Try to SetRegulatoryConfig with length-1 country code"
command: "SetRegulatoryConfig"
arguments:
values:
- name: "NewRegulatoryConfig"
value: 0
- name: "CountryCode"
value: "U"
- name: "Breadcrumb"
value: 0
response:
error: CONSTRAINT_ERROR

- label: "Read back location second time"
command: "readAttribute"
cluster: "Basic Information"
attribute: "Location"
response:
value: originalLocation

- label: "Try to SetRegulatoryConfig with length-2 country code"
command: "SetRegulatoryConfig"
arguments:
values:
- name: "NewRegulatoryConfig"
value: 0
- name: "CountryCode"
value: "US"
- name: "Breadcrumb"
value: 0
response:
values:
- name: "ErrorCode"
value: 0
- name: "DebugText"
value: ""

- label: "Read back location third time"
command: "readAttribute"
cluster: "Basic Information"
attribute: "Location"
response:
value: "US"

- label: "Restore initial values"
command: "SetRegulatoryConfig"
arguments:
values:
- name: "NewRegulatoryConfig"
value: originalRegulatoryConfig
- name: "CountryCode"
value: originalLocation
- name: "Breadcrumb"
value: 0
157 changes: 155 additions & 2 deletions 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 4145190

Please sign in to comment.