diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 48e0af5ffa754d..8ef506bf2d6362 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -481,6 +481,8 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' diff --git a/src/app/tests/suites/certification/Test_TC_FAN_3_1.yaml b/src/app/tests/suites/certification/Test_TC_FAN_3_1.yaml deleted file mode 100644 index e4f5410b413dd4..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_FAN_3_1.yaml +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright (c) 2023 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: 263.2.6. [TC-FAN-3.1] Mandatory functionality with DUT as Server - -PICS: - - FAN.S - -config: - nodeId: 0x12344321 - cluster: "Fan Control" - endpoint: 1 - ConfigPercentSetting: - type: int8u - defaultValue: 30 - -tests: - - label: "Step 1: Commission DUT to TH" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: - "Step 2a: TH writes a supported FanMode attribute that is other than - off to DUT" - PICS: FAN.S.A0000 - command: "writeAttribute" - attribute: "FanMode" - arguments: - value: 3 - - - label: "Wait 1000ms" - PICS: FAN.S.A0000 - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 1000 - - - label: - "Step 2b: after a few seconds, TH reads from the DUT the the FanMode - attribute" - PICS: FAN.S.A0000 - command: "readAttribute" - attribute: "FanMode" - response: - value: 3 - - - label: "Step 2.1a: TH writes the Off value of FanMode attribute to DUT" - PICS: FAN.S.A0000 - command: "writeAttribute" - attribute: "FanMode" - arguments: - value: 0 - - - label: "Wait 1000ms" - PICS: FAN.S.A0000 - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 1000 - - - label: "Step 2.1b: TH reads from the DUT the PercentSetting attribute" - PICS: FAN.S.A0002 - command: "readAttribute" - attribute: "PercentSetting" - response: - value: 0 - - - label: "Step 2.1c: TH reads from the DUT the PercentCurrent attribute" - PICS: FAN.S.A0003 - command: "readAttribute" - attribute: "PercentCurrent" - response: - value: 0 - - - label: - "Step 3a: TH writes PercentSetting attribute a non-zero value to DUT" - PICS: FAN.S.A0002 - command: "writeAttribute" - attribute: "PercentSetting" - arguments: - value: ConfigPercentSetting - - - label: "Wait 1000ms" - PICS: FAN.S.A0002 - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 1000 - - - label: "Step 3b: TH reads from the DUT the PercentCurrent attribute" - PICS: FAN.S.A0003 - command: "readAttribute" - attribute: "PercentCurrent" - response: - value: ConfigPercentSetting - - - label: "Step 3c: TH reads from the DUT the PercentSetting attribute" - PICS: FAN.S.A0002 - command: "readAttribute" - attribute: "PercentSetting" - response: - value: ConfigPercentSetting - - - label: "Step 3.1a: TH writes PercentSetting attribute a zero value to DUT" - PICS: FAN.S.A0002 - command: "writeAttribute" - attribute: "PercentSetting" - arguments: - value: 0 - - - label: "Wait 1000ms" - PICS: FAN.S.A0002 - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 1000 - - - label: - "Step 3.1b: after a few seconds, TH reads from the DUT the the FanMode - attribute" - PICS: FAN.S.A0000 - command: "readAttribute" - attribute: "FanMode" - response: - value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_FAN_3_2.yaml b/src/app/tests/suites/certification/Test_TC_FAN_3_2.yaml deleted file mode 100644 index e32e14af5bad43..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_FAN_3_2.yaml +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright (c) 2023 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: 263.2.7. [TC-FAN-3.2] Optional speed functionality with DUT as Server - -PICS: - - FAN.S - - FAN.S.F00 - -config: - nodeId: 0x12344321 - cluster: "Fan Control" - endpoint: 1 - -tests: - - label: "Step 1: Commission DUT to TH" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the SpeedMax attribute" - PICS: FAN.S.A0004 - command: "readAttribute" - attribute: "SpeedMax" - response: - saveAs: rSpeedMax - - - label: - "Step 3: TH writes to the DUT the a value less than or equal to the - value read in step 2" - PICS: FAN.S.A0005 - command: "writeAttribute" - attribute: "SpeedSetting" - arguments: - value: rSpeedMax - - - label: "Wait 1000ms" - PICS: FAN.S.A0005 - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 1000 - - - label: - "Step 4: After a few seconds, TH reads from the DUT the SpeedSetting - attribute" - PICS: FAN.S.A0005 - command: "readAttribute" - attribute: "SpeedSetting" - response: - value: rSpeedMax - - - label: "Step 5: TH reads from the DUT the SpeedCurrent attribute" - PICS: FAN.S.A0006 - command: "readAttribute" - attribute: "SpeedCurrent" - response: - value: rSpeedMax diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 9fed764e66db77..905b5f2ebd4999 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -64,8 +64,6 @@ "Test_TC_FAN_2_2", "Test_TC_FAN_2_3", "Test_TC_FAN_2_4", - "Test_TC_FAN_3_1", - "Test_TC_FAN_3_2", "Test_TC_FAN_3_6" ], "GeneralCommissioning": ["Test_TC_CGEN_1_1", "Test_TC_CGEN_2_1"], diff --git a/src/python_testing/TC_FAN_3_1.py b/src/python_testing/TC_FAN_3_1.py new file mode 100644 index 00000000000000..793aac71676348 --- /dev/null +++ b/src/python_testing/TC_FAN_3_1.py @@ -0,0 +1,151 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# 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. +# + +import logging +import time + +import chip.clusters as Clusters +from chip.interaction_model import Status +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class TC_FAN_3_1(MatterBaseTest): + + async def read_fc_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.FanControl + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + async def read_fan_mode(self, endpoint): + return await self.read_fc_attribute_expect_success(endpoint, Clusters.FanControl.Attributes.FanMode) + + async def read_percent_setting(self, endpoint): + return await self.read_fc_attribute_expect_success(endpoint, Clusters.FanControl.Attributes.PercentSetting) + + async def read_percent_current(self, endpoint): + return await self.read_fc_attribute_expect_success(endpoint, Clusters.FanControl.Attributes.PercentCurrent) + + async def write_fan_mode(self, endpoint, fan_mode) -> Status: + result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, Clusters.FanControl.Attributes.FanMode(fan_mode))]) + return result[0].Status + + async def write_percent_setting(self, endpoint, percent_setting) -> Status: + result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, Clusters.FanControl.Attributes.PercentSetting(percent_setting))]) + return result[0].Status + + def pics_TC_FAN_3_1(self) -> list[str]: + return ["FAN.S"] + + @async_test_body + async def test_TC_FAN_3_1(self): + endpoint = self.user_params.get("endpoint", 1) + + self.print_step(1, "Commissioning, already done") + + self.print_step("2a", "Read from the DUT the FanMode attribute and store") + existing_fan_mode = await self.read_fan_mode(endpoint=endpoint) + + self.print_step("2b", "Write High to FanMode") + status = await self.write_fan_mode(endpoint=endpoint, fan_mode=Clusters.FanControl.Enums.FanModeEnum.kHigh) + status_ok = (status == Status.Success) or (status == Status.InvalidInState) + asserts.assert_true(status_ok, "FanMode write did not return a value of Success or InvalidInState") + + self.print_step("2c", "After a few seconds, read from the DUT the FanMode attribute") + time.sleep(3) + + new_fan_mode = await self.read_fan_mode(endpoint=endpoint) + + if status == Status.Success: + asserts.assert_equal(new_fan_mode, Clusters.FanControl.Enums.FanModeEnum.kHigh, "FanMode is not High") + else: + asserts.assert_equal(new_fan_mode, existing_fan_mode, "FanMode is not unchanged") + + self.print_step("3a", "Read from the DUT the PercentSetting attribute and store") + existing_percent_setting = await self.read_percent_setting(endpoint=endpoint) + + self.print_step("3b", "Write Off to Fan Mode") + status = await self.write_fan_mode(endpoint=endpoint, fan_mode=Clusters.FanControl.Enums.FanModeEnum.kOff) + status_ok = (status == Status.Success) or (status == Status.InvalidInState) + asserts.assert_true(status_ok, "FanMode write did not return a value of Success or InvalidInState") + + self.print_step("3c", "After a few seconds, read from the DUT the PercentSetting attribute") + time.sleep(3) + + new_percent_setting = await self.read_percent_setting(endpoint=endpoint) + + if status == Status.Success: + asserts.assert_equal(new_percent_setting, Clusters.FanControl.Enums.FanModeEnum.kOff, "PercentSetting is not Off") + else: + asserts.assert_equal(new_percent_setting, existing_percent_setting, "PercentSetting is not unchanged") + + self.print_step("3d", "Read from the DUT the PercentCurrent attribute") + percent_current = await self.read_percent_current(endpoint=endpoint) + + if status == Status.Success: + asserts.assert_equal(percent_current, 0, "PercentCurrent is not 0") + else: + asserts.assert_equal(percent_current, existing_percent_setting, "PercentCurrent is not unchanged") + + self.print_step("4a", "Read from the DUT the PercentSetting attribute and store") + existing_percent_setting = await self.read_percent_setting(endpoint=endpoint) + + self.print_step("4b", "Write PercentSetting to 30") + status = await self.write_percent_setting(endpoint=endpoint, percent_setting=30) + status_ok = (status == Status.Success) or (status == Status.InvalidInState) + asserts.assert_true(status_ok, "PercentSetting write did not return a value of Success or InvalidInState") + + self.print_step("4c", "After a few seconds, read from the DUT the PercentSetting attribute") + time.sleep(3) + + new_percent_setting = await self.read_percent_setting(endpoint=endpoint) + + if status == Status.Success: + asserts.assert_equal(new_percent_setting, 30, "PercentSetting is not 30") + else: + asserts.assert_equal(new_percent_setting, existing_percent_setting, "PercentSetting is not unchanged") + + self.print_step("4d", "Read from the DUT the PercentCurrent attribute") + percent_current = await self.read_percent_current(endpoint=endpoint) + + if status == Status.Success: + asserts.assert_equal(percent_current, 30, "PercentCurrent is not 30") + else: + asserts.assert_equal(percent_current, existing_percent_setting, "PercentCurrent is not unchanged") + + self.print_step("5a", "Read from the DUT the FanMode attribute and store") + existing_fan_mode = await self.read_fan_mode(endpoint=endpoint) + + self.print_step("5b", "Write PercentSetting to 0") + status = await self.write_percent_setting(endpoint=endpoint, percent_setting=0) + status_ok = (status == Status.Success) or (status == Status.InvalidInState) + asserts.assert_true(status_ok, "PercentSetting write did not return a value of Success or InvalidInState") + + self.print_step("5c", "After a few seconds, read from the DUT the FanMode attribute") + time.sleep(3) + + new_fan_mode = await self.read_fan_mode(endpoint=endpoint) + + if status == Status.Success: + asserts.assert_equal(new_fan_mode, Clusters.FanControl.Enums.FanModeEnum.kOff, "FanMode is not Off") + else: + asserts.assert_equal(new_fan_mode, existing_fan_mode, "FanMode is not unchanged") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/TC_FAN_3_2.py b/src/python_testing/TC_FAN_3_2.py new file mode 100644 index 00000000000000..06a9c29b526e72 --- /dev/null +++ b/src/python_testing/TC_FAN_3_2.py @@ -0,0 +1,91 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# 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. +# + +import logging +import time + +import chip.clusters as Clusters +from chip.interaction_model import Status +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from mobly import asserts + +logger = logging.getLogger(__name__) + + +class TC_FAN_3_2(MatterBaseTest): + async def read_fc_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.FanControl + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + async def read_speed_setting(self, endpoint): + return await self.read_fc_attribute_expect_success(endpoint, Clusters.FanControl.Attributes.SpeedSetting) + + async def read_speed_current(self, endpoint): + return await self.read_fc_attribute_expect_success(endpoint, Clusters.FanControl.Attributes.SpeedCurrent) + + async def read_speed_max(self, endpoint): + return await self.read_fc_attribute_expect_success(endpoint, Clusters.FanControl.Attributes.SpeedMax) + + async def write_speed_setting(self, endpoint, speed_setting) -> Status: + result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, Clusters.FanControl.Attributes.SpeedSetting(speed_setting))]) + return result[0].Status + + def pics_TC_FAN_3_2(self) -> list[str]: + return ["FAN.S"] + + @async_test_body + async def test_TC_FAN_3_2(self): + if not self.check_pics("FAN.S.F00"): + logger.info("Test skipped because PICS FAN.S.F00 is not set") + return + + endpoint = self.user_params.get("endpoint", 1) + + self.print_step(1, "Commissioning, already done") + + self.print_step(2, "Read from the DUT the SpeedSetting attribute and store") + existing_speed_setting = await self.read_speed_setting(endpoint=endpoint) + + self.print_step(3, "Read from the DUT the SpeedMax attribute and store") + speed_max = await self.read_speed_max(endpoint=endpoint) + + self.print_step(4, "Write to the DUT the SpeedSetting attribute with value SpeedMax") + status = await self.write_speed_setting(endpoint=endpoint, speed_setting=speed_max) + status_ok = (status == Status.Success) or (status == Status.InvalidInState) + asserts.assert_true(status_ok, "SpeedSetting write did not return a value of Success or InvalidInState") + + self.print_step(5, "After a few seconds, read from the DUT the SpeedSetting attribute") + time.sleep(3) + + new_speed_setting = await self.read_speed_setting(endpoint=endpoint) + + if status == Status.Success: + asserts.assert_equal(new_speed_setting, speed_max, "SpeedSetting is not equal to SpeedMax") + else: + asserts.assert_equal(new_speed_setting, existing_speed_setting, "SpeedSetting is not unchanged") + + self.print_step(6, "Read from the DUT the SpeedCurrent attribute") + speed_current = await self.read_speed_current(endpoint=endpoint) + + if status == Status.Success: + asserts.assert_equal(speed_current, speed_max, "SpeedCurrent is not equal to SpeedMax") + else: + asserts.assert_equal(speed_current, existing_speed_setting, "SpeedCurrent is not unchanged") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 548c417fcafb37..5a7ad491e1a228 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -101,8 +101,6 @@ class TestList : public Command { printf("Test_TC_FAN_2_2\n"); printf("Test_TC_FAN_2_3\n"); printf("Test_TC_FAN_2_4\n"); - printf("Test_TC_FAN_3_1\n"); - printf("Test_TC_FAN_3_2\n"); printf("Test_TC_FAN_3_6\n"); printf("Test_TC_CGEN_1_1\n"); printf("Test_TC_CGEN_2_1\n"); @@ -51501,799 +51499,6 @@ class Test_TC_FAN_2_4 : public TestCommandBridge { } }; -class Test_TC_FAN_3_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_FAN_3_1() - : TestCommandBridge("Test_TC_FAN_3_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("ConfigPercentSetting", 0, UINT8_MAX, &mConfigPercentSetting); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_FAN_3_1() - { - } - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_3_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_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 : Step 1: Commission DUT to TH\n"); - err = TestStep1CommissionDutToTh_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Step 2a: TH writes a supported FanMode attribute that is other than off to DUT\n"); - if (ShouldSkip("FAN.S.A0000")) { - NextTest(); - return; - } - err = TestStep2aThWritesASupportedFanModeAttributeThatIsOtherThanOffToDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 1000ms\n"); - if (ShouldSkip("FAN.S.A0000")) { - NextTest(); - return; - } - err = TestWait1000ms_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step 2b: after a few seconds, TH reads from the DUT the the FanMode attribute\n"); - if (ShouldSkip("FAN.S.A0000")) { - NextTest(); - return; - } - err = TestStep2bAfterAFewSecondsThReadsFromTheDutTheTheFanModeAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step 2.1a: TH writes the Off value of FanMode attribute to DUT\n"); - if (ShouldSkip("FAN.S.A0000")) { - NextTest(); - return; - } - err = TestStep21aThWritesTheOffValueOfFanModeAttributeToDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 1000ms\n"); - if (ShouldSkip("FAN.S.A0000")) { - NextTest(); - return; - } - err = TestWait1000ms_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Step 2.1b: TH reads from the DUT the PercentSetting attribute\n"); - if (ShouldSkip("FAN.S.A0002")) { - NextTest(); - return; - } - err = TestStep21bThReadsFromTheDutThePercentSettingAttribute_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Step 2.1c: TH reads from the DUT the PercentCurrent attribute\n"); - if (ShouldSkip("FAN.S.A0003")) { - NextTest(); - return; - } - err = TestStep21cThReadsFromTheDutThePercentCurrentAttribute_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Step 3a: TH writes PercentSetting attribute a non-zero value to DUT\n"); - if (ShouldSkip("FAN.S.A0002")) { - NextTest(); - return; - } - err = TestStep3aThWritesPercentSettingAttributeANonZeroValueToDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 1000ms\n"); - if (ShouldSkip("FAN.S.A0002")) { - NextTest(); - return; - } - err = TestWait1000ms_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Step 3b: TH reads from the DUT the PercentCurrent attribute\n"); - if (ShouldSkip("FAN.S.A0003")) { - NextTest(); - return; - } - err = TestStep3bThReadsFromTheDutThePercentCurrentAttribute_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Step 3c: TH reads from the DUT the PercentSetting attribute\n"); - if (ShouldSkip("FAN.S.A0002")) { - NextTest(); - return; - } - err = TestStep3cThReadsFromTheDutThePercentSettingAttribute_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Step 3.1a: TH writes PercentSetting attribute a zero value to DUT\n"); - if (ShouldSkip("FAN.S.A0002")) { - NextTest(); - return; - } - err = TestStep31aThWritesPercentSettingAttributeAZeroValueToDut_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Wait 1000ms\n"); - if (ShouldSkip("FAN.S.A0002")) { - NextTest(); - return; - } - err = TestWait1000ms_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Step 3.1b: after a few seconds, TH reads from the DUT the the FanMode attribute\n"); - if (ShouldSkip("FAN.S.A0000")) { - NextTest(); - return; - } - err = TestStep31bAfterAFewSecondsThReadsFromTheDutTheTheFanModeAttribute_14(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 15; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mConfigPercentSetting; - chip::Optional mTimeout; - - CHIP_ERROR TestStep1CommissionDutToTh_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestStep2aThWritesASupportedFanModeAttributeThatIsOtherThanOffToDut_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id fanModeArgument; - fanModeArgument = - [NSNumber numberWithUnsignedChar:3U]; - [cluster writeAttributeFanModeWithValue:fanModeArgument completion:^(NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 2a: TH writes a supported FanMode attribute that is other than off to DUT: Error: %@", err); - } else { - NSLog(@"Step 2a: TH writes a supported FanMode attribute that is other than off to DUT: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWait1000ms_2() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs("alpha", value); - } - - CHIP_ERROR TestStep2bAfterAFewSecondsThReadsFromTheDutTheTheFanModeAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFanModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 2b: after a few seconds, TH reads from the DUT the the FanMode attribute: Error: %@", err); - } else { - NSLog(@"Step 2b: after a few seconds, TH reads from the DUT the the FanMode attribute: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FanMode", actualValue, 3U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep21aThWritesTheOffValueOfFanModeAttributeToDut_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id fanModeArgument; - fanModeArgument = - [NSNumber numberWithUnsignedChar:0U]; - [cluster writeAttributeFanModeWithValue:fanModeArgument completion:^(NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 2.1a: TH writes the Off value of FanMode attribute to DUT: Error: %@", err); - } else { - NSLog(@"Step 2.1a: TH writes the Off value of FanMode attribute to DUT: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWait1000ms_5() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs("alpha", value); - } - - CHIP_ERROR TestStep21bThReadsFromTheDutThePercentSettingAttribute_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributePercentSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 2.1b: TH reads from the DUT the PercentSetting attribute: Error: %@", err); - } else { - NSLog(@"Step 2.1b: TH reads from the DUT the PercentSetting attribute: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("PercentSetting", actualValue)); - VerifyOrReturn(CheckValue("PercentSetting", actualValue, 0U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep21cThReadsFromTheDutThePercentCurrentAttribute_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributePercentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 2.1c: TH reads from the DUT the PercentCurrent attribute: Error: %@", err); - } else { - NSLog(@"Step 2.1c: TH reads from the DUT the PercentCurrent attribute: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("PercentCurrent", actualValue, 0U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3aThWritesPercentSettingAttributeANonZeroValueToDut_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id percentSettingArgument; - percentSettingArgument = mConfigPercentSetting.HasValue() ? [NSNumber numberWithUnsignedChar:mConfigPercentSetting.Value()] : [NSNumber numberWithUnsignedChar:30U]; - [cluster writeAttributePercentSettingWithValue:percentSettingArgument completion:^(NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 3a: TH writes PercentSetting attribute a non-zero value to DUT: Error: %@", err); - } else { - NSLog(@"Step 3a: TH writes PercentSetting attribute a non-zero value to DUT: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWait1000ms_9() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs("alpha", value); - } - - CHIP_ERROR TestStep3bThReadsFromTheDutThePercentCurrentAttribute_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributePercentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 3b: TH reads from the DUT the PercentCurrent attribute: Error: %@", err); - } else { - NSLog(@"Step 3b: TH reads from the DUT the PercentCurrent attribute: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("PercentCurrent", actualValue, mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3cThReadsFromTheDutThePercentSettingAttribute_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributePercentSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 3c: TH reads from the DUT the PercentSetting attribute: Error: %@", err); - } else { - NSLog(@"Step 3c: TH reads from the DUT the PercentSetting attribute: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("PercentSetting", actualValue)); - VerifyOrReturn(CheckValue("PercentSetting", actualValue, mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep31aThWritesPercentSettingAttributeAZeroValueToDut_12() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id percentSettingArgument; - percentSettingArgument = - [NSNumber numberWithUnsignedChar:0U]; - [cluster writeAttributePercentSettingWithValue:percentSettingArgument completion:^(NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 3.1a: TH writes PercentSetting attribute a zero value to DUT: Error: %@", err); - } else { - NSLog(@"Step 3.1a: TH writes PercentSetting attribute a zero value to DUT: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWait1000ms_13() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs("alpha", value); - } - - CHIP_ERROR TestStep31bAfterAFewSecondsThReadsFromTheDutTheTheFanModeAttribute_14() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFanModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 3.1b: after a few seconds, TH reads from the DUT the the FanMode attribute: Error: %@", err); - } else { - NSLog(@"Step 3.1b: after a few seconds, TH reads from the DUT the the FanMode attribute: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FanMode", actualValue, 0U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_FAN_3_2 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_FAN_3_2() - : TestCommandBridge("Test_TC_FAN_3_2") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_FAN_3_2() - { - } - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_3_2\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_3_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 : Step 1: Commission DUT to TH\n"); - err = TestStep1CommissionDutToTh_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Step 2: TH reads from the DUT the SpeedMax attribute\n"); - if (ShouldSkip("FAN.S.A0004")) { - NextTest(); - return; - } - err = TestStep2ThReadsFromTheDutTheSpeedMaxAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3: TH writes to the DUT the a value less than or equal to the value read in step 2\n"); - if (ShouldSkip("FAN.S.A0005")) { - NextTest(); - return; - } - err = TestStep3ThWritesToTheDutTheAValueLessThanOrEqualToTheValueReadInStep2_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 1000ms\n"); - if (ShouldSkip("FAN.S.A0005")) { - NextTest(); - return; - } - err = TestWait1000ms_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step 4: After a few seconds, TH reads from the DUT the SpeedSetting attribute\n"); - if (ShouldSkip("FAN.S.A0005")) { - NextTest(); - return; - } - err = TestStep4AfterAFewSecondsThReadsFromTheDutTheSpeedSettingAttribute_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Step 5: TH reads from the DUT the SpeedCurrent attribute\n"); - if (ShouldSkip("FAN.S.A0006")) { - NextTest(); - return; - } - err = TestStep5ThReadsFromTheDutTheSpeedCurrentAttribute_5(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestStep1CommissionDutToTh_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - NSNumber * _Nonnull rSpeedMax; - - CHIP_ERROR TestStep2ThReadsFromTheDutTheSpeedMaxAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeSpeedMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 2: TH reads from the DUT the SpeedMax attribute: Error: %@", err); - } else { - NSLog(@"Step 2: TH reads from the DUT the SpeedMax attribute: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - rSpeedMax = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3ThWritesToTheDutTheAValueLessThanOrEqualToTheValueReadInStep2_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id speedSettingArgument; - speedSettingArgument = - [rSpeedMax copy]; - [cluster writeAttributeSpeedSettingWithValue:speedSettingArgument completion:^(NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 3: TH writes to the DUT the a value less than or equal to the value read in step 2: Error: %@", err); - } else { - NSLog(@"Step 3: TH writes to the DUT the a value less than or equal to the value read in step 2: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWait1000ms_3() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs("alpha", value); - } - - CHIP_ERROR TestStep4AfterAFewSecondsThReadsFromTheDutTheSpeedSettingAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeSpeedSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 4: After a few seconds, TH reads from the DUT the SpeedSetting attribute: Error: %@", err); - } else { - NSLog(@"Step 4: After a few seconds, TH reads from the DUT the SpeedSetting attribute: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - if (rSpeedMax == nil) { - VerifyOrReturn(CheckValueNull("SpeedSetting", actualValue)); - } else { - VerifyOrReturn(CheckValueNonNull("SpeedSetting", actualValue)); - VerifyOrReturn(CheckValue("SpeedSetting", actualValue, rSpeedMax)); - } - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep5ThReadsFromTheDutTheSpeedCurrentAttribute_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeSpeedCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - if (err != nil) { - NSLog(@"Step 5: TH reads from the DUT the SpeedCurrent attribute: Error: %@", err); - } else { - NSLog(@"Step 5: TH reads from the DUT the SpeedCurrent attribute: Success"); - } - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("SpeedCurrent", actualValue, rSpeedMax)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - class Test_TC_FAN_3_6 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -194242,8 +193447,6 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(),