From 1277359c33170f2823df68ba60e20ed2af7843a4 Mon Sep 17 00:00:00 2001 From: manjunathambiger23 Date: Fri, 21 Jan 2022 01:30:48 +0530 Subject: [PATCH] Added YAML Test Cases - Jan 19th (#13700) * Adding following testcases 1.TC_BRAC_1_1 2.TC_ETHDIAG_1_1 3.TC_ETHDIAG_2_1 4.TC_PS_1_1 5.TC_SWTCH_2_1 6.TC_SWTCH_2_2 7.TC_WIFIDIAG_1_1 8.TC_WIFIDIAG_3_1 * Adding auto generated files --- examples/chip-tool/templates/tests.js | 28 + .../certification/Test_TC_BRAC_1_1.yaml | 37 + .../certification/Test_TC_ETHDIAG_1_1.yaml | 162 ++ .../certification/Test_TC_ETHDIAG_2_1.yaml | 64 + .../suites/certification/Test_TC_PS_1_1.yaml | 94 ++ .../certification/Test_TC_SWTCH_2_1.yaml | 66 + .../certification/Test_TC_SWTCH_2_2.yaml | 514 ++++++ .../certification/Test_TC_WIFIDIAG_1_1.yaml | 216 +++ .../certification/Test_TC_WIFIDIAG_3_1.yaml | 72 + src/darwin/Framework/CHIP/templates/tests.js | 28 + .../Framework/CHIPTests/CHIPClustersTests.m | 880 +++++++++- .../chip-tool/zap-generated/test/Commands.h | 1484 +++++++++++++++++ 12 files changed, 3585 insertions(+), 60 deletions(-) create mode 100644 src/app/tests/suites/certification/Test_TC_BRAC_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_ETHDIAG_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_ETHDIAG_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_PS_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_SWTCH_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_SWTCH_2_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_WIFIDIAG_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_WIFIDIAG_3_1.yaml diff --git a/examples/chip-tool/templates/tests.js b/examples/chip-tool/templates/tests.js index 2a8a71863dfa33..a85b63d25dc961 100644 --- a/examples/chip-tool/templates/tests.js +++ b/examples/chip-tool/templates/tests.js @@ -28,6 +28,10 @@ function getTests() 'Test_TC_BOOL_2_1', ]; + const BridgedActions = [ + 'Test_TC_BRAC_1_1', + ]; + const ColorControl = [ 'Test_TC_CC_1_1', 'Test_TC_CC_2_1', @@ -72,6 +76,11 @@ function getTests() 'Test_TC_EMR_1_1', ]; + const EthernetNetworkDiagnostics = [ + 'Test_TC_ETHDIAG_1_1', + 'Test_TC_ETHDIAG_2_1', + ]; + const FlowMeasurement = [ 'Test_TC_FLW_1_1', 'Test_TC_FLW_2_1', @@ -132,6 +141,10 @@ function getTests() 'Test_TC_OO_2_3', ]; + const PowerSource = [ + 'Test_TC_PS_1_1', + ]; + const PressureMeasurement = [ 'Test_TC_PRS_1_1', 'Test_TC_PRS_2_1', @@ -150,6 +163,11 @@ function getTests() 'Test_TC_RH_2_2', ]; + const Switch = [ + 'Test_TC_SWTCH_2_1', + 'Test_TC_SWTCH_2_2', + ]; + const TemperatureMeasurement = [ 'Test_TC_TM_1_1', 'Test_TC_TM_2_1', @@ -172,6 +190,11 @@ function getTests() 'Test_TC_DIAGTH_1_1', ]; + const WiFiNetworkDiagnostics = [ + 'Test_TC_WIFIDIAG_1_1', + 'Test_TC_WIFIDIAG_3_1', + ]; + const WindowCovering = [ 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', @@ -229,23 +252,28 @@ function getTests() const tests = [ BinaryInput, // BooleanState, // + BridgedActions, // ColorControl, // DeviceDiscovery, // DeviceManagement, // ElectricalMeasurement, // + EthernetNetworkDiagnostics, // FlowMeasurement, // IlluminanceMeasurement, // LevelControl, // MediaControl, // OccupancySensing, // OnOff, // + PowerSource, // PressureMeasurement, // PumpConfigurationControl, // RelativeHumidityMeasurement, // + Switch, // TemperatureMeasurement, // Thermostat, // ThermostatUserConfiguration, // ThreadNetworkDiagnostics, // + WiFiNetworkDiagnostics, // WindowCovering, // TV, // Others, // diff --git a/src/app/tests/suites/certification/Test_TC_BRAC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_BRAC_1_1.yaml new file mode 100644 index 00000000000000..7cb7fcc9e8a35a --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_BRAC_1_1.yaml @@ -0,0 +1,37 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 77.1.1. [TC-BRAC-1.1] Global attributes with server as DUT + +config: + cluster: "Bridged Actions" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + + - label: "Read the global attribute constraints: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + constraints: + type: uint16 diff --git a/src/app/tests/suites/certification/Test_TC_ETHDIAG_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ETHDIAG_1_1.yaml new file mode 100644 index 00000000000000..c919838d9881fe --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_ETHDIAG_1_1.yaml @@ -0,0 +1,162 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 48.1.1. [TC-ETHDIAG-1.1] Attributes with server as DUT + +config: + cluster: "Ethernet Network Diagnostics" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #Disabled due to issue #11670 and #13648 + - label: "Read PHYRate attribute" + disabled: true + command: "readAttribute" + attribute: "PHYRate" + response: + value: null + + - label: "Read PHYRate attribute constraints" + disabled: true + command: "readAttribute" + attribute: "PHYRate" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 9 + + - label: "Read FullDuplex attribute" + disabled: true + command: "readAttribute" + attribute: "FullDuplex" + response: + value: null + + - label: "Read FullDuplex attribute constraints" + disabled: true + command: "readAttribute" + attribute: "FullDuplex" + response: + constraints: + type: bool + + - label: "Read PacketRxCount attribute" + disabled: true + command: "readAttribute" + attribute: "PacketRxCount" + response: + value: 0 + + - label: "Read PacketRxCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "PacketRxCount" + response: + constraints: + type: uint64 + + - label: "Read PacketTxCount attribute" + disabled: true + command: "readAttribute" + attribute: "PacketTxCount" + response: + value: 0 + + - label: "Read PacketTxCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "PacketTxCount" + response: + constraints: + type: uint64 + + - label: "Read TxErrCount attribute" + disabled: true + command: "readAttribute" + attribute: "TxErrCount" + response: + value: 0 + + - label: "Read TxErrCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "TxErrCount" + response: + constraints: + type: uint64 + + - label: "Read CollisionCount attribute" + disabled: true + command: "readAttribute" + attribute: "CollisionCount" + response: + value: 0 + + - label: "Read CollisionCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "CollisionCount" + response: + constraints: + type: uint64 + + - label: "Read OverrunCount attribute" + disabled: true + command: "readAttribute" + attribute: "OverrunCount" + response: + value: 0 + + - label: "Read OverrunCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "OverrunCount" + response: + constraints: + type: uint64 + + - label: "Read CarrierDetect attribute" + disabled: true + command: "readAttribute" + attribute: "CarrierDetect" + response: + value: null + + - label: "Read CarrierDetect attribute constraints" + disabled: true + command: "readAttribute" + attribute: "CarrierDetect" + response: + constraints: + type: bool + + - label: "Read TimeSinceReset attribute" + disabled: true + command: "readAttribute" + attribute: "TimeSinceReset" + response: + value: 0 + + - label: "Read TimeSinceReset attribute constraints" + disabled: true + command: "readAttribute" + attribute: "TimeSinceReset" + response: + constraints: + type: uint64 diff --git a/src/app/tests/suites/certification/Test_TC_ETHDIAG_2_1.yaml b/src/app/tests/suites/certification/Test_TC_ETHDIAG_2_1.yaml new file mode 100644 index 00000000000000..a488632be2eeff --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_ETHDIAG_2_1.yaml @@ -0,0 +1,64 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 48.1.3. [TC-ETHDIAG-2.1] Command received functionality with server as DUT + +config: + cluster: "Ethernet Network Diagnostics" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #Below steps disabled due to issue #13648 + - label: "Sends ResetCounts command" + disabled: true + command: "ResetCounts" + + - label: "Read the PacketRxCount attribute" + disabled: true + command: "readAttribute" + attribute: "PacketRxCount" + response: + value: 0 + + - label: "Read the PacketTxCount attribute" + disabled: true + command: "readAttribute" + attribute: "PacketTxCount" + response: + value: 0 + + - label: "Read the TxErrCount attribute" + disabled: true + command: "readAttribute" + attribute: "TxErrCount" + response: + value: 0 + + - label: "Read the CollisionCount attribute" + disabled: true + command: "readAttribute" + attribute: "CollisionCount" + response: + value: 0 + + - label: "Read the OverrunCount attribute" + disabled: true + command: "readAttribute" + attribute: "OverrunCount" + response: + value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_PS_1_1.yaml b/src/app/tests/suites/certification/Test_TC_PS_1_1.yaml new file mode 100644 index 00000000000000..061aba72bef687 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_PS_1_1.yaml @@ -0,0 +1,94 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 62.1.1. [TC-PS-1.1] Global attributes with server as DUT + +config: + cluster: "Power Source" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + - label: "read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + + - label: "Read the global attribute constraints: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + constraints: + type: uint16 + + - label: + "write the default values to mandatory global attribute: + ClusterRevision" + command: "writeAttribute" + attribute: "ClusterRevision" + arguments: + value: 1 + response: + error: UNSUPPORTED_WRITE + + - label: "reads back global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + + #issue #11053 disabled steps below Global attributes missing from YAML framework + - label: "Read the global attribute: EventList" + disabled: true + command: "readAttribute" + attribute: "EventList" + response: + constraints: + type: list + + - label: "Read the global attribute: ClientGeneratedCommandList" + disabled: true + command: "readAttribute" + attribute: "ClientGeneratedCommandList" + response: + constraints: + type: list + + - label: "Read the global attribute: ServerGeneratedCommandList" + disabled: true + command: "readAttribute" + attribute: "ServerGeneratedCommandList" + response: + constraints: + type: list + + #disabled due to issue #13442 + - label: "Read the optional global attribute : FeatureMap" + disabled: true + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: map32 diff --git a/src/app/tests/suites/certification/Test_TC_SWTCH_2_1.yaml b/src/app/tests/suites/certification/Test_TC_SWTCH_2_1.yaml new file mode 100644 index 00000000000000..e112b0da7cfbce --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_SWTCH_2_1.yaml @@ -0,0 +1,66 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 74.2.1. [TC-SWTCH-2.1] Attributes with server as DUT + +config: + cluster: "Switch" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + - label: "Read NumberOfPositions attribute" + command: "readAttribute" + attribute: "number of positions" + response: + value: 2 + + - label: "Read NumberOfPositions attribute" + command: "readAttribute" + attribute: "number of positions" + response: + constraints: + type: uint8 + minValue: 2 + + - label: "Read CurrentPosition attribute" + command: "readAttribute" + attribute: "current position" + response: + value: 0 + + - label: "Read CurrentPosition attribute" + command: "readAttribute" + attribute: "current position" + response: + constraints: + type: uint8 + minValue: 0 + + - label: "Read MultiPressMax attribute" + command: "readAttribute" + attribute: "multi press max" + response: + value: 2 + + - label: "Read MultiPressMax attribute" + command: "readAttribute" + attribute: "multi press max" + response: + constraints: + type: uint8 + minValue: 2 diff --git a/src/app/tests/suites/certification/Test_TC_SWTCH_2_2.yaml b/src/app/tests/suites/certification/Test_TC_SWTCH_2_2.yaml new file mode 100644 index 00000000000000..71f7849f2d39d8 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_SWTCH_2_2.yaml @@ -0,0 +1,514 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 74.2.2. [TC-SWTCH-2.2] Primary functionality with server as DUT + +config: + cluster: "Switch" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #### 2: tests for Latching Switch + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Set up subscription to SwitchLatched event" + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator sets switch to first position" + + - label: "Read CurrentPosition attribute" + command: "readAttribute" + attribute: "current position" + response: + value: 0 + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator sets switch to second position" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "SwitchLatched event with NewPosition set to 1" + disabled: true + + - label: "Read CurrentPosition attribute" + disabled: true + command: "readAttribute" + attribute: "current position" + response: + value: 1 + + #Disabled due to issue #11343 -- Event verification not implemented + - label: + "SwitchLatched event with NewPosition set to 1 higher than in previous + event" + disabled: true + + - label: "Read CurrentPosition attribute" + disabled: true + command: "readAttribute" + attribute: "current position" + response: + value: 2 + + #Disabled due to issue #11343 -- Event verification not implemented + - label: + "SwitchLatched event with NewPosition set to 1 higher than in previous + event" + disabled: true + + - label: "Read CurrentPosition attribute" + disabled: true + command: "readAttribute" + attribute: "current position" + response: + value: 3 + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "SwitchLatched event with NewPosition set to 0" + disabled: true + + - label: "Read CurrentPosition attribute" + disabled: true + command: "readAttribute" + attribute: "current position" + response: + value: 0 + + ### 3: tests for Momentary Switch + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Set up subscription to InitialPress event" + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator does not operate switch" + + - label: "Read CurrentPosition attribute" + command: "readAttribute" + attribute: "current position" + response: + value: 0 + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator sets switch to second position" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "InitialPress event with NewPosition set to 1" + disabled: true + + - label: "Read CurrentPosition attribute" + disabled: true + command: "readAttribute" + attribute: "current position" + response: + value: 1 + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator does not operate switch (release switch)" + + - label: "Read CurrentPosition attribute" + disabled: true + command: "readAttribute" + attribute: "current position" + response: + value: 0 + + ## 4: tests for Momentary Switch with release capability but not long press capabilities + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "Set up subscription to InitialPress and ShortRelease events" + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator does not operate switch" + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator operates switch (press briefly)" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "InitialPress event with NewPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator releases switch" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "ShortRelease event with PreviousPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator operates switch for 5 seconds" + + - label: "Wait 3000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 3000 + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "InitialPress event with NewPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator releases switch" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "ShortRelease event with PreviousPosition set to 1" + disabled: true + + ## 5: tests for Momentary Switch with release and long press capabilitie + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "Set up subscription to InitialPress, LongPress, + ShortRelease, LongRelease events" + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator does not operate switch" + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator operates switch (press briefly)" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "InitialPress event with NewPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator releases switch" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "ShortRelease event with PreviousPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator operates switch for 5 seconds" + + - label: "Wait 3000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 3000 + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "InitialPress event with NewPosition set to 1" + disabled: true + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "LongPress event with NewPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator releases switch" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "LongRelease event with PreviousPosition set to 1" + disabled: true + + ## 6: tests for Momentary Switch with multi-press capabilities + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "Set up subscription to InitialPress, ShortRelease, + MultiPressOngoing, MultiPressComplete events" + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator does not operate switch" + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator operates switch (press briefly)" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "InitialPress event with NewPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator releases switch" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "ShortRelease event with PreviousPosition set to 1" + disabled: true + + #Disabled due to issue #11343 -- Event verification not implemented + - label: + "MultiPressComplete event with PreviousPosition set to 1 and + TotalNumberOfPressesCounted set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator operates switch (press briefly)" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "InitialPress event with NewPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator releases switch" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "ShortRelease event with PreviousPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator operates switch again (press briefly)" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "InitialPress event with NewPosition set to 1" + disabled: true + + #Disabled due to issue #11343 -- Event verification not implemented + - label: + "MultiPressComplete event with PreviousPosition set to 1 and + TotalNumberOfPressesCounted set to 2" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator releases switch" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "ShortRelease event with PreviousPosition set to 1" + disabled: true + + #Disabled due to issue #11343 -- Event verification not implemented + - label: + "MultiPressComplete event with PreviousPosition set to 1 and + TotalNumberOfPressesCounted set to 1" + disabled: true + + # 6i + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator operates switch again (press briefly)" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "InitialPress event with NewPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator releases switch" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "ShortRelease event with PreviousPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator operates switch again (press briefly)" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "InitialPress event with NewPosition set to 1" + disabled: true + + #Disabled due to issue #11343 -- Event verification not implemented + - label: + "MultiPressOngoing event with NewPosition set to 1 and + CurrentNumberOfPressesCounted set to 2" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator releases switch" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "ShortRelease event with PreviousPosition set to 1" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator operates switch again (press briefly)" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "InitialPress event with NewPosition set to 1" + disabled: true + + #Disabled due to issue #11343 -- Event verification not implemented + - label: + "MultiPressOngoing event with NewPosition set to 1 and + CurrentNumberOfPressesCounted set to 3" + disabled: true + + - label: "User interaction needed" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Operator releases switch" + + #Disabled due to issue #11343 -- Event verification not implemented + - label: "ShortRelease event with PreviousPosition set to 1" + disabled: true + + #Disabled due to issue #11343 -- Event verification not implemented + - label: + "MultiPressComplete event with PreviousPosition set to 1 and + TotalNumberOfPressesCounted set to 3" + disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_WIFIDIAG_1_1.yaml b/src/app/tests/suites/certification/Test_TC_WIFIDIAG_1_1.yaml new file mode 100644 index 00000000000000..6258d1750d4ac3 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WIFIDIAG_1_1.yaml @@ -0,0 +1,216 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 54.1.1. [TC-WIFIDIAG-1.1] Attributes with server as DUT + +config: + cluster: "WiFi Network Diagnostics" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #Below steps disabled due to issue #13645 and 11670 + - label: "Reads NetworkInterface structure attribute from DUT" + disabled: true + cluster: "General Diagnostics" + command: "readAttribute" + attribute: "NetworkInterfaces" + response: + constraints: + type: list + + - label: "Reads SecurityType attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "SecurityType" + response: + value: null + + - label: "Reads SecurityType attribute constraints" + disabled: true + command: "readAttribute" + attribute: "SecurityType" + response: + constraints: + type: enum + + - label: "Reads WiFiVersion attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "WiFiVersion" + response: + value: null + + - label: "Reads WiFiVersion attribute constraints" + disabled: true + command: "readAttribute" + attribute: "WiFiVersion" + response: + constraints: + type: enum + + - label: "Reads ChannelNumber attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "ChannelNumber" + response: + value: null + + - label: "Reads ChannelNumber attribute constraints" + disabled: true + command: "readAttribute" + attribute: "ChannelNumber" + response: + constraints: + type: uint16 + + - label: "Reads RSSI attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "RSSI" + response: + value: null + + - label: "Reads RSSI attribute constraints" + disabled: true + command: "readAttribute" + attribute: "RSSI" + response: + constraints: + type: int8 + minValue: -120 + maxValue: 0 + + - label: "Reads BeaconLostCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "BeaconLostCount" + response: + value: 0 + + - label: "Reads BeaconLostCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "BeaconLostCount" + response: + constraints: + type: uint32 + + - label: "Reads BeaconRxCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "BeaconRxCount" + response: + value: 0 + + - label: "Reads BeaconRxCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "BeaconRxCount" + response: + constraints: + type: uint32 + + - label: "Reads PacketMulticastRxCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "PacketMulticastRxCount" + response: + value: 0 + + - label: "Reads PacketMulticastRxCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "PacketMulticastRxCount" + response: + constraints: + type: uint32 + + - label: "Reads PacketMulticastTxCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "PacketMulticastTxCount" + response: + value: 0 + + - label: "Reads PacketMulticastTxCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "PacketMulticastTxCount" + response: + constraints: + type: uint32 + + - label: "Reads PacketUnicastRxCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "PacketUnicastRxCount" + response: + value: 0 + + - label: "Reads PacketUnicastRxCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "PacketUnicastRxCount" + response: + constraints: + type: uint32 + + - label: "Reads PacketUnicastTxCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "PacketUnicastTxCount" + response: + value: 0 + + - label: "Reads PacketUnicastTxCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "PacketUnicastTxCount" + response: + constraints: + type: uint32 + + - label: "Reads CurrentMaxRate attribute from DUT" + optional: true + command: "readAttribute" + attribute: "CurrentMaxRate" + response: + value: 0 + + - label: "Reads CurrentMaxRate attribute constraints" + optional: true + command: "readAttribute" + attribute: "CurrentMaxRate" + response: + constraints: + type: uint64 + + - label: "Reads OverrunCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OverrunCount" + response: + value: 0 + + - label: "Reads OverrunCount attribute constraints" + disabled: true + command: "readAttribute" + attribute: "OverrunCount" + response: + constraints: + type: uint64 diff --git a/src/app/tests/suites/certification/Test_TC_WIFIDIAG_3_1.yaml b/src/app/tests/suites/certification/Test_TC_WIFIDIAG_3_1.yaml new file mode 100644 index 00000000000000..ba69ea1d0917c7 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WIFIDIAG_3_1.yaml @@ -0,0 +1,72 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: + 54.2.3. [TC-WIFIDIAG-3.1] Command received functionality with server as DUT + +config: + cluster: "WiFi Network Diagnostics" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #Below steps disabled due to issue #13645 + - label: "TH sends ResetCounts command to DUT" + disabled: true + command: "ResetCounts" + + - label: "Reads BeaconLostCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "BeaconLostCount" + response: + value: 0 + + - label: "Reads BeaconRxCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "BeaconRxCount" + response: + value: 0 + + - label: "Reads PacketMulticastRxCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "PacketMulticastRxCount" + response: + value: 0 + + - label: "Reads PacketMulticastTxCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "PacketMulticastTxCount" + response: + value: 0 + + - label: "Reads PacketUnicastRxCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "PacketUnicastRxCount" + response: + value: 0 + + - label: "Reads PacketUnicastTxCount attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "PacketUnicastTxCount" + response: + value: 0 diff --git a/src/darwin/Framework/CHIP/templates/tests.js b/src/darwin/Framework/CHIP/templates/tests.js index 09c410c0bbfd22..acbd8c6b86a8e5 100644 --- a/src/darwin/Framework/CHIP/templates/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests.js @@ -28,6 +28,10 @@ function getTests() 'Test_TC_BOOL_2_1', ]; + const BridgedActions = [ + 'Test_TC_BRAC_1_1', + ]; + const ColorControl = [ 'Test_TC_CC_1_1', 'Test_TC_CC_2_1', @@ -71,6 +75,11 @@ function getTests() 'Test_TC_EMR_1_1', ]; + const EthernetNetworkDiagnostics = [ + 'Test_TC_ETHDIAG_1_1', + 'Test_TC_ETHDIAG_2_1', + ]; + const FlowMeasurement = [ 'Test_TC_FLW_1_1', 'Test_TC_FLW_2_1', @@ -131,6 +140,10 @@ function getTests() 'Test_TC_OO_2_3', ]; + const PowerSource = [ + 'Test_TC_PS_1_1', + ]; + const PressureMeasurement = [ 'Test_TC_PRS_1_1', 'Test_TC_PRS_2_1', @@ -149,6 +162,11 @@ function getTests() 'Test_TC_RH_2_2', ]; + const Switch = [ + 'Test_TC_SWTCH_2_1', + 'Test_TC_SWTCH_2_2', + ]; + const TemperatureMeasurement = [ 'Test_TC_TM_1_1', 'Test_TC_TM_2_1', @@ -171,6 +189,11 @@ function getTests() 'Test_TC_DIAGTH_1_1', ]; + const WiFiNetworkDiagnostics = [ + 'Test_TC_WIFIDIAG_1_1', + 'Test_TC_WIFIDIAG_3_1', + ]; + const WindowCovering = [ 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', @@ -210,23 +233,28 @@ function getTests() const tests = [ BinaryInput, // BooleanState, // + BridgedActions, // ColorControl, // DeviceDiscovery, // DeviceManagement, // ElectricalMeasurement, // + EthernetNetworkDiagnostics, // FlowMeasurement, // IlluminanceMeasurement, // LevelControl, // MediaControl, // OccupancySensing, // OnOff, // + PowerSource, // PressureMeasurement, // PumpConfigurationControl, // RelativeHumidityMeasurement, // + Switch, // TemperatureMeasurement, // Thermostat, // ThermostatUserConfiguration, // ThreadNetworkDiagnostics, // + WiFiNetworkDiagnostics, // WindowCovering, // Others, // SoftwareDiagnostics, // diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 0ac11afb64aa39..784f77cfc82a02 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -1001,6 +1001,58 @@ - (void)testSendClusterTest_TC_BOOL_2_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_BRAC_1_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BRAC_1_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedShortValue], 1U); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BRAC_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTest_TC_CC_1_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; @@ -10424,6 +10476,24 @@ - (void)testSendClusterTest_TC_EMR_1_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_ETHDIAG_1_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_ETHDIAG_2_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTest_TC_FLW_1_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; @@ -15939,6 +16009,124 @@ - (void)testSendClusterTest_TC_OO_2_3_000046_Off [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_PS_1_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PS_1_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedShortValue], 1U); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PS_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PS_1_1_000003_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id clusterRevisionArgument; + clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PS_1_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedShortValue], 1U); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PS_1_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTest_TC_PRS_1_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; @@ -18111,7 +18299,7 @@ - (void)testSendClusterTest_TC_RH_2_2_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TM_1_1_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_SWTCH_2_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; @@ -18119,25 +18307,23 @@ - (void)testSendClusterTest_TC_TM_1_1_000000_WaitForCommissionee WaitForCommissionee(expectation, queue); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TM_1_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_SWTCH_2_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read NumberOfPositions attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeNumberOfPositionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read NumberOfPositions attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 3U); + XCTAssertEqual([actualValue unsignedCharValue], 2); } [expectation fulfill]; @@ -18145,71 +18331,75 @@ - (void)testSendClusterTest_TC_TM_1_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TM_1_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_SWTCH_2_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read NumberOfPositions attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster readAttributeNumberOfPositionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read NumberOfPositions attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 2); + } + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TM_1_1_000003_WriteAttribute +- (void)testSendClusterTest_TC_SWTCH_2_1_000003_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentPosition attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:3U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read CurrentPosition attribute Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TM_1_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_SWTCH_2_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentPosition attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read CurrentPosition attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 3U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } } [expectation fulfill]; @@ -18217,45 +18407,540 @@ - (void)testSendClusterTest_TC_TM_1_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_TM_2_1_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TM_2_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_SWTCH_2_1_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read MultiPressMax attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + [cluster readAttributeMultiPressMaxWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read MultiPressMax attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 2); + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TM_2_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_SWTCH_2_1_000006_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: Tolerance"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read MultiPressMax attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMultiPressMaxWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read MultiPressMax attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 2); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_SWTCH_2_2_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000001_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Set up subscription to SwitchLatched event"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000002_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator sets switch to first position"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentPosition attribute"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read CurrentPosition attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000004_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator sets switch to second position"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000005_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Set up subscription to InitialPress event"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000006_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator does not operate switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000007_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentPosition attribute"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestSwitch * cluster = [[CHIPTestSwitch alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentPositionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read CurrentPosition attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000008_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator sets switch to second position"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000009_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator does not operate switch (release switch)"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000010_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Set up subscription to InitialPress and ShortRelease events"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000011_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator does not operate switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000012_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator operates switch (press briefly)"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000013_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator releases switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000014_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator operates switch for 5 seconds"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000015_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000016_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator releases switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000017_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Set up subscription to InitialPress, LongPress, ShortRelease, LongRelease events"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000018_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator does not operate switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000019_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator operates switch (press briefly)"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000020_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator releases switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000021_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator operates switch for 5 seconds"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000022_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000023_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator releases switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000024_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt( + expectation, queue, @"Set up subscription to InitialPress, ShortRelease, MultiPressOngoing, MultiPressComplete events"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000025_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator does not operate switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000026_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator operates switch (press briefly)"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000027_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator releases switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000028_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator operates switch (press briefly)"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000029_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator releases switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000030_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator operates switch again (press briefly)"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000031_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator releases switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000032_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator operates switch again (press briefly)"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000033_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator releases switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000034_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator operates switch again (press briefly)"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000035_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator releases switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000036_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator operates switch again (press briefly)"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_SWTCH_2_2_000037_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"User interaction needed"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Operator releases switch"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_TM_1_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TM_1_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedShortValue], 3U); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TM_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TM_1_1_000003_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + id clusterRevisionArgument; + clusterRevisionArgument = [NSNumber numberWithUnsignedShort:3U]; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TM_1_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedShortValue], 3U); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_TM_2_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TM_2_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TM_2_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: Tolerance"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; XCTAssertNotNil(cluster); [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { @@ -22133,6 +22818,81 @@ - (void)testSendClusterTest_TC_DIAGTH_1_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_WIFIDIAG_1_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WIFIDIAG_1_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentMaxRate attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentMaxRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads CurrentMaxRate attribute from DUT Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedLongLongValue], 0ULL); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WIFIDIAG_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentMaxRate attribute constraints"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentMaxRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads CurrentMaxRate attribute constraints Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_WIFIDIAG_3_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTest_TC_WNCV_1_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index bff0c88cffa561..1b9df2687ea5d3 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -37,6 +37,7 @@ class TestList : public Command printf("Test_TC_BI_2_2\n"); printf("Test_TC_BOOL_1_1\n"); printf("Test_TC_BOOL_2_1\n"); + printf("Test_TC_BRAC_1_1\n"); printf("Test_TC_CC_1_1\n"); printf("Test_TC_CC_2_1\n"); printf("Test_TC_CC_3_1\n"); @@ -69,6 +70,8 @@ class TestList : public Command printf("Test_TC_DM_3_1\n"); printf("Test_TC_DM_2_2\n"); printf("Test_TC_EMR_1_1\n"); + printf("Test_TC_ETHDIAG_1_1\n"); + printf("Test_TC_ETHDIAG_2_1\n"); printf("Test_TC_FLW_1_1\n"); printf("Test_TC_FLW_2_1\n"); printf("Test_TC_FLW_2_2\n"); @@ -111,6 +114,7 @@ class TestList : public Command printf("Test_TC_OO_2_1\n"); printf("Test_TC_OO_2_2\n"); printf("Test_TC_OO_2_3\n"); + printf("Test_TC_PS_1_1\n"); printf("Test_TC_PRS_1_1\n"); printf("Test_TC_PRS_2_1\n"); printf("Test_TC_PCC_1_1\n"); @@ -120,6 +124,8 @@ class TestList : public Command printf("Test_TC_RH_1_1\n"); printf("Test_TC_RH_2_1\n"); printf("Test_TC_RH_2_2\n"); + printf("Test_TC_SWTCH_2_1\n"); + printf("Test_TC_SWTCH_2_2\n"); printf("Test_TC_TM_1_1\n"); printf("Test_TC_TM_2_1\n"); printf("Test_TC_TM_2_2\n"); @@ -130,6 +136,8 @@ class TestList : public Command printf("Test_TC_TSUIC_2_1\n"); printf("Test_TC_TSUIC_2_2\n"); printf("Test_TC_DIAGTH_1_1\n"); + printf("Test_TC_WIFIDIAG_1_1\n"); + printf("Test_TC_WIFIDIAG_3_1\n"); printf("Test_TC_WNCV_1_1\n"); printf("Test_TC_WNCV_2_1\n"); printf("Test_TC_WNCV_2_2\n"); @@ -1591,6 +1599,140 @@ class Test_TC_BOOL_2_1 : public TestCommand } }; +class Test_TC_BRAC_1_1 : public TestCommand +{ +public: + Test_TC_BRAC_1_1() : TestCommand("Test_TC_BRAC_1_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~Test_TC_BRAC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_BRAC_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BRAC_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_1(clusterRevision); + } + + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_2(clusterRevision); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::BridgedActionsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint16_t clusterRevision) + { + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); + + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::BridgedActionsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(uint16_t clusterRevision) + { + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + } +}; + class Test_TC_CC_1_1 : public TestCommand { public: @@ -16338,6 +16480,140 @@ class Test_TC_EMR_1_1 : public TestCommand } }; +class Test_TC_ETHDIAG_1_1 : public TestCommand +{ +public: + Test_TC_ETHDIAG_1_1() : TestCommand("Test_TC_ETHDIAG_1_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~Test_TC_ETHDIAG_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ETHDIAG_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ETHDIAG_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } +}; + +class Test_TC_ETHDIAG_2_1 : public TestCommand +{ +public: + Test_TC_ETHDIAG_2_1() : TestCommand("Test_TC_ETHDIAG_2_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~Test_TC_ETHDIAG_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ETHDIAG_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ETHDIAG_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } +}; + class Test_TC_FLW_1_1 : public TestCommand { public: @@ -26599,6 +26875,241 @@ class Test_TC_OO_2_3 : public TestCommand void OnSuccessResponse_46() { NextTest(); } }; +class Test_TC_PS_1_1 : public TestCommand +{ +public: + Test_TC_PS_1_1() : TestCommand("Test_TC_PS_1_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~Test_TC_PS_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PS_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PS_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); + err = TestReadsBackGlobalAttributeClusterRevision_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 6; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_1(clusterRevision); + } + + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_2(clusterRevision); + } + + static void OnFailureCallback_3(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_4(clusterRevision); + } + + static void OnFailureCallback_5(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, const chip::app::DataModel::DecodableList & attributeList) + { + (static_cast(context))->OnSuccessResponse_5(attributeList); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::PowerSourceClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint16_t clusterRevision) + { + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); + + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::PowerSourceClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(uint16_t clusterRevision) + { + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::PowerSourceClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 1U; + + ReturnErrorOnFailure(cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(EmberAfStatus status) + { + VerifyOrReturn(CheckValue("status", status, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + } + + void OnSuccessResponse_3() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::PowerSourceClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(uint16_t clusterRevision) + { + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); + + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::PowerSourceClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & attributeList) + { + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + } +}; + class Test_TC_PRS_1_1 : public TestCommand { public: @@ -30182,6 +30693,762 @@ class Test_TC_RH_2_2 : public TestCommand } }; +class Test_TC_SWTCH_2_1 : public TestCommand +{ +public: + Test_TC_SWTCH_2_1() : TestCommand("Test_TC_SWTCH_2_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~Test_TC_SWTCH_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWTCH_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWTCH_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read NumberOfPositions attribute\n"); + err = TestReadNumberOfPositionsAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read NumberOfPositions attribute\n"); + err = TestReadNumberOfPositionsAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read CurrentPosition attribute\n"); + err = TestReadCurrentPositionAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read CurrentPosition attribute\n"); + err = TestReadCurrentPositionAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read MultiPressMax attribute\n"); + err = TestReadMultiPressMaxAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read MultiPressMax attribute\n"); + err = TestReadMultiPressMaxAttribute_6(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 7; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint8_t numberOfPositions) + { + (static_cast(context))->OnSuccessResponse_1(numberOfPositions); + } + + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint8_t numberOfPositions) + { + (static_cast(context))->OnSuccessResponse_2(numberOfPositions); + } + + static void OnFailureCallback_3(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint8_t currentPosition) + { + (static_cast(context))->OnSuccessResponse_3(currentPosition); + } + + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, uint8_t currentPosition) + { + (static_cast(context))->OnSuccessResponse_4(currentPosition); + } + + static void OnFailureCallback_5(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, uint8_t multiPressMax) + { + (static_cast(context))->OnSuccessResponse_5(multiPressMax); + } + + static void OnFailureCallback_6(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, uint8_t multiPressMax) + { + (static_cast(context))->OnSuccessResponse_6(multiPressMax); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestReadNumberOfPositionsAttribute_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::SwitchClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint8_t numberOfPositions) + { + VerifyOrReturn(CheckValue("numberOfPositions", numberOfPositions, 2)); + + NextTest(); + } + + CHIP_ERROR TestReadNumberOfPositionsAttribute_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::SwitchClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(uint8_t numberOfPositions) + { + VerifyOrReturn(CheckConstraintType("numberOfPositions", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("numberOfPositions", numberOfPositions, 2)); + NextTest(); + } + + CHIP_ERROR TestReadCurrentPositionAttribute_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::SwitchClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint8_t currentPosition) + { + VerifyOrReturn(CheckValue("currentPosition", currentPosition, 0)); + + NextTest(); + } + + CHIP_ERROR TestReadCurrentPositionAttribute_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::SwitchClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(uint8_t currentPosition) + { + VerifyOrReturn(CheckConstraintType("currentPosition", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("currentPosition", currentPosition, 0)); + NextTest(); + } + + CHIP_ERROR TestReadMultiPressMaxAttribute_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::SwitchClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(uint8_t multiPressMax) + { + VerifyOrReturn(CheckValue("multiPressMax", multiPressMax, 2)); + + NextTest(); + } + + CHIP_ERROR TestReadMultiPressMaxAttribute_6() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::SwitchClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_6(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(uint8_t multiPressMax) + { + VerifyOrReturn(CheckConstraintType("multiPressMax", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("multiPressMax", multiPressMax, 2)); + NextTest(); + } +}; + +class Test_TC_SWTCH_2_2 : public TestCommand +{ +public: + Test_TC_SWTCH_2_2() : TestCommand("Test_TC_SWTCH_2_2"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~Test_TC_SWTCH_2_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWTCH_2_2\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWTCH_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : User interaction needed\n"); + err = TestUserInteractionNeeded_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : User interaction needed\n"); + err = TestUserInteractionNeeded_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read CurrentPosition attribute\n"); + err = TestReadCurrentPositionAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : User interaction needed\n"); + err = TestUserInteractionNeeded_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : User interaction needed\n"); + err = TestUserInteractionNeeded_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : User interaction needed\n"); + err = TestUserInteractionNeeded_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Read CurrentPosition attribute\n"); + err = TestReadCurrentPositionAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : User interaction needed\n"); + err = TestUserInteractionNeeded_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : User interaction needed\n"); + err = TestUserInteractionNeeded_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : User interaction needed\n"); + err = TestUserInteractionNeeded_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : User interaction needed\n"); + err = TestUserInteractionNeeded_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : User interaction needed\n"); + err = TestUserInteractionNeeded_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : User interaction needed\n"); + err = TestUserInteractionNeeded_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : User interaction needed\n"); + err = TestUserInteractionNeeded_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Wait 3000ms\n"); + err = TestWait3000ms_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : User interaction needed\n"); + err = TestUserInteractionNeeded_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : User interaction needed\n"); + err = TestUserInteractionNeeded_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : User interaction needed\n"); + err = TestUserInteractionNeeded_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : User interaction needed\n"); + err = TestUserInteractionNeeded_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : User interaction needed\n"); + err = TestUserInteractionNeeded_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : User interaction needed\n"); + err = TestUserInteractionNeeded_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Wait 3000ms\n"); + err = TestWait3000ms_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : User interaction needed\n"); + err = TestUserInteractionNeeded_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : User interaction needed\n"); + err = TestUserInteractionNeeded_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : User interaction needed\n"); + err = TestUserInteractionNeeded_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : User interaction needed\n"); + err = TestUserInteractionNeeded_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : User interaction needed\n"); + err = TestUserInteractionNeeded_27(); + break; + case 28: + ChipLogProgress(chipTool, " ***** Test Step 28 : User interaction needed\n"); + err = TestUserInteractionNeeded_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : User interaction needed\n"); + err = TestUserInteractionNeeded_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : User interaction needed\n"); + err = TestUserInteractionNeeded_30(); + break; + case 31: + ChipLogProgress(chipTool, " ***** Test Step 31 : User interaction needed\n"); + err = TestUserInteractionNeeded_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : User interaction needed\n"); + err = TestUserInteractionNeeded_32(); + break; + case 33: + ChipLogProgress(chipTool, " ***** Test Step 33 : User interaction needed\n"); + err = TestUserInteractionNeeded_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : User interaction needed\n"); + err = TestUserInteractionNeeded_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : User interaction needed\n"); + err = TestUserInteractionNeeded_35(); + break; + case 36: + ChipLogProgress(chipTool, " ***** Test Step 36 : User interaction needed\n"); + err = TestUserInteractionNeeded_36(); + break; + case 37: + ChipLogProgress(chipTool, " ***** Test Step 37 : User interaction needed\n"); + err = TestUserInteractionNeeded_37(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 38; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + static void OnFailureCallback_3(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint8_t currentPosition) + { + (static_cast(context))->OnSuccessResponse_3(currentPosition); + } + + static void OnFailureCallback_7(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, uint8_t currentPosition) + { + (static_cast(context))->OnSuccessResponse_7(currentPosition); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestUserInteractionNeeded_1() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Set up subscription to SwitchLatched event"); + } + + CHIP_ERROR TestUserInteractionNeeded_2() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator sets switch to first position"); + } + + CHIP_ERROR TestReadCurrentPositionAttribute_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::SwitchClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint8_t currentPosition) + { + VerifyOrReturn(CheckValue("currentPosition", currentPosition, 0)); + + NextTest(); + } + + CHIP_ERROR TestUserInteractionNeeded_4() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator sets switch to second position"); + } + + CHIP_ERROR TestUserInteractionNeeded_5() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Set up subscription to InitialPress event"); + } + + CHIP_ERROR TestUserInteractionNeeded_6() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator does not operate switch"); + } + + CHIP_ERROR TestReadCurrentPositionAttribute_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::SwitchClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(uint8_t currentPosition) + { + VerifyOrReturn(CheckValue("currentPosition", currentPosition, 0)); + + NextTest(); + } + + CHIP_ERROR TestUserInteractionNeeded_8() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator sets switch to second position"); + } + + CHIP_ERROR TestUserInteractionNeeded_9() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator does not operate switch (release switch)"); + } + + CHIP_ERROR TestUserInteractionNeeded_10() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Set up subscription to InitialPress and ShortRelease events"); + } + + CHIP_ERROR TestUserInteractionNeeded_11() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator does not operate switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_12() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch (press briefly)"); + } + + CHIP_ERROR TestUserInteractionNeeded_13() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_14() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch for 5 seconds"); + } + + CHIP_ERROR TestWait3000ms_15() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + + CHIP_ERROR TestUserInteractionNeeded_16() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_17() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Set up subscription to InitialPress, LongPress, ShortRelease, LongRelease events"); + } + + CHIP_ERROR TestUserInteractionNeeded_18() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator does not operate switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_19() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch (press briefly)"); + } + + CHIP_ERROR TestUserInteractionNeeded_20() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_21() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch for 5 seconds"); + } + + CHIP_ERROR TestWait3000ms_22() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + + CHIP_ERROR TestUserInteractionNeeded_23() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_24() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Set up subscription to InitialPress, ShortRelease, MultiPressOngoing, MultiPressComplete events"); + } + + CHIP_ERROR TestUserInteractionNeeded_25() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator does not operate switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_26() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch (press briefly)"); + } + + CHIP_ERROR TestUserInteractionNeeded_27() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_28() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch (press briefly)"); + } + + CHIP_ERROR TestUserInteractionNeeded_29() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_30() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch again (press briefly)"); + } + + CHIP_ERROR TestUserInteractionNeeded_31() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_32() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch again (press briefly)"); + } + + CHIP_ERROR TestUserInteractionNeeded_33() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_34() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch again (press briefly)"); + } + + CHIP_ERROR TestUserInteractionNeeded_35() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + + CHIP_ERROR TestUserInteractionNeeded_36() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch again (press briefly)"); + } + + CHIP_ERROR TestUserInteractionNeeded_37() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } +}; + class Test_TC_TM_1_1 : public TestCommand { public: @@ -36216,6 +37483,215 @@ class Test_TC_DIAGTH_1_1 : public TestCommand } }; +class Test_TC_WIFIDIAG_1_1 : public TestCommand +{ +public: + Test_TC_WIFIDIAG_1_1() : TestCommand("Test_TC_WIFIDIAG_1_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~Test_TC_WIFIDIAG_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WIFIDIAG_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WIFIDIAG_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads CurrentMaxRate attribute from DUT\n"); + err = TestReadsCurrentMaxRateAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads CurrentMaxRate attribute constraints\n"); + err = TestReadsCurrentMaxRateAttributeConstraints_2(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint64_t currentMaxRate) + { + (static_cast(context))->OnSuccessResponse_1(currentMaxRate); + } + + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint64_t currentMaxRate) + { + (static_cast(context))->OnSuccessResponse_2(currentMaxRate); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestReadsCurrentMaxRateAttributeFromDut_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WiFiNetworkDiagnosticsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(EmberAfStatus status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_1(uint64_t currentMaxRate) + { + VerifyOrReturn(CheckValue("currentMaxRate", currentMaxRate, 0ULL)); + + NextTest(); + } + + CHIP_ERROR TestReadsCurrentMaxRateAttributeConstraints_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WiFiNetworkDiagnosticsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_2(uint64_t currentMaxRate) + { + VerifyOrReturn(CheckConstraintType("currentMaxRate", "", "uint64")); + NextTest(); + } +}; + +class Test_TC_WIFIDIAG_3_1 : public TestCommand +{ +public: + Test_TC_WIFIDIAG_3_1() : TestCommand("Test_TC_WIFIDIAG_3_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~Test_TC_WIFIDIAG_3_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WIFIDIAG_3_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WIFIDIAG_3_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } +}; + class Test_TC_WNCV_1_1 : public TestCommand { public: @@ -66594,6 +68070,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -66626,6 +68103,8 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -66668,6 +68147,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -66677,6 +68157,8 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -66687,6 +68169,8 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),