Skip to content

Commit aa1e6ce

Browse files
bzbarsky-appleerwinpan1
authored andcommitted
Add some tests for SetRegulatoryConfig. (project-chip#28063)
We didn't seem to have any, apparently. This exercises the code changes made in project-chip#27949
1 parent 184d87b commit aa1e6ce

File tree

3 files changed

+551
-3
lines changed

3 files changed

+551
-3
lines changed

src/app/tests/suites/TestGeneralCommissioning.yaml

+89
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,92 @@ tests:
272272
response:
273273
constraints:
274274
type: boolean
275+
276+
- label: "Read original regulatory location"
277+
command: "readAttribute"
278+
attribute: "RegulatoryConfig"
279+
response:
280+
saveAs: originalRegulatoryConfig
281+
282+
- label: "Read original location"
283+
command: "readAttribute"
284+
cluster: "Basic Information"
285+
attribute: "Location"
286+
response:
287+
value: "XX"
288+
saveAs: originalLocation
289+
290+
- label: "Try to SetRegulatoryConfig with 0-length country code"
291+
command: "SetRegulatoryConfig"
292+
arguments:
293+
values:
294+
- name: "NewRegulatoryConfig"
295+
value: 0
296+
- name: "CountryCode"
297+
value: ""
298+
- name: "Breadcrumb"
299+
value: 0
300+
response:
301+
error: CONSTRAINT_ERROR
302+
303+
- label: "Read back location"
304+
command: "readAttribute"
305+
cluster: "Basic Information"
306+
attribute: "Location"
307+
response:
308+
value: originalLocation
309+
310+
- label: "Try to SetRegulatoryConfig with length-1 country code"
311+
command: "SetRegulatoryConfig"
312+
arguments:
313+
values:
314+
- name: "NewRegulatoryConfig"
315+
value: 0
316+
- name: "CountryCode"
317+
value: "U"
318+
- name: "Breadcrumb"
319+
value: 0
320+
response:
321+
error: CONSTRAINT_ERROR
322+
323+
- label: "Read back location second time"
324+
command: "readAttribute"
325+
cluster: "Basic Information"
326+
attribute: "Location"
327+
response:
328+
value: originalLocation
329+
330+
- label: "Try to SetRegulatoryConfig with length-2 country code"
331+
command: "SetRegulatoryConfig"
332+
arguments:
333+
values:
334+
- name: "NewRegulatoryConfig"
335+
value: 0
336+
- name: "CountryCode"
337+
value: "US"
338+
- name: "Breadcrumb"
339+
value: 0
340+
response:
341+
values:
342+
- name: "ErrorCode"
343+
value: 0
344+
- name: "DebugText"
345+
value: ""
346+
347+
- label: "Read back location third time"
348+
command: "readAttribute"
349+
cluster: "Basic Information"
350+
attribute: "Location"
351+
response:
352+
value: "US"
353+
354+
- label: "Restore initial values"
355+
command: "SetRegulatoryConfig"
356+
arguments:
357+
values:
358+
- name: "NewRegulatoryConfig"
359+
value: originalRegulatoryConfig
360+
- name: "CountryCode"
361+
value: originalLocation
362+
- name: "Breadcrumb"
363+
value: 0

zzz_generated/chip-tool/zap-generated/test/Commands.h

+155-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)