From f9287b1b3f4e7e09097b2b0d5c00ab27f129a62e Mon Sep 17 00:00:00 2001 From: Song Guo Date: Tue, 14 Sep 2021 10:25:00 +0800 Subject: [PATCH 1/5] Revert "[testsuite] Refactor test suite simulated cluster command" This reverts commit 8390956ecbd8ce456539bed856fa9e8d12bb6fa0. --- .../templates/partials/test_cluster.zapt | 7 ++++- .../partials/testsuite/WaitForMs.zapt | 6 ----- examples/chip-tool/templates/templates.json | 8 ------ src/app/tests/suites/TestDelayCommands.yaml | 2 +- .../common/ClusterTestGeneration.js | 13 +++++----- .../TestDelayCommands.js} | 19 ++++---------- src/app/zap-templates/templates/app/helper.js | 26 +++++++------------ .../CHIP/templates/partials/test_cluster.zapt | 3 ++- .../partials/testsuite/WaitForMs.zapt | 2 -- .../Framework/CHIP/templates/templates.json | 3 +++ 10 files changed, 33 insertions(+), 56 deletions(-) delete mode 100644 examples/chip-tool/templates/partials/testsuite/WaitForMs.zapt rename src/app/zap-templates/common/{TestSuiteHelperCluster.js => simulated-clusters/TestDelayCommands.js} (67%) delete mode 100644 src/darwin/Framework/CHIP/templates/partials/testsuite/WaitForMs.zapt diff --git a/examples/chip-tool/templates/partials/test_cluster.zapt b/examples/chip-tool/templates/partials/test_cluster.zapt index 6d7a4e3c352843..e9778de4277379 100644 --- a/examples/chip-tool/templates/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/partials/test_cluster.zapt @@ -46,7 +46,12 @@ class {{filename}}: public TestCommand {{#chip_tests_items}} {{#if (isTestOnlyCluster cluster)}} - {{> (asTestSuiteSimulatedClusterCommandPartial command) }} + CHIP_ERROR TestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}() + { + ChipLogProgress(chipTool, "{{cluster}} - {{label}}"); + + return {{command}}({{#chip_tests_item_parameters}}{{#not_first}}, {{/not_first}}{{definedValue}}{{/chip_tests_item_parameters}}); + } {{else}} // Test {{label}} using SuccessCallback_{{index}} = void (*)(void * context{{#chip_tests_item_response_parameters}}, {{#if isList}}uint16_t count, {{/if}}{{chipType}} {{#if isList}}* {{/if}}{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}); diff --git a/examples/chip-tool/templates/partials/testsuite/WaitForMs.zapt b/examples/chip-tool/templates/partials/testsuite/WaitForMs.zapt deleted file mode 100644 index 771ae4227fe91b..00000000000000 --- a/examples/chip-tool/templates/partials/testsuite/WaitForMs.zapt +++ /dev/null @@ -1,6 +0,0 @@ -CHIP_ERROR TestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}() -{ - ChipLogProgress(chipTool, "{{cluster}} - {{asUpperCamelCase command}} - {{label}}"); - - return {{command}}({{#chip_tests_item_parameters}}{{#not_first}}, {{/not_first}}{{definedValue}}{{/chip_tests_item_parameters}}); -} diff --git a/examples/chip-tool/templates/templates.json b/examples/chip-tool/templates/templates.json index e378232b78a82f..02d6cf552ce243 100644 --- a/examples/chip-tool/templates/templates.json +++ b/examples/chip-tool/templates/templates.json @@ -30,14 +30,6 @@ { "name": "test_cluster", "path": "partials/test_cluster.zapt" - }, - { - "name": "TestSuiteHelper_WaitForMs", - "path": "partials/testsuite/WaitForMs.zapt" - }, - { - "name": "TestSuiteHelper_WaitForAttributeReport", - "path": "partials/testsuite/WaitForAttributeReport.zapt" } ], "templates": [ diff --git a/src/app/tests/suites/TestDelayCommands.yaml b/src/app/tests/suites/TestDelayCommands.yaml index 6a32a4c7eaf972..b3f7839bdc93f3 100644 --- a/src/app/tests/suites/TestDelayCommands.yaml +++ b/src/app/tests/suites/TestDelayCommands.yaml @@ -20,7 +20,7 @@ config: tests: - label: "Wait 100ms" - cluster: "TestSuite" + cluster: "DelayCommands" command: "WaitForMs" arguments: values: diff --git a/src/app/zap-templates/common/ClusterTestGeneration.js b/src/app/zap-templates/common/ClusterTestGeneration.js index 58f9a37b66e926..4b0c741199bc9c 100644 --- a/src/app/zap-templates/common/ClusterTestGeneration.js +++ b/src/app/zap-templates/common/ClusterTestGeneration.js @@ -26,7 +26,7 @@ const path = require('path'); // Import helpers from zap core const templateUtil = require(zapPath + 'dist/src-electron/generator/template-util.js') -const { TestSuiteHelperCluster } = require('./TestSuiteHelperCluster.js'); +const { DelayCommands } = require('./simulated-clusters/TestDelayCommands.js'); const { Clusters, asBlocks, asPromise } = require('./ClustersHelper.js'); const kClusterName = 'cluster'; @@ -221,19 +221,18 @@ function getClusters() { // Create a new array to merge the configured clusters list and test // simulated clusters. - return Clusters.getClusters().then(clusters => clusters.concat(TestSuiteHelperCluster)); + return Clusters.getClusters().then(clusters => clusters.concat(DelayCommands)); } function getCommands(clusterName) { - return (clusterName == TestSuiteHelperCluster.name) ? Promise.resolve(TestSuiteHelperCluster.commands) - : Clusters.getClientCommands(clusterName); + return (clusterName == DelayCommands.name) ? Promise.resolve(DelayCommands.commands) : Clusters.getClientCommands(clusterName); } function getAttributes(clusterName) { - return (clusterName == TestSuiteHelperCluster.name) ? Promise.resolve(TestSuiteHelperCluster.attributes) - : Clusters.getServerAttributes(clusterName); + return (clusterName == DelayCommands.name) ? Promise.resolve(DelayCommands.attributes) + : Clusters.getServerAttributes(clusterName); } function assertCommandOrAttribute(context) @@ -299,7 +298,7 @@ function chip_tests_items(options) function isTestOnlyCluster(name) { - return name == TestSuiteHelperCluster.name; + return name == DelayCommands.name; } function chip_tests_with_command_attribute_info(options) diff --git a/src/app/zap-templates/common/TestSuiteHelperCluster.js b/src/app/zap-templates/common/simulated-clusters/TestDelayCommands.js similarity index 67% rename from src/app/zap-templates/common/TestSuiteHelperCluster.js rename to src/app/zap-templates/common/simulated-clusters/TestDelayCommands.js index 73fd1f3ef21b9d..7c4736dc533e1b 100644 --- a/src/app/zap-templates/common/TestSuiteHelperCluster.js +++ b/src/app/zap-templates/common/simulated-clusters/TestDelayCommands.js @@ -16,7 +16,7 @@ */ /* - * This file declare test suites utilities methods for test suite. + * This file declare test suites utilities methods for delayed commands. * * Each method declared in this file needs to be implemented on a per-language * basis and permits to exposes methods to the test suites that are not part @@ -30,21 +30,12 @@ const WaitForMs = { response : { arguments : [] } }; -const WaitForAttributeRepor = { - name : 'WaitForAttributeReport', - arguments : [], - response : { arguments : [ { name : 'value' } ] } - /* - * 'WaitForAttributeResponse' will take "attribute" parameter for detailed attribute path. - */ -}; - -const TestSuiteHelperCluster = { - name : 'TestSuite', - commands : [ WaitForMs, WaitForAttributeRepor ], +const DelayCommands = { + name : 'DelayCommands', + commands : [ WaitForMs ], }; // // Module exports // -exports.TestSuiteHelperCluster = TestSuiteHelperCluster; +exports.DelayCommands = DelayCommands; diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js index cf5d8588127270..22e39b6a8d395d 100644 --- a/src/app/zap-templates/templates/app/helper.js +++ b/src/app/zap-templates/templates/app/helper.js @@ -335,22 +335,16 @@ function asMEI(prefix, suffix) return cHelper.asHex((prefix << 16) + suffix, 8); } -function asTestSuiteSimulatedClusterCommandPartial(label) -{ - return "TestSuiteHelper_" + asUpperCamelCase(label) -} - // // Module exports // -exports.asPrintFormat = asPrintFormat; -exports.asReadType = asReadType; -exports.asReadTypeLength = asReadTypeLength; -exports.chip_endpoint_generated_functions = chip_endpoint_generated_functions -exports.chip_endpoint_cluster_list = chip_endpoint_cluster_list -exports.asTypeLiteralSuffix = asTypeLiteralSuffix; -exports.asLowerCamelCase = asLowerCamelCase; -exports.asUpperCamelCase = asUpperCamelCase; -exports.hasSpecificAttributes = hasSpecificAttributes; -exports.asMEI = asMEI; -exports.asTestSuiteSimulatedClusterCommandPartial = asTestSuiteSimulatedClusterCommandPartial; +exports.asPrintFormat = asPrintFormat; +exports.asReadType = asReadType; +exports.asReadTypeLength = asReadTypeLength; +exports.chip_endpoint_generated_functions = chip_endpoint_generated_functions +exports.chip_endpoint_cluster_list = chip_endpoint_cluster_list +exports.asTypeLiteralSuffix = asTypeLiteralSuffix; +exports.asLowerCamelCase = asLowerCamelCase; +exports.asUpperCamelCase = asUpperCamelCase; +exports.hasSpecificAttributes = hasSpecificAttributes; +exports.asMEI = asMEI; diff --git a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt index 85c2ab459b505f..ad989f3171b060 100644 --- a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt @@ -4,7 +4,8 @@ { XCTestExpectation * expectation = [self expectationWithDescription:@"{{label}}"]; {{#if (isTestOnlyCluster cluster)}} -{{> (asTestSuiteSimulatedClusterCommandPartial command)}} + dispatch_queue_t queue = dispatch_get_main_queue(); + {{command}}(expectation, queue{{#chip_tests_item_parameters}}, {{definedValue}}{{/chip_tests_item_parameters}}); {{else}} CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); diff --git a/src/darwin/Framework/CHIP/templates/partials/testsuite/WaitForMs.zapt b/src/darwin/Framework/CHIP/templates/partials/testsuite/WaitForMs.zapt deleted file mode 100644 index 57326c64d83df6..00000000000000 --- a/src/darwin/Framework/CHIP/templates/partials/testsuite/WaitForMs.zapt +++ /dev/null @@ -1,2 +0,0 @@ -dispatch_queue_t queue = dispatch_get_main_queue(); -{{command}}(expectation, queue{{#chip_tests_item_parameters}}, {{definedValue}}{{/chip_tests_item_parameters}}); diff --git a/src/darwin/Framework/CHIP/templates/templates.json b/src/darwin/Framework/CHIP/templates/templates.json index 72b96a1fabb180..34c4f155e569dc 100644 --- a/src/darwin/Framework/CHIP/templates/templates.json +++ b/src/darwin/Framework/CHIP/templates/templates.json @@ -26,6 +26,7 @@ { "name": "CHIPCallbackBridge", "path": "partials/CHIPCallbackBridge.zapt" +<<<<<<< HEAD }, { "name": "TestSuiteHelper_WaitForMs", @@ -34,6 +35,8 @@ { "name": "TestSuiteHelper_WaitForAttributeReport", "path": "partials/testsuite/WaitForAttributeReport.zapt" +======= +>>>>>>> parent of 8390956ec ([testsuite] Refactor test suite simulated cluster command) } ], "templates": [ From 9d4ddc1ffde4521e0556ca7e9a4c9109d497f7cc Mon Sep 17 00:00:00 2001 From: Song Guo Date: Tue, 14 Sep 2021 10:39:59 +0800 Subject: [PATCH 2/5] Update subscription test per comment --- .../templates/partials/test_cluster.zapt | 18 +++++ src/app/tests/suites/TestSubscribe_OnOff.yaml | 19 +++-- .../common/ClusterTestGeneration.js | 23 ++++-- .../partials/process_response_value.zapt | 75 +++++++++---------- .../CHIP/templates/partials/test_cluster.zapt | 7 +- .../Framework/CHIP/templates/templates.json | 11 --- 6 files changed, 87 insertions(+), 66 deletions(-) diff --git a/examples/chip-tool/templates/partials/test_cluster.zapt b/examples/chip-tool/templates/partials/test_cluster.zapt index e9778de4277379..cfd3213eb1ef5e 100644 --- a/examples/chip-tool/templates/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/partials/test_cluster.zapt @@ -56,7 +56,9 @@ class {{filename}}: public TestCommand // Test {{label}} using SuccessCallback_{{index}} = void (*)(void * context{{#chip_tests_item_response_parameters}}, {{#if isList}}uint16_t count, {{/if}}{{chipType}} {{#if isList}}* {{/if}}{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}); chip::Callback::Callback mOnSuccessCallback_{{index}} { OnTestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}_SuccessResponse, this }; + {{#unless noFailureCallback}} chip::Callback::Callback mOnFailureCallback_{{index}} { OnTestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}_FailureResponse, this }; + {{/unless}} {{#if isSubscribeAttribute}} chip::Callback::Callback mOnSubscriptionEstablishedCallback_{{index}} { SubscribeAttribute_{{ index }}_OnSubscriptionEstablishedCallback, this }; {{/if}} @@ -66,6 +68,9 @@ class {{filename}}: public TestCommand {{#if isSubscribeAttribute}} bool mReceivedReport_{{index}} = false; {{/if}} + {{#if isWaitForReport}} + bool mReceivedReport_{{index}} = false; + {{/if}} CHIP_ERROR TestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}() { @@ -88,6 +93,8 @@ class {{filename}}: public TestCommand {{else if isSubscribeAttribute}} cluster.ReportAttribute{{asUpperCamelCase attribute}}(mOnSuccessCallback_{{index}}.Cancel()); err = cluster.ConfigureAttribute{{asUpperCamelCase attribute}}(mOnSubscriptionEstablishedCallback_{{index}}.Cancel(), mOnFailureCallback_{{index}}.Cancel(), {{minInterval}}, {{maxInterval}}); + {{else if isWaitForReport}} + err = cluster.ReportAttribute{{asUpperCamelCase attribute}}(mOnSuccessCallback_{{index}}.Cancel()); {{else if isReadAttribute}} err = cluster.ReadAttribute{{asUpperCamelCase attribute}}(mOnSuccessCallback_{{index}}.Cancel(), mOnFailureCallback_{{index}}.Cancel()); {{else if isWriteAttribute}} @@ -119,6 +126,7 @@ class {{filename}}: public TestCommand } {{/if}} + {{#unless noFailureCallback}} static void OnTestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}_FailureResponse(void * context, uint8_t status) { ChipLogProgress(chipTool, "{{cluster}} - {{label}}: Failure Response"); @@ -140,6 +148,7 @@ class {{filename}}: public TestCommand runner->NextTest(); } + {{/unless}} static void OnTestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}_SuccessResponse(void * context {{#chip_tests_item_response_parameters}}, {{#if isList}}uint16_t count, {{/if}}{{chipType}} {{#if isList}}* {{/if}}{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}) { @@ -154,6 +163,15 @@ class {{filename}}: public TestCommand return; } + {{#if isWaitForReport }} + if (runner->mReceivedReport_{{index}}) { + // Receiving report more than once is not an error since the subscription may be alive for a long time. + ChipLogProgress(chipTool, "Note: on report called more than once."); + return; + } + runner->mReceivedReport_{{index}} = true; + {{/if}} + {{> process_response_value}} {{#if isSubscribeAttribute}} diff --git a/src/app/tests/suites/TestSubscribe_OnOff.yaml b/src/app/tests/suites/TestSubscribe_OnOff.yaml index 69c0c4620d80c2..927c3582083de7 100644 --- a/src/app/tests/suites/TestSubscribe_OnOff.yaml +++ b/src/app/tests/suites/TestSubscribe_OnOff.yaml @@ -31,11 +31,14 @@ tests: - label: "Turn On the light to see attribute change" command: "On" - label: "Check for attribute report" - cluster: "TestSuite" - command: "WaitForAttributeReport" - waitfor: - endpoint: 1 - cluster: "On/Off" - attribute: "OnOff" - response: - value: true + command: "waitForReport" + attribute: "OnOff" + response: + value: true + - label: "Turn Off the light to see attribute change" + command: "Off" + - label: "Check for attribute report" + command: "waitForReport" + attribute: "OnOff" + response: + value: false diff --git a/src/app/zap-templates/common/ClusterTestGeneration.js b/src/app/zap-templates/common/ClusterTestGeneration.js index 4b0c741199bc9c..21a5cce39f3a07 100644 --- a/src/app/zap-templates/common/ClusterTestGeneration.js +++ b/src/app/zap-templates/common/ClusterTestGeneration.js @@ -64,8 +64,10 @@ function setDefaultType(test) const type = test[kCommandName]; switch (type) { case 'readAttribute': - test.isAttribute = true; - test.isReadAttribute = true; + test.isAttribute = true; + test.isReadAttribute = true; + test.noCommandSpecificRequestArguments = true; + test.useReadAttributeCallback = true; break; case 'writeAttribute': @@ -74,9 +76,18 @@ function setDefaultType(test) break; case 'subscribeAttribute': - test.isAttribute = true; - test.isReadAttribute = true; - test.isSubscribeAttribute = true; + test.isAttribute = true; + test.isSubscribeAttribute = true; + test.noCommandSpecificRequestArguments = true; + test.useReadAttributeCallback = true; + break; + + case 'waitForReport': + test.isAttribute = true; + test.isWaitForReport = true; + test.useReadAttributeCallback = true; + test.noCommandSpecificRequestArguments = true; + test.noFailureCallback = true; break; default: @@ -142,7 +153,7 @@ function setDefaultResponse(test) throwError(test, errorStr); } - if (!test.isReadAttribute) { + if (!test.useReadAttributeCallback) { return; } diff --git a/src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt b/src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt index 87927090450d6e..8d52cdd83d2fba 100644 --- a/src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt @@ -1,38 +1,37 @@ - {{#chip_tests_item_response_parameters}} - {{#if hasExpectedValue}} - {{#if isList}} - XCTAssertEqual([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] count], {{expectedValue.length}}); - {{else}} - {{#if (isString type)}} - {{#if (isOctetString type)}} - NSString * {{asLowerCamelCase name}}ArgumentString= @"{{expectedValue}}"; - NSData * {{asLowerCamelCase name}}Argument = [{{asLowerCamelCase name}}ArgumentString dataUsingEncoding:NSUTF8StringEncoding]; - XCTAssertTrue([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] isEqualToData:{{asLowerCamelCase name}}Argument]); - {{else}} - NSString * {{asLowerCamelCase name}}Argument= @"{{expectedValue}}"; - XCTAssertTrue([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] isEqualToString:{{asLowerCamelCase name}}Argument]); - {{/if}} - {{else}} - XCTAssertEqual([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedValue}}{{asTypeLiteralSuffix}}); - {{/if}} - {{/if}} - {{/if}} - {{#if hasExpectedConstraints}} - {{#if expectedConstraints.minLength}} - XCTAssertGreaterThanOrEqual([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.minLength}}); - {{/if}} - {{#if expectedConstraints.maxLength}} - XCTAssertLessThanOrEqual([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.maxLength}}); - {{/if}} - {{#if expectedConstraints.minValue}} - XCTAssertGreaterThanOrEqual([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.minValue}}); - {{/if}} - {{#if expectedConstraints.maxValue}} - XCTAssertLessThanOrEqual([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.maxValue}}); - {{/if}} - {{#if expectedConstraints.notValue}} - XCTAssertNotEqual([values[@"{{#if parent.isReadAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.notValue}}); - {{/if}} - {{/if}} - {{/chip_tests_item_response_parameters}} - \ No newline at end of file +{{#chip_tests_item_response_parameters}} +{{#if hasExpectedValue}} +{{#if isList}} +XCTAssertEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] count], {{expectedValue.length}}); +{{else}} +{{#if (isString type)}} +{{#if (isOctetString type)}} +NSString * {{asLowerCamelCase name}}ArgumentString= @"{{expectedValue}}"; +NSData * {{asLowerCamelCase name}}Argument = [{{asLowerCamelCase name}}ArgumentString dataUsingEncoding:NSUTF8StringEncoding]; +XCTAssertTrue([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] isEqualToData:{{asLowerCamelCase name}}Argument]); +{{else}} +NSString * {{asLowerCamelCase name}}Argument= @"{{expectedValue}}"; +XCTAssertTrue([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] isEqualToString:{{asLowerCamelCase name}}Argument]); +{{/if}} +{{else}} +XCTAssertEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedValue}}{{asTypeLiteralSuffix}}); +{{/if}} +{{/if}} +{{/if}} +{{#if hasExpectedConstraints}} +{{#if expectedConstraints.minLength}} +XCTAssertGreaterThanOrEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.minLength}}); +{{/if}} +{{#if expectedConstraints.maxLength}} +XCTAssertLessThanOrEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.maxLength}}); +{{/if}} +{{#if expectedConstraints.minValue}} +XCTAssertGreaterThanOrEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.minValue}}); +{{/if}} +{{#if expectedConstraints.maxValue}} +XCTAssertLessThanOrEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.maxValue}}); +{{/if}} +{{#if expectedConstraints.notValue}} +XCTAssertNotEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.notValue}}); +{{/if}} +{{/if}} +{{/chip_tests_item_response_parameters}} diff --git a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt index ad989f3171b060..a42168c6723700 100644 --- a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt @@ -12,8 +12,7 @@ CHIP{{asUpperCamelCase cluster}} * cluster = [[CHIP{{asUpperCamelCase cluster}} alloc] initWithDevice:device endpoint:{{endpoint}} queue:queue]; XCTAssertNotNil(cluster); - {{#if isReadAttribute}} - {{else}} + {{#unless noCommandSpecificRequestArguments}} {{#chip_tests_item_parameters}} {{#if (isString type)}} {{#if (isOctetString type)}} @@ -26,7 +25,7 @@ {{chipType}} {{asLowerCamelCase name}}Argument = {{definedValue}}{{asTypeLiteralSuffix chipType}}; {{/if}} {{/chip_tests_item_parameters}} - {{/if}} + {{/unless}} {{#if isCommand}} [cluster {{asLowerCamelCase command}}:{{#chip_tests_item_parameters}}{{#not_first}}{{asLowerCamelCase name}}:{{/not_first}}{{asLowerCamelCase name}}Argument {{#last}}responseHandler:{{/last}}{{/chip_tests_item_parameters}}^(NSError * err, NSDictionary * values) { {{else if isSubscribeAttribute}} @@ -41,6 +40,8 @@ [cluster configureAttribute{{asUpperCamelCase attribute}}WithMinInterval:{{minInterval}} maxInterval:{{maxInterval}} responseHandler:^(NSError * err, NSDictionary * values) { + {{else if isWaitForReport}} + [cluster reportAttribute{{asUpperCamelCase attribute}}WithResponseHandler:^(NSError * err, NSDictionary * values) { {{else if isReadAttribute}} [cluster readAttribute{{asUpperCamelCase attribute}}WithResponseHandler:^(NSError * err, NSDictionary * values) { {{else if isWriteAttribute}} diff --git a/src/darwin/Framework/CHIP/templates/templates.json b/src/darwin/Framework/CHIP/templates/templates.json index 34c4f155e569dc..f0f9231bd67103 100644 --- a/src/darwin/Framework/CHIP/templates/templates.json +++ b/src/darwin/Framework/CHIP/templates/templates.json @@ -26,17 +26,6 @@ { "name": "CHIPCallbackBridge", "path": "partials/CHIPCallbackBridge.zapt" -<<<<<<< HEAD - }, - { - "name": "TestSuiteHelper_WaitForMs", - "path": "partials/testsuite/WaitForMs.zapt" - }, - { - "name": "TestSuiteHelper_WaitForAttributeReport", - "path": "partials/testsuite/WaitForAttributeReport.zapt" -======= ->>>>>>> parent of 8390956ec ([testsuite] Refactor test suite simulated cluster command) } ], "templates": [ From a4967f14caa6f967db8043bdd042ac91d9b64f13 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Tue, 14 Sep 2021 09:42:59 +0200 Subject: [PATCH 3/5] Apply comments --- .../partials/process_response_value.zapt | 78 ----------- .../templates/partials/test_cluster.zapt | 123 +++++++++++++----- .../testsuite/WaitForAttributeReport.zapt | 38 ------ examples/chip-tool/templates/templates.json | 4 - src/app/tests/suites/TestSubscribe_OnOff.yaml | 5 + .../common/ClusterTestGeneration.js | 63 ++++++--- .../partials/process_response_value.zapt | 18 +-- .../CHIP/templates/partials/test_cluster.zapt | 2 - 8 files changed, 152 insertions(+), 179 deletions(-) delete mode 100644 examples/chip-tool/templates/partials/process_response_value.zapt delete mode 100644 examples/chip-tool/templates/partials/testsuite/WaitForAttributeReport.zapt diff --git a/examples/chip-tool/templates/partials/process_response_value.zapt b/examples/chip-tool/templates/partials/process_response_value.zapt deleted file mode 100644 index e82ff965abcc7d..00000000000000 --- a/examples/chip-tool/templates/partials/process_response_value.zapt +++ /dev/null @@ -1,78 +0,0 @@ -{{#chip_tests_item_response_parameters}} -{{#if hasExpectedValue}} -{{#if isList}} -if (count != {{expectedValue.length}}) -{ - ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "{{expectedValue}}"); - runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); - return; -} -{{else}} -{{#if (isString type)}} -{{chipType}} {{asLowerCamelCase name}}Argument = chip::ByteSpan(chip::Uint8::from_const_char("{{expectedValue}}"), strlen("{{expectedValue}}")); -if (!{{asLowerCamelCase name}}.data_equal({{asLowerCamelCase name}}Argument)) -{{else}} -if ({{asLowerCamelCase name}} != {{expectedValue}}{{asTypeLiteralSuffix chipType}}) -{{/if}} -{ - ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "{{expectedValue}}"); - runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); - return; -} -{{/if}} -{{/if}} -{{#if hasExpectedConstraints}} -{{#if expectedConstraints.type}} -ChipLogError(chipTool, "Warning: {{asLowerCamelCase name}} type checking is not implemented yet. Expected type: '%s'", "{{expectedConstraints.type}}"); -{{/if}} - -{{#if expectedConstraints.format}} -ChipLogError(chipTool, "Warning: {{asLowerCamelCase name}} format checking is not implemented yet. Expected format: '%s'", "{{expectedConstraints.format}}"); -{{/if}} - -{{#if expectedConstraints.minLength}} - if ({{asLowerCamelCase name}}.size() < {{expectedConstraints.minLength}}) - { - ChipLogError(chipTool, "Error: {{asLowerCamelCase name}} is too short. Min size is {{expectedConstraints.minLength}} but got '%zu'", {{asLowerCamelCase name}}.size()); - runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); - return; - } -{{/if}} - -{{#if expectedConstraints.maxLength}} - if ({{asLowerCamelCase name}}.size() > {{expectedConstraints.maxLength}}) - { - ChipLogError(chipTool, "Error: {{asLowerCamelCase name}} is too long. Max size is {{expectedConstraints.maxLength}} but got '%zu'", {{asLowerCamelCase name}}.size()); - runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); - return; - } -{{/if}} - -{{#if expectedConstraints.minValue}} - if ({{asLowerCamelCase name}} < {{expectedConstraints.minValue}}) - { - ChipLogError(chipTool, "Error: {{asLowerCamelCase name}} is lower than expected. Min value is {{expectedConstraints.minValue}} but got '%d'", {{asLowerCamelCase name}}); - runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); - return; - } -{{/if}} - -{{#if expectedConstraints.maxValue}} - if ({{asLowerCamelCase name}} > {{expectedConstraints.maxValue}}) - { - ChipLogError(chipTool, "Error: {{asLowerCamelCase name}} is higher than expected. Max value is {{expectedConstraints.maxValue}} but got '%d'", {{asLowerCamelCase name}}); - runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); - return; - } -{{/if}} - -{{#if expectedConstraints.notValue}} - if ({{asLowerCamelCase name}} == {{expectedConstraints.notValue}}) - { - ChipLogError(chipTool, "Error: {{asLowerCamelCase name}} was not expected to be '{{expectedConstraints.notValue}}' due to notValue constraint"); - runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); - return; - } -{{/if}} -{{/if}} -{{/chip_tests_item_response_parameters}} diff --git a/examples/chip-tool/templates/partials/test_cluster.zapt b/examples/chip-tool/templates/partials/test_cluster.zapt index cfd3213eb1ef5e..34b064c06ae9a7 100644 --- a/examples/chip-tool/templates/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/partials/test_cluster.zapt @@ -56,18 +56,10 @@ class {{filename}}: public TestCommand // Test {{label}} using SuccessCallback_{{index}} = void (*)(void * context{{#chip_tests_item_response_parameters}}, {{#if isList}}uint16_t count, {{/if}}{{chipType}} {{#if isList}}* {{/if}}{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}); chip::Callback::Callback mOnSuccessCallback_{{index}} { OnTestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}_SuccessResponse, this }; - {{#unless noFailureCallback}} chip::Callback::Callback mOnFailureCallback_{{index}} { OnTestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}_FailureResponse, this }; - {{/unless}} - {{#if isSubscribeAttribute}} - chip::Callback::Callback mOnSubscriptionEstablishedCallback_{{index}} { SubscribeAttribute_{{ index }}_OnSubscriptionEstablishedCallback, this }; - {{/if}} bool mIsFailureExpected_{{index}} = {{response.error}}; - {{#if isSubscribeAttribute}} - bool mReceivedReport_{{index}} = false; - {{/if}} {{#if isWaitForReport}} bool mReceivedReport_{{index}} = false; {{/if}} @@ -91,8 +83,7 @@ class {{filename}}: public TestCommand {{/chip_tests_item_parameters}} err = cluster.{{asUpperCamelCase command}}(mOnSuccessCallback_{{index}}.Cancel(), mOnFailureCallback_{{index}}.Cancel(){{#chip_tests_item_parameters}}, {{asLowerCamelCase name}}Argument{{/chip_tests_item_parameters}}); {{else if isSubscribeAttribute}} - cluster.ReportAttribute{{asUpperCamelCase attribute}}(mOnSuccessCallback_{{index}}.Cancel()); - err = cluster.ConfigureAttribute{{asUpperCamelCase attribute}}(mOnSubscriptionEstablishedCallback_{{index}}.Cancel(), mOnFailureCallback_{{index}}.Cancel(), {{minInterval}}, {{maxInterval}}); + err = cluster.ConfigureAttribute{{asUpperCamelCase attribute}}(mOnSuccessCallback_{{index}}.Cancel(), mOnFailureCallback_{{index}}.Cancel(), {{minInterval}}, {{maxInterval}}); {{else if isWaitForReport}} err = cluster.ReportAttribute{{asUpperCamelCase attribute}}(mOnSuccessCallback_{{index}}.Cancel()); {{else if isReadAttribute}} @@ -110,23 +101,11 @@ class {{filename}}: public TestCommand err = CHIP_ERROR_NOT_IMPLEMENTED; {{/if}} - return err; - } + {{#if async}}ReturnErrorOnFailure(chip::DeviceLayer::SystemLayer().StartTimer(0, OnWaitForMsFn, this));{{/if}} - {{#if isSubscribeAttribute }} - static void SubscribeAttribute_{{ index }}_OnSubscriptionEstablishedCallback(void * context) - { - {{parent.filename}} * runner = reinterpret_cast<{{parent.filename}} *>(context); - if (!runner->mReceivedReport_{{index}}) { - ChipLogError(chipTool, "Error: Initial report not received!"); - runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); - return; - } - runner->NextTest(); + return err; } - {{/if}} - {{#unless noFailureCallback}} static void OnTestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}_FailureResponse(void * context, uint8_t status) { ChipLogProgress(chipTool, "{{cluster}} - {{label}}: Failure Response"); @@ -146,9 +125,8 @@ class {{filename}}: public TestCommand return; } - runner->NextTest(); + {{#unless async}}runner->NextTest();{{/unless}} } - {{/unless}} static void OnTestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}_SuccessResponse(void * context {{#chip_tests_item_response_parameters}}, {{#if isList}}uint16_t count, {{/if}}{{chipType}} {{#if isList}}* {{/if}}{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}) { @@ -163,7 +141,7 @@ class {{filename}}: public TestCommand return; } - {{#if isWaitForReport }} + {{#if isWaitForReport}} if (runner->mReceivedReport_{{index}}) { // Receiving report more than once is not an error since the subscription may be alive for a long time. ChipLogProgress(chipTool, "Note: on report called more than once."); @@ -172,13 +150,96 @@ class {{filename}}: public TestCommand runner->mReceivedReport_{{index}} = true; {{/if}} - {{> process_response_value}} - {{#if isSubscribeAttribute}} - runner->mReceivedReport_{{index}} = true; + {{#if hasWaitForReport}} + if (!runner->mReceivedReport_{{waitForReport.index}}) { + ChipLogError(chipTool, "Error: Initial report not received!"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + {{/if}} + {{/if}} + + {{#chip_tests_item_response_parameters}} + {{#if hasExpectedValue}} + {{#if isList}} + if (count != {{expectedValue.length}}) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "{{expectedValue}}"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } {{else}} - runner->NextTest(); + {{#if (isString type)}} + {{chipType}} {{asLowerCamelCase name}}Argument = chip::ByteSpan(chip::Uint8::from_const_char("{{expectedValue}}"), strlen("{{expectedValue}}")); + if (!{{asLowerCamelCase name}}.data_equal({{asLowerCamelCase name}}Argument)) + {{else}} + if ({{asLowerCamelCase name}} != {{expectedValue}}{{asTypeLiteralSuffix chipType}}) + {{/if}} + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "{{expectedValue}}"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + {{/if}} + {{/if}} + {{#if hasExpectedConstraints}} + {{#if expectedConstraints.type}} + ChipLogError(chipTool, "Warning: {{asLowerCamelCase name}} type checking is not implemented yet. Expected type: '%s'", "{{expectedConstraints.type}}"); + {{/if}} + + {{#if expectedConstraints.format}} + ChipLogError(chipTool, "Warning: {{asLowerCamelCase name}} format checking is not implemented yet. Expected format: '%s'", "{{expectedConstraints.format}}"); + {{/if}} + + {{#if expectedConstraints.minLength}} + if ({{asLowerCamelCase name}}.size() < {{expectedConstraints.minLength}}) + { + ChipLogError(chipTool, "Error: {{asLowerCamelCase name}} is too short. Min size is {{expectedConstraints.minLength}} but got '%zu'", {{asLowerCamelCase name}}.size()); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } {{/if}} + + {{#if expectedConstraints.maxLength}} + if ({{asLowerCamelCase name}}.size() > {{expectedConstraints.maxLength}}) + { + ChipLogError(chipTool, "Error: {{asLowerCamelCase name}} is too long. Max size is {{expectedConstraints.maxLength}} but got '%zu'", {{asLowerCamelCase name}}.size()); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + {{/if}} + + {{#if expectedConstraints.minValue}} + if ({{asLowerCamelCase name}} < {{expectedConstraints.minValue}}) + { + ChipLogError(chipTool, "Error: {{asLowerCamelCase name}} is lower than expected. Min value is {{expectedConstraints.minValue}} but got '%d'", {{asLowerCamelCase name}}); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + {{/if}} + + {{#if expectedConstraints.maxValue}} + if ({{asLowerCamelCase name}} > {{expectedConstraints.maxValue}}) + { + ChipLogError(chipTool, "Error: {{asLowerCamelCase name}} is higher than expected. Max value is {{expectedConstraints.maxValue}} but got '%d'", {{asLowerCamelCase name}}); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + {{/if}} + + {{#if expectedConstraints.notValue}} + if ({{asLowerCamelCase name}} == {{expectedConstraints.notValue}}) + { + ChipLogError(chipTool, "Error: {{asLowerCamelCase name}} was not expected to be '{{expectedConstraints.notValue}}' due to notValue constraint"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + {{/if}} + {{/if}} + {{/chip_tests_item_response_parameters}} + + {{#unless async}}runner->NextTest();{{/unless}} } {{/if}} diff --git a/examples/chip-tool/templates/partials/testsuite/WaitForAttributeReport.zapt b/examples/chip-tool/templates/partials/testsuite/WaitForAttributeReport.zapt deleted file mode 100644 index b45162af201604..00000000000000 --- a/examples/chip-tool/templates/partials/testsuite/WaitForAttributeReport.zapt +++ /dev/null @@ -1,38 +0,0 @@ -// The callback should be called atleast once -{{#chip_tests_WaitForAttributeReport_attribute_info}} -using OnReportCallback_{{parent.index}} = void (*)(void * context{{#chip_tests_item_response_parameters}}, {{#if isList}}uint16_t count, {{/if}}{{chipType}} {{#if isList}}* {{/if}}{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}); -chip::Callback::Callback mOnReportCallback_{{parent.index}} { SubscribeAttribute_{{ parent.index }}_OnReportCallback, this }; -{{/chip_tests_WaitForAttributeReport_attribute_info}} - -bool mReceivedReport_{{index}} = false; - -CHIP_ERROR TestSendCluster{{asUpperCamelCase cluster}}Command{{asUpperCamelCase command}}_{{index}}() -{ - ChipLogProgress(chipTool, "{{cluster}} - {{asUpperCamelCase command}} - {{label}}"); -{{#chip_tests_WaitForAttributeReport_attribute_info}} - chip::Controller::{{asUpperCamelCase cluster}}Cluster cluster; - cluster.Associate(mDevice, {{endpoint}}); - return cluster.ReportAttribute{{asUpperCamelCase attribute}}(mOnReportCallback_{{parent.index}}.Cancel()); -{{/chip_tests_WaitForAttributeReport_attribute_info}} -} - -{{#chip_tests_WaitForAttributeReport_attribute_info}} -static void SubscribeAttribute_{{ parent.index }}_OnReportCallback(void * context{{#chip_tests_item_response_parameters}}, {{#if isList}}uint16_t count, {{/if}}{{chipType}} {{#if isList}}* {{/if}}{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}) -{ - ChipLogProgress(chipTool, "On/Off - Subscribe {{asUpperCamelCase attribute}} Attribute: Report Data"); - {{parent.parent.filename}} * runner = reinterpret_cast<{{parent.parent.filename}} *>(context); - - if (runner->mReceivedReport_{{parent.index}}) - { - // Receiving attribute more than once is not an issue, since the following handler will override previous handlers. - return; - } - - {{> process_response_value}} - - runner->mReceivedReport_{{parent.index}} = true; - ChipLogProgress(chipTool, "On/Off - report received."); - runner->NextTest(); -} - -{{/chip_tests_WaitForAttributeReport_attribute_info}} diff --git a/examples/chip-tool/templates/templates.json b/examples/chip-tool/templates/templates.json index 02d6cf552ce243..55b4702a55cdbd 100644 --- a/examples/chip-tool/templates/templates.json +++ b/examples/chip-tool/templates/templates.json @@ -23,10 +23,6 @@ "name": "cluster_header", "path": "../../../src/app/zap-templates/partials/cluster_header.zapt" }, - { - "name": "process_response_value", - "path": "partials/process_response_value.zapt" - }, { "name": "test_cluster", "path": "partials/test_cluster.zapt" diff --git a/src/app/tests/suites/TestSubscribe_OnOff.yaml b/src/app/tests/suites/TestSubscribe_OnOff.yaml index 927c3582083de7..1c909418379409 100644 --- a/src/app/tests/suites/TestSubscribe_OnOff.yaml +++ b/src/app/tests/suites/TestSubscribe_OnOff.yaml @@ -21,6 +21,7 @@ config: tests: - label: "Set OnOff Attribute to false" command: "Off" + - label: "Subscribe OnOff Attribute" command: "subscribeAttribute" attribute: "OnOff" @@ -28,15 +29,19 @@ tests: maxInterval: 10 response: value: false + - label: "Turn On the light to see attribute change" command: "On" + - label: "Check for attribute report" command: "waitForReport" attribute: "OnOff" response: value: true + - label: "Turn Off the light to see attribute change" command: "Off" + - label: "Check for attribute report" command: "waitForReport" attribute: "OnOff" diff --git a/src/app/zap-templates/common/ClusterTestGeneration.js b/src/app/zap-templates/common/ClusterTestGeneration.js index 21a5cce39f3a07..3efa8cfea338d0 100644 --- a/src/app/zap-templates/common/ClusterTestGeneration.js +++ b/src/app/zap-templates/common/ClusterTestGeneration.js @@ -64,10 +64,8 @@ function setDefaultType(test) const type = test[kCommandName]; switch (type) { case 'readAttribute': - test.isAttribute = true; - test.isReadAttribute = true; - test.noCommandSpecificRequestArguments = true; - test.useReadAttributeCallback = true; + test.isAttribute = true; + test.isReadAttribute = true; break; case 'writeAttribute': @@ -76,18 +74,13 @@ function setDefaultType(test) break; case 'subscribeAttribute': - test.isAttribute = true; - test.isSubscribeAttribute = true; - test.noCommandSpecificRequestArguments = true; - test.useReadAttributeCallback = true; + test.isAttribute = true; + test.isSubscribeAttribute = true; break; case 'waitForReport': - test.isAttribute = true; - test.isWaitForReport = true; - test.useReadAttributeCallback = true; - test.noCommandSpecificRequestArguments = true; - test.noFailureCallback = true; + test.isAttribute = true; + test.isWaitForReport = true; break; default: @@ -148,12 +141,16 @@ function setDefaultResponse(test) throwError(test, errorStr); } - if (test.isWriteAttribute && hasResponseValueOrConstraints) { - const errorStr = 'Attribute write test has a "value" or a "constraints" defined.'; - throwError(test, errorStr); + if (!test.isAttribute) { + return; } - if (!test.useReadAttributeCallback) { + if (test.isWriteAttribute || test.isSubscribeAttribute) { + if (hasResponseValueOrConstraints) { + const errorStr = 'Attribute test has a "value" or a "constraints" defined.'; + throwError(test, errorStr); + } + return; } @@ -202,6 +199,34 @@ function parse(filename) const data = fs.readFileSync(filepath, { encoding : 'utf8', flag : 'r' }); const yaml = YAML.parse(data); + // "subscribeAttribute" command expects a report to be acked before + // it got a success response. + // In order to validate that the report has been received with the proper value + // a "subscribeAttribute" command can have a response configured into the test step + // definition. In this case, a new async "waitForReport" test step will be synthesized + // and added to the list of tests. + yaml.tests.forEach((test, index) => { + if (test.command == "subscribeAttribute" && test.response) { + // Create a new report test where the expected response is the response argument + // for the "subscribeAttributeTest" + const reportTest = { + label : "Report: " + test.label, + command : "waitForReport", + attribute : test.attribute, + response : test.response, + async : true + }; + delete test.response; + + // insert the new report test into the tests list + yaml.tests.splice(index, 0, reportTest); + + // Associate the "subscribeAttribute" test with the synthesized report test + test.hasWaitForReport = true; + test.waitForReport = reportTest; + } + }); + const defaultConfig = yaml.config || []; yaml.tests.forEach(test => { test.filename = filename; @@ -325,6 +350,10 @@ function chip_tests_item_parameters(options) const commandValues = this.arguments.values; const promise = assertCommandOrAttribute(this).then(item => { + if (this.isAttribute && !this.isWriteAttribute) { + return []; + } + const commandArgs = item.arguments; const commands = commandArgs.map(commandArg => { commandArg = JSON.parse(JSON.stringify(commandArg)); diff --git a/src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt b/src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt index 8d52cdd83d2fba..1a7550513af671 100644 --- a/src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt @@ -1,37 +1,37 @@ {{#chip_tests_item_response_parameters}} {{#if hasExpectedValue}} {{#if isList}} -XCTAssertEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] count], {{expectedValue.length}}); +XCTAssertEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] count], {{expectedValue.length}}); {{else}} {{#if (isString type)}} {{#if (isOctetString type)}} NSString * {{asLowerCamelCase name}}ArgumentString= @"{{expectedValue}}"; NSData * {{asLowerCamelCase name}}Argument = [{{asLowerCamelCase name}}ArgumentString dataUsingEncoding:NSUTF8StringEncoding]; -XCTAssertTrue([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] isEqualToData:{{asLowerCamelCase name}}Argument]); +XCTAssertTrue([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] isEqualToData:{{asLowerCamelCase name}}Argument]); {{else}} NSString * {{asLowerCamelCase name}}Argument= @"{{expectedValue}}"; -XCTAssertTrue([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] isEqualToString:{{asLowerCamelCase name}}Argument]); +XCTAssertTrue([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] isEqualToString:{{asLowerCamelCase name}}Argument]); {{/if}} {{else}} -XCTAssertEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedValue}}{{asTypeLiteralSuffix}}); +XCTAssertEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedValue}}{{asTypeLiteralSuffix}}); {{/if}} {{/if}} {{/if}} {{#if hasExpectedConstraints}} {{#if expectedConstraints.minLength}} -XCTAssertGreaterThanOrEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.minLength}}); +XCTAssertGreaterThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.minLength}}); {{/if}} {{#if expectedConstraints.maxLength}} -XCTAssertLessThanOrEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.maxLength}}); +XCTAssertLessThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.maxLength}}); {{/if}} {{#if expectedConstraints.minValue}} -XCTAssertGreaterThanOrEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.minValue}}); +XCTAssertGreaterThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.minValue}}); {{/if}} {{#if expectedConstraints.maxValue}} -XCTAssertLessThanOrEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.maxValue}}); +XCTAssertLessThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.maxValue}}); {{/if}} {{#if expectedConstraints.notValue}} -XCTAssertNotEqual([values[@"{{#if parent.useReadAttributeCallback}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.notValue}}); +XCTAssertNotEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.notValue}}); {{/if}} {{/if}} {{/chip_tests_item_response_parameters}} diff --git a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt index a42168c6723700..c14a780f295408 100644 --- a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt @@ -12,7 +12,6 @@ CHIP{{asUpperCamelCase cluster}} * cluster = [[CHIP{{asUpperCamelCase cluster}} alloc] initWithDevice:device endpoint:{{endpoint}} queue:queue]; XCTAssertNotNil(cluster); - {{#unless noCommandSpecificRequestArguments}} {{#chip_tests_item_parameters}} {{#if (isString type)}} {{#if (isOctetString type)}} @@ -25,7 +24,6 @@ {{chipType}} {{asLowerCamelCase name}}Argument = {{definedValue}}{{asTypeLiteralSuffix chipType}}; {{/if}} {{/chip_tests_item_parameters}} - {{/unless}} {{#if isCommand}} [cluster {{asLowerCamelCase command}}:{{#chip_tests_item_parameters}}{{#not_first}}{{asLowerCamelCase name}}:{{/not_first}}{{asLowerCamelCase name}}Argument {{#last}}responseHandler:{{/last}}{{/chip_tests_item_parameters}}^(NSError * err, NSDictionary * values) { {{else if isSubscribeAttribute}} From 69dbd1296b27c6cc4272d4d0a2bf5213b8f872e5 Mon Sep 17 00:00:00 2001 From: Song Guo Date: Wed, 15 Sep 2021 10:40:15 +0800 Subject: [PATCH 4/5] Port test to darwin --- .../partials/process_response_value.zapt | 37 ----------- .../CHIP/templates/partials/test_cluster.zapt | 62 ++++++++++++++++--- .../Framework/CHIP/templates/templates.json | 4 -- 3 files changed, 52 insertions(+), 51 deletions(-) delete mode 100644 src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt diff --git a/src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt b/src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt deleted file mode 100644 index 1a7550513af671..00000000000000 --- a/src/darwin/Framework/CHIP/templates/partials/process_response_value.zapt +++ /dev/null @@ -1,37 +0,0 @@ -{{#chip_tests_item_response_parameters}} -{{#if hasExpectedValue}} -{{#if isList}} -XCTAssertEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] count], {{expectedValue.length}}); -{{else}} -{{#if (isString type)}} -{{#if (isOctetString type)}} -NSString * {{asLowerCamelCase name}}ArgumentString= @"{{expectedValue}}"; -NSData * {{asLowerCamelCase name}}Argument = [{{asLowerCamelCase name}}ArgumentString dataUsingEncoding:NSUTF8StringEncoding]; -XCTAssertTrue([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] isEqualToData:{{asLowerCamelCase name}}Argument]); -{{else}} -NSString * {{asLowerCamelCase name}}Argument= @"{{expectedValue}}"; -XCTAssertTrue([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] isEqualToString:{{asLowerCamelCase name}}Argument]); -{{/if}} -{{else}} -XCTAssertEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedValue}}{{asTypeLiteralSuffix}}); -{{/if}} -{{/if}} -{{/if}} -{{#if hasExpectedConstraints}} -{{#if expectedConstraints.minLength}} -XCTAssertGreaterThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.minLength}}); -{{/if}} -{{#if expectedConstraints.maxLength}} -XCTAssertLessThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.maxLength}}); -{{/if}} -{{#if expectedConstraints.minValue}} -XCTAssertGreaterThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.minValue}}); -{{/if}} -{{#if expectedConstraints.maxValue}} -XCTAssertLessThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.maxValue}}); -{{/if}} -{{#if expectedConstraints.notValue}} -XCTAssertNotEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.notValue}}); -{{/if}} -{{/if}} -{{/chip_tests_item_response_parameters}} diff --git a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt index c14a780f295408..7bb34c396ba823 100644 --- a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt @@ -1,8 +1,14 @@ {{#chip_tests tests}} {{#chip_tests_items}} +{{#if async}} +bool testSendCluster{{parent.filename}}_{{asTestIndex index}}_{{asUpperCamelCase command}}_Fulfilled = false; +{{/if}} - (void)testSendCluster{{parent.filename}}_{{asTestIndex index}}_{{asUpperCamelCase command}} { + {{#unless async}} XCTestExpectation * expectation = [self expectationWithDescription:@"{{label}}"]; + {{/unless}} + {{#if (isTestOnlyCluster cluster)}} dispatch_queue_t queue = dispatch_get_main_queue(); {{command}}(expectation, queue{{#chip_tests_item_parameters}}, {{definedValue}}{{/chip_tests_item_parameters}}); @@ -27,14 +33,6 @@ {{#if isCommand}} [cluster {{asLowerCamelCase command}}:{{#chip_tests_item_parameters}}{{#not_first}}{{asLowerCamelCase name}}:{{/not_first}}{{asLowerCamelCase name}}Argument {{#last}}responseHandler:{{/last}}{{/chip_tests_item_parameters}}^(NSError * err, NSDictionary * values) { {{else if isSubscribeAttribute}} - __block bool initialReportReceived = false; - [cluster reportAttribute{{asUpperCamelCase attribute}}WithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reporting Test Report: %@", err); - XCTAssertEqual(err.code, 0); - {{> process_response_value}} - initialReportReceived = true; - }]; - [cluster configureAttribute{{asUpperCamelCase attribute}}WithMinInterval:{{minInterval}} maxInterval:{{maxInterval}} responseHandler:^(NSError * err, NSDictionary * values) { @@ -59,16 +57,60 @@ [expectation fulfill]; {{else}} {{#unless isSubscribeAttribute}} - {{> process_response_value}} + + {{#chip_tests_item_response_parameters}} + {{#if hasExpectedValue}} + {{#if isList}} + XCTAssertEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] count], {{expectedValue.length}}); + {{else}} + {{#if (isString type)}} + {{#if (isOctetString type)}} + NSString * {{asLowerCamelCase name}}ArgumentString= @"{{expectedValue}}"; + NSData * {{asLowerCamelCase name}}Argument = [{{asLowerCamelCase name}}ArgumentString dataUsingEncoding:NSUTF8StringEncoding]; + XCTAssertTrue([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] isEqualToData:{{asLowerCamelCase name}}Argument]); + {{else}} + NSString * {{asLowerCamelCase name}}Argument= @"{{expectedValue}}"; + XCTAssertTrue([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] isEqualToString:{{asLowerCamelCase name}}Argument]); + {{/if}} + {{else}} + XCTAssertEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedValue}}{{asTypeLiteralSuffix}}); + {{/if}} + {{/if}} + {{/if}} + {{#if hasExpectedConstraints}} + {{#if expectedConstraints.minLength}} + XCTAssertGreaterThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.minLength}}); + {{/if}} + {{#if expectedConstraints.maxLength}} + XCTAssertLessThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] length], {{expectedConstraints.maxLength}}); + {{/if}} + {{#if expectedConstraints.minValue}} + XCTAssertGreaterThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.minValue}}); + {{/if}} + {{#if expectedConstraints.maxValue}} + XCTAssertLessThanOrEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.maxValue}}); + {{/if}} + {{#if expectedConstraints.notValue}} + XCTAssertNotEqual([values[@"{{#if parent.isAttribute}}value{{else}}{{name}}{{/if}}"] {{asObjectiveCNumberType "" type true}}Value], {{expectedConstraints.notValue}}); + {{/if}} + {{/if}} + {{/chip_tests_item_response_parameters}} + {{else}} - XCTAssertEqual(initialReportReceived, true); + XCTAssertEqual(testSendCluster{{parent.filename}}_{{asTestIndex waitForReport.index}}_{{asUpperCamelCase waitForReport.command}}_Fulfilled, true); {{/unless}} + {{#unless async}} [expectation fulfill]; + {{else}} + testSendCluster{{parent.filename}}_{{asTestIndex index}}_{{asUpperCamelCase command}}_Fulfilled = true; + {{/unless}} {{/unless}} }]; {{/if}} + {{#unless async}} [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; + {{/unless}} } {{/chip_tests_items}} diff --git a/src/darwin/Framework/CHIP/templates/templates.json b/src/darwin/Framework/CHIP/templates/templates.json index f0f9231bd67103..7960d62a3c8618 100644 --- a/src/darwin/Framework/CHIP/templates/templates.json +++ b/src/darwin/Framework/CHIP/templates/templates.json @@ -19,10 +19,6 @@ "name": "test_cluster", "path": "partials/test_cluster.zapt" }, - { - "name": "process_response_value", - "path": "partials/process_response_value.zapt" - }, { "name": "CHIPCallbackBridge", "path": "partials/CHIPCallbackBridge.zapt" From dc79acf5dd12d86edf52f84e729ce97196e30e5e Mon Sep 17 00:00:00 2001 From: Song Guo Date: Wed, 15 Sep 2021 11:32:23 +0800 Subject: [PATCH 5/5] Run Codegen --- .../Framework/CHIPTests/CHIPClustersTests.m | 714 +++++++++++++++++- .../chip-tool/zap-generated/test/Commands.h | 331 ++++++-- 2 files changed, 983 insertions(+), 62 deletions(-) diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index f23ac1db223289..5db99ebce72cad 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -163,6 +163,7 @@ - (void)testReuseChipClusterObject - (void)testSendClusterTestCluster_000000_Test { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -172,6 +173,7 @@ - (void)testSendClusterTestCluster_000000_Test NSLog(@"Send Test Command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -180,6 +182,7 @@ - (void)testSendClusterTestCluster_000000_Test - (void)testSendClusterTestCluster_000001_TestNotHandled { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Not Handled Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -197,6 +200,7 @@ - (void)testSendClusterTestCluster_000001_TestNotHandled - (void)testSendClusterTestCluster_000002_TestSpecific { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Specific Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -206,7 +210,9 @@ - (void)testSendClusterTestCluster_000002_TestSpecific NSLog(@"Send Test Specific Command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"returnValue"] unsignedCharValue], 7); + [expectation fulfill]; }]; @@ -215,6 +221,7 @@ - (void)testSendClusterTestCluster_000002_TestSpecific - (void)testSendClusterTestCluster_000003_TestAddArguments { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Add Arguments Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -228,7 +235,9 @@ - (void)testSendClusterTestCluster_000003_TestAddArguments NSLog(@"Send Test Add Arguments Command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"returnValue"] unsignedCharValue], 20); + [expectation fulfill]; }]; @@ -237,6 +246,7 @@ - (void)testSendClusterTestCluster_000003_TestAddArguments - (void)testSendClusterTestCluster_000004_TestAddArguments { XCTestExpectation * expectation = [self expectationWithDescription:@"Send failing Test Add Arguments Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -258,6 +268,7 @@ - (void)testSendClusterTestCluster_000004_TestAddArguments - (void)testSendClusterTestCluster_000005_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BOOLEAN Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -267,7 +278,9 @@ - (void)testSendClusterTestCluster_000005_ReadAttribute NSLog(@"Read attribute BOOLEAN Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -276,6 +289,7 @@ - (void)testSendClusterTestCluster_000005_ReadAttribute - (void)testSendClusterTestCluster_000006_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BOOLEAN True"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -287,6 +301,7 @@ - (void)testSendClusterTestCluster_000006_WriteAttribute NSLog(@"Write attribute BOOLEAN True Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -295,6 +310,7 @@ - (void)testSendClusterTestCluster_000006_WriteAttribute - (void)testSendClusterTestCluster_000007_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BOOLEAN True"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -304,7 +320,9 @@ - (void)testSendClusterTestCluster_000007_ReadAttribute NSLog(@"Read attribute BOOLEAN True Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 1); + [expectation fulfill]; }]; @@ -313,6 +331,7 @@ - (void)testSendClusterTestCluster_000007_ReadAttribute - (void)testSendClusterTestCluster_000008_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BOOLEAN False"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -324,6 +343,7 @@ - (void)testSendClusterTestCluster_000008_WriteAttribute NSLog(@"Write attribute BOOLEAN False Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -332,6 +352,7 @@ - (void)testSendClusterTestCluster_000008_WriteAttribute - (void)testSendClusterTestCluster_000009_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BOOLEAN False"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -341,7 +362,9 @@ - (void)testSendClusterTestCluster_000009_ReadAttribute NSLog(@"Read attribute BOOLEAN False Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -350,6 +373,7 @@ - (void)testSendClusterTestCluster_000009_ReadAttribute - (void)testSendClusterTestCluster_000010_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP8 Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -359,7 +383,9 @@ - (void)testSendClusterTestCluster_000010_ReadAttribute NSLog(@"Read attribute BITMAP8 Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -368,6 +394,7 @@ - (void)testSendClusterTestCluster_000010_ReadAttribute - (void)testSendClusterTestCluster_000011_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP8 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -379,6 +406,7 @@ - (void)testSendClusterTestCluster_000011_WriteAttribute NSLog(@"Write attribute BITMAP8 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -387,6 +415,7 @@ - (void)testSendClusterTestCluster_000011_WriteAttribute - (void)testSendClusterTestCluster_000012_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP8 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -396,7 +425,9 @@ - (void)testSendClusterTestCluster_000012_ReadAttribute NSLog(@"Read attribute BITMAP8 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + [expectation fulfill]; }]; @@ -405,6 +436,7 @@ - (void)testSendClusterTestCluster_000012_ReadAttribute - (void)testSendClusterTestCluster_000013_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP8 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -416,6 +448,7 @@ - (void)testSendClusterTestCluster_000013_WriteAttribute NSLog(@"Write attribute BITMAP8 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -424,6 +457,7 @@ - (void)testSendClusterTestCluster_000013_WriteAttribute - (void)testSendClusterTestCluster_000014_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP8 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -433,7 +467,9 @@ - (void)testSendClusterTestCluster_000014_ReadAttribute NSLog(@"Read attribute BITMAP8 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -442,6 +478,7 @@ - (void)testSendClusterTestCluster_000014_ReadAttribute - (void)testSendClusterTestCluster_000015_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP16 Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -451,7 +488,9 @@ - (void)testSendClusterTestCluster_000015_ReadAttribute NSLog(@"Read attribute BITMAP16 Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0); + [expectation fulfill]; }]; @@ -460,6 +499,7 @@ - (void)testSendClusterTestCluster_000015_ReadAttribute - (void)testSendClusterTestCluster_000016_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP16 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -471,6 +511,7 @@ - (void)testSendClusterTestCluster_000016_WriteAttribute NSLog(@"Write attribute BITMAP16 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -479,6 +520,7 @@ - (void)testSendClusterTestCluster_000016_WriteAttribute - (void)testSendClusterTestCluster_000017_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP16 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -488,7 +530,9 @@ - (void)testSendClusterTestCluster_000017_ReadAttribute NSLog(@"Read attribute BITMAP16 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 65535); + [expectation fulfill]; }]; @@ -497,6 +541,7 @@ - (void)testSendClusterTestCluster_000017_ReadAttribute - (void)testSendClusterTestCluster_000018_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP16 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -508,6 +553,7 @@ - (void)testSendClusterTestCluster_000018_WriteAttribute NSLog(@"Write attribute BITMAP16 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -516,6 +562,7 @@ - (void)testSendClusterTestCluster_000018_WriteAttribute - (void)testSendClusterTestCluster_000019_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP16 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -525,7 +572,9 @@ - (void)testSendClusterTestCluster_000019_ReadAttribute NSLog(@"Read attribute BITMAP16 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0); + [expectation fulfill]; }]; @@ -534,6 +583,7 @@ - (void)testSendClusterTestCluster_000019_ReadAttribute - (void)testSendClusterTestCluster_000020_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP32 Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -543,7 +593,9 @@ - (void)testSendClusterTestCluster_000020_ReadAttribute NSLog(@"Read attribute BITMAP32 Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongValue], 0); + [expectation fulfill]; }]; @@ -552,6 +604,7 @@ - (void)testSendClusterTestCluster_000020_ReadAttribute - (void)testSendClusterTestCluster_000021_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP32 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -563,6 +616,7 @@ - (void)testSendClusterTestCluster_000021_WriteAttribute NSLog(@"Write attribute BITMAP32 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -571,6 +625,7 @@ - (void)testSendClusterTestCluster_000021_WriteAttribute - (void)testSendClusterTestCluster_000022_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP32 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -580,7 +635,9 @@ - (void)testSendClusterTestCluster_000022_ReadAttribute NSLog(@"Read attribute BITMAP32 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongValue], 4294967295); + [expectation fulfill]; }]; @@ -589,6 +646,7 @@ - (void)testSendClusterTestCluster_000022_ReadAttribute - (void)testSendClusterTestCluster_000023_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP32 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -600,6 +658,7 @@ - (void)testSendClusterTestCluster_000023_WriteAttribute NSLog(@"Write attribute BITMAP32 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -608,6 +667,7 @@ - (void)testSendClusterTestCluster_000023_WriteAttribute - (void)testSendClusterTestCluster_000024_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP32 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -617,7 +677,9 @@ - (void)testSendClusterTestCluster_000024_ReadAttribute NSLog(@"Read attribute BITMAP32 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongValue], 0); + [expectation fulfill]; }]; @@ -626,6 +688,7 @@ - (void)testSendClusterTestCluster_000024_ReadAttribute - (void)testSendClusterTestCluster_000025_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP64 Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -635,7 +698,9 @@ - (void)testSendClusterTestCluster_000025_ReadAttribute NSLog(@"Read attribute BITMAP64 Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0); + [expectation fulfill]; }]; @@ -644,6 +709,7 @@ - (void)testSendClusterTestCluster_000025_ReadAttribute - (void)testSendClusterTestCluster_000026_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP64 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -655,6 +721,7 @@ - (void)testSendClusterTestCluster_000026_WriteAttribute NSLog(@"Write attribute BITMAP64 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -663,6 +730,7 @@ - (void)testSendClusterTestCluster_000026_WriteAttribute - (void)testSendClusterTestCluster_000027_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP64 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -672,7 +740,9 @@ - (void)testSendClusterTestCluster_000027_ReadAttribute NSLog(@"Read attribute BITMAP64 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 18446744073709551615); + [expectation fulfill]; }]; @@ -681,6 +751,7 @@ - (void)testSendClusterTestCluster_000027_ReadAttribute - (void)testSendClusterTestCluster_000028_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute BITMAP64 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -692,6 +763,7 @@ - (void)testSendClusterTestCluster_000028_WriteAttribute NSLog(@"Write attribute BITMAP64 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -700,6 +772,7 @@ - (void)testSendClusterTestCluster_000028_WriteAttribute - (void)testSendClusterTestCluster_000029_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP64 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -709,7 +782,9 @@ - (void)testSendClusterTestCluster_000029_ReadAttribute NSLog(@"Read attribute BITMAP64 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0); + [expectation fulfill]; }]; @@ -718,6 +793,7 @@ - (void)testSendClusterTestCluster_000029_ReadAttribute - (void)testSendClusterTestCluster_000030_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8U Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -727,7 +803,9 @@ - (void)testSendClusterTestCluster_000030_ReadAttribute NSLog(@"Read attribute INT8U Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -736,6 +814,7 @@ - (void)testSendClusterTestCluster_000030_ReadAttribute - (void)testSendClusterTestCluster_000031_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8U Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -747,6 +826,7 @@ - (void)testSendClusterTestCluster_000031_WriteAttribute NSLog(@"Write attribute INT8U Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -755,6 +835,7 @@ - (void)testSendClusterTestCluster_000031_WriteAttribute - (void)testSendClusterTestCluster_000032_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8U Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -764,7 +845,9 @@ - (void)testSendClusterTestCluster_000032_ReadAttribute NSLog(@"Read attribute INT8U Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + [expectation fulfill]; }]; @@ -773,6 +856,7 @@ - (void)testSendClusterTestCluster_000032_ReadAttribute - (void)testSendClusterTestCluster_000033_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8U Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -784,6 +868,7 @@ - (void)testSendClusterTestCluster_000033_WriteAttribute NSLog(@"Write attribute INT8U Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -792,6 +877,7 @@ - (void)testSendClusterTestCluster_000033_WriteAttribute - (void)testSendClusterTestCluster_000034_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8U Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -801,7 +887,9 @@ - (void)testSendClusterTestCluster_000034_ReadAttribute NSLog(@"Read attribute INT8U Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -810,6 +898,7 @@ - (void)testSendClusterTestCluster_000034_ReadAttribute - (void)testSendClusterTestCluster_000035_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16U Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -819,7 +908,9 @@ - (void)testSendClusterTestCluster_000035_ReadAttribute NSLog(@"Read attribute INT16U Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0); + [expectation fulfill]; }]; @@ -828,6 +919,7 @@ - (void)testSendClusterTestCluster_000035_ReadAttribute - (void)testSendClusterTestCluster_000036_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16U Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -839,6 +931,7 @@ - (void)testSendClusterTestCluster_000036_WriteAttribute NSLog(@"Write attribute INT16U Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -847,6 +940,7 @@ - (void)testSendClusterTestCluster_000036_WriteAttribute - (void)testSendClusterTestCluster_000037_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16U Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -856,7 +950,9 @@ - (void)testSendClusterTestCluster_000037_ReadAttribute NSLog(@"Read attribute INT16U Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 65535); + [expectation fulfill]; }]; @@ -865,6 +961,7 @@ - (void)testSendClusterTestCluster_000037_ReadAttribute - (void)testSendClusterTestCluster_000038_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16U Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -876,6 +973,7 @@ - (void)testSendClusterTestCluster_000038_WriteAttribute NSLog(@"Write attribute INT16U Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -884,6 +982,7 @@ - (void)testSendClusterTestCluster_000038_WriteAttribute - (void)testSendClusterTestCluster_000039_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16U Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -893,7 +992,9 @@ - (void)testSendClusterTestCluster_000039_ReadAttribute NSLog(@"Read attribute INT16U Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0); + [expectation fulfill]; }]; @@ -902,6 +1003,7 @@ - (void)testSendClusterTestCluster_000039_ReadAttribute - (void)testSendClusterTestCluster_000040_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -911,7 +1013,9 @@ - (void)testSendClusterTestCluster_000040_ReadAttribute NSLog(@"Read attribute INT32U Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongValue], 0); + [expectation fulfill]; }]; @@ -920,6 +1024,7 @@ - (void)testSendClusterTestCluster_000040_ReadAttribute - (void)testSendClusterTestCluster_000041_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32U Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -931,6 +1036,7 @@ - (void)testSendClusterTestCluster_000041_WriteAttribute NSLog(@"Write attribute INT32U Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -939,6 +1045,7 @@ - (void)testSendClusterTestCluster_000041_WriteAttribute - (void)testSendClusterTestCluster_000042_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -948,7 +1055,9 @@ - (void)testSendClusterTestCluster_000042_ReadAttribute NSLog(@"Read attribute INT32U Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongValue], 4294967295); + [expectation fulfill]; }]; @@ -957,6 +1066,7 @@ - (void)testSendClusterTestCluster_000042_ReadAttribute - (void)testSendClusterTestCluster_000043_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32U Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -968,6 +1078,7 @@ - (void)testSendClusterTestCluster_000043_WriteAttribute NSLog(@"Write attribute INT32U Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -976,6 +1087,7 @@ - (void)testSendClusterTestCluster_000043_WriteAttribute - (void)testSendClusterTestCluster_000044_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -985,7 +1097,9 @@ - (void)testSendClusterTestCluster_000044_ReadAttribute NSLog(@"Read attribute INT32U Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongValue], 0); + [expectation fulfill]; }]; @@ -994,6 +1108,7 @@ - (void)testSendClusterTestCluster_000044_ReadAttribute - (void)testSendClusterTestCluster_000045_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64U Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1003,7 +1118,9 @@ - (void)testSendClusterTestCluster_000045_ReadAttribute NSLog(@"Read attribute INT64U Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0); + [expectation fulfill]; }]; @@ -1012,6 +1129,7 @@ - (void)testSendClusterTestCluster_000045_ReadAttribute - (void)testSendClusterTestCluster_000046_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64U Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1023,6 +1141,7 @@ - (void)testSendClusterTestCluster_000046_WriteAttribute NSLog(@"Write attribute INT64U Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1031,6 +1150,7 @@ - (void)testSendClusterTestCluster_000046_WriteAttribute - (void)testSendClusterTestCluster_000047_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64U Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1040,7 +1160,9 @@ - (void)testSendClusterTestCluster_000047_ReadAttribute NSLog(@"Read attribute INT64U Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 18446744073709551615); + [expectation fulfill]; }]; @@ -1049,6 +1171,7 @@ - (void)testSendClusterTestCluster_000047_ReadAttribute - (void)testSendClusterTestCluster_000048_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64U Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1060,6 +1183,7 @@ - (void)testSendClusterTestCluster_000048_WriteAttribute NSLog(@"Write attribute INT64U Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1068,6 +1192,7 @@ - (void)testSendClusterTestCluster_000048_WriteAttribute - (void)testSendClusterTestCluster_000049_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64U Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1077,7 +1202,9 @@ - (void)testSendClusterTestCluster_000049_ReadAttribute NSLog(@"Read attribute INT64U Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongLongValue], 0); + [expectation fulfill]; }]; @@ -1086,6 +1213,7 @@ - (void)testSendClusterTestCluster_000049_ReadAttribute - (void)testSendClusterTestCluster_000050_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1095,7 +1223,9 @@ - (void)testSendClusterTestCluster_000050_ReadAttribute NSLog(@"Read attribute INT8S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] charValue], 0); + [expectation fulfill]; }]; @@ -1104,6 +1234,7 @@ - (void)testSendClusterTestCluster_000050_ReadAttribute - (void)testSendClusterTestCluster_000051_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8S Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1115,6 +1246,7 @@ - (void)testSendClusterTestCluster_000051_WriteAttribute NSLog(@"Write attribute INT8S Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1123,6 +1255,7 @@ - (void)testSendClusterTestCluster_000051_WriteAttribute - (void)testSendClusterTestCluster_000052_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1132,7 +1265,9 @@ - (void)testSendClusterTestCluster_000052_ReadAttribute NSLog(@"Read attribute INT8S Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] charValue], 127); + [expectation fulfill]; }]; @@ -1141,6 +1276,7 @@ - (void)testSendClusterTestCluster_000052_ReadAttribute - (void)testSendClusterTestCluster_000053_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8S Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1152,6 +1288,7 @@ - (void)testSendClusterTestCluster_000053_WriteAttribute NSLog(@"Write attribute INT8S Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1160,6 +1297,7 @@ - (void)testSendClusterTestCluster_000053_WriteAttribute - (void)testSendClusterTestCluster_000054_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1169,7 +1307,9 @@ - (void)testSendClusterTestCluster_000054_ReadAttribute NSLog(@"Read attribute INT8S Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] charValue], -128); + [expectation fulfill]; }]; @@ -1178,6 +1318,7 @@ - (void)testSendClusterTestCluster_000054_ReadAttribute - (void)testSendClusterTestCluster_000055_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT8S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1189,6 +1330,7 @@ - (void)testSendClusterTestCluster_000055_WriteAttribute NSLog(@"Write attribute INT8S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1197,6 +1339,7 @@ - (void)testSendClusterTestCluster_000055_WriteAttribute - (void)testSendClusterTestCluster_000056_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1206,7 +1349,9 @@ - (void)testSendClusterTestCluster_000056_ReadAttribute NSLog(@"Read attribute INT8S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] charValue], 0); + [expectation fulfill]; }]; @@ -1215,6 +1360,7 @@ - (void)testSendClusterTestCluster_000056_ReadAttribute - (void)testSendClusterTestCluster_000057_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1224,7 +1370,9 @@ - (void)testSendClusterTestCluster_000057_ReadAttribute NSLog(@"Read attribute INT16S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] shortValue], 0); + [expectation fulfill]; }]; @@ -1233,6 +1381,7 @@ - (void)testSendClusterTestCluster_000057_ReadAttribute - (void)testSendClusterTestCluster_000058_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16S Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1244,6 +1393,7 @@ - (void)testSendClusterTestCluster_000058_WriteAttribute NSLog(@"Write attribute INT16S Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1252,6 +1402,7 @@ - (void)testSendClusterTestCluster_000058_WriteAttribute - (void)testSendClusterTestCluster_000059_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1261,7 +1412,9 @@ - (void)testSendClusterTestCluster_000059_ReadAttribute NSLog(@"Read attribute INT16S Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] shortValue], 32767); + [expectation fulfill]; }]; @@ -1270,6 +1423,7 @@ - (void)testSendClusterTestCluster_000059_ReadAttribute - (void)testSendClusterTestCluster_000060_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16S Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1281,6 +1435,7 @@ - (void)testSendClusterTestCluster_000060_WriteAttribute NSLog(@"Write attribute INT16S Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1289,6 +1444,7 @@ - (void)testSendClusterTestCluster_000060_WriteAttribute - (void)testSendClusterTestCluster_000061_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1298,7 +1454,9 @@ - (void)testSendClusterTestCluster_000061_ReadAttribute NSLog(@"Read attribute INT16S Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] shortValue], -32768); + [expectation fulfill]; }]; @@ -1307,6 +1465,7 @@ - (void)testSendClusterTestCluster_000061_ReadAttribute - (void)testSendClusterTestCluster_000062_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT16S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1318,6 +1477,7 @@ - (void)testSendClusterTestCluster_000062_WriteAttribute NSLog(@"Write attribute INT16S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1326,6 +1486,7 @@ - (void)testSendClusterTestCluster_000062_WriteAttribute - (void)testSendClusterTestCluster_000063_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1335,7 +1496,9 @@ - (void)testSendClusterTestCluster_000063_ReadAttribute NSLog(@"Read attribute INT16S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] shortValue], 0); + [expectation fulfill]; }]; @@ -1344,6 +1507,7 @@ - (void)testSendClusterTestCluster_000063_ReadAttribute - (void)testSendClusterTestCluster_000064_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1353,7 +1517,9 @@ - (void)testSendClusterTestCluster_000064_ReadAttribute NSLog(@"Read attribute INT32S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] longValue], 0); + [expectation fulfill]; }]; @@ -1362,6 +1528,7 @@ - (void)testSendClusterTestCluster_000064_ReadAttribute - (void)testSendClusterTestCluster_000065_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32S Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1373,6 +1540,7 @@ - (void)testSendClusterTestCluster_000065_WriteAttribute NSLog(@"Write attribute INT32S Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1381,6 +1549,7 @@ - (void)testSendClusterTestCluster_000065_WriteAttribute - (void)testSendClusterTestCluster_000066_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1390,7 +1559,9 @@ - (void)testSendClusterTestCluster_000066_ReadAttribute NSLog(@"Read attribute INT32S Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] longValue], 2147483647); + [expectation fulfill]; }]; @@ -1399,6 +1570,7 @@ - (void)testSendClusterTestCluster_000066_ReadAttribute - (void)testSendClusterTestCluster_000067_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32S Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1410,6 +1582,7 @@ - (void)testSendClusterTestCluster_000067_WriteAttribute NSLog(@"Write attribute INT32S Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1418,6 +1591,7 @@ - (void)testSendClusterTestCluster_000067_WriteAttribute - (void)testSendClusterTestCluster_000068_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1427,7 +1601,9 @@ - (void)testSendClusterTestCluster_000068_ReadAttribute NSLog(@"Read attribute INT32S Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] longValue], -2147483648); + [expectation fulfill]; }]; @@ -1436,6 +1612,7 @@ - (void)testSendClusterTestCluster_000068_ReadAttribute - (void)testSendClusterTestCluster_000069_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1447,6 +1624,7 @@ - (void)testSendClusterTestCluster_000069_WriteAttribute NSLog(@"Write attribute INT32S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1455,6 +1633,7 @@ - (void)testSendClusterTestCluster_000069_WriteAttribute - (void)testSendClusterTestCluster_000070_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1464,7 +1643,9 @@ - (void)testSendClusterTestCluster_000070_ReadAttribute NSLog(@"Read attribute INT32S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] longValue], 0); + [expectation fulfill]; }]; @@ -1473,6 +1654,7 @@ - (void)testSendClusterTestCluster_000070_ReadAttribute - (void)testSendClusterTestCluster_000071_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1482,7 +1664,9 @@ - (void)testSendClusterTestCluster_000071_ReadAttribute NSLog(@"Read attribute INT64S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] longLongValue], 0); + [expectation fulfill]; }]; @@ -1491,6 +1675,7 @@ - (void)testSendClusterTestCluster_000071_ReadAttribute - (void)testSendClusterTestCluster_000072_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64S Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1502,6 +1687,7 @@ - (void)testSendClusterTestCluster_000072_WriteAttribute NSLog(@"Write attribute INT64S Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1510,6 +1696,7 @@ - (void)testSendClusterTestCluster_000072_WriteAttribute - (void)testSendClusterTestCluster_000073_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1519,7 +1706,9 @@ - (void)testSendClusterTestCluster_000073_ReadAttribute NSLog(@"Read attribute INT64S Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] longLongValue], 9223372036854775807); + [expectation fulfill]; }]; @@ -1528,6 +1717,7 @@ - (void)testSendClusterTestCluster_000073_ReadAttribute - (void)testSendClusterTestCluster_000074_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64S Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1539,6 +1729,7 @@ - (void)testSendClusterTestCluster_000074_WriteAttribute NSLog(@"Write attribute INT64S Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1547,6 +1738,7 @@ - (void)testSendClusterTestCluster_000074_WriteAttribute - (void)testSendClusterTestCluster_000075_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1556,7 +1748,9 @@ - (void)testSendClusterTestCluster_000075_ReadAttribute NSLog(@"Read attribute INT64S Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] longLongValue], -9223372036854775807); + [expectation fulfill]; }]; @@ -1565,6 +1759,7 @@ - (void)testSendClusterTestCluster_000075_ReadAttribute - (void)testSendClusterTestCluster_000076_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT64S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1576,6 +1771,7 @@ - (void)testSendClusterTestCluster_000076_WriteAttribute NSLog(@"Write attribute INT64S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1584,6 +1780,7 @@ - (void)testSendClusterTestCluster_000076_WriteAttribute - (void)testSendClusterTestCluster_000077_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1593,7 +1790,9 @@ - (void)testSendClusterTestCluster_000077_ReadAttribute NSLog(@"Read attribute INT64S Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] longLongValue], 0); + [expectation fulfill]; }]; @@ -1602,6 +1801,7 @@ - (void)testSendClusterTestCluster_000077_ReadAttribute - (void)testSendClusterTestCluster_000078_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM8 Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1611,7 +1811,9 @@ - (void)testSendClusterTestCluster_000078_ReadAttribute NSLog(@"Read attribute ENUM8 Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -1620,6 +1822,7 @@ - (void)testSendClusterTestCluster_000078_ReadAttribute - (void)testSendClusterTestCluster_000079_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM8 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1631,6 +1834,7 @@ - (void)testSendClusterTestCluster_000079_WriteAttribute NSLog(@"Write attribute ENUM8 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1639,6 +1843,7 @@ - (void)testSendClusterTestCluster_000079_WriteAttribute - (void)testSendClusterTestCluster_000080_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM8 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1648,7 +1853,9 @@ - (void)testSendClusterTestCluster_000080_ReadAttribute NSLog(@"Read attribute ENUM8 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + [expectation fulfill]; }]; @@ -1657,6 +1864,7 @@ - (void)testSendClusterTestCluster_000080_ReadAttribute - (void)testSendClusterTestCluster_000081_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM8 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1668,6 +1876,7 @@ - (void)testSendClusterTestCluster_000081_WriteAttribute NSLog(@"Write attribute ENUM8 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1676,6 +1885,7 @@ - (void)testSendClusterTestCluster_000081_WriteAttribute - (void)testSendClusterTestCluster_000082_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM8 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1685,7 +1895,9 @@ - (void)testSendClusterTestCluster_000082_ReadAttribute NSLog(@"Read attribute ENUM8 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -1694,6 +1906,7 @@ - (void)testSendClusterTestCluster_000082_ReadAttribute - (void)testSendClusterTestCluster_000083_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM16 Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1703,7 +1916,9 @@ - (void)testSendClusterTestCluster_000083_ReadAttribute NSLog(@"Read attribute ENUM16 Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0); + [expectation fulfill]; }]; @@ -1712,6 +1927,7 @@ - (void)testSendClusterTestCluster_000083_ReadAttribute - (void)testSendClusterTestCluster_000084_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM16 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1723,6 +1939,7 @@ - (void)testSendClusterTestCluster_000084_WriteAttribute NSLog(@"Write attribute ENUM16 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1731,6 +1948,7 @@ - (void)testSendClusterTestCluster_000084_WriteAttribute - (void)testSendClusterTestCluster_000085_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM16 Max Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1740,7 +1958,9 @@ - (void)testSendClusterTestCluster_000085_ReadAttribute NSLog(@"Read attribute ENUM16 Max Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 65535); + [expectation fulfill]; }]; @@ -1749,6 +1969,7 @@ - (void)testSendClusterTestCluster_000085_ReadAttribute - (void)testSendClusterTestCluster_000086_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute ENUM16 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1760,6 +1981,7 @@ - (void)testSendClusterTestCluster_000086_WriteAttribute NSLog(@"Write attribute ENUM16 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1768,6 +1990,7 @@ - (void)testSendClusterTestCluster_000086_WriteAttribute - (void)testSendClusterTestCluster_000087_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM16 Min Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1777,7 +2000,9 @@ - (void)testSendClusterTestCluster_000087_ReadAttribute NSLog(@"Read attribute ENUM16 Min Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0); + [expectation fulfill]; }]; @@ -1786,6 +2011,7 @@ - (void)testSendClusterTestCluster_000087_ReadAttribute - (void)testSendClusterTestCluster_000088_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute OCTET_STRING Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1795,9 +2021,11 @@ - (void)testSendClusterTestCluster_000088_ReadAttribute NSLog(@"Read attribute OCTET_STRING Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + NSString * octetStringArgumentString = @""; NSData * octetStringArgument = [octetStringArgumentString dataUsingEncoding:NSUTF8StringEncoding]; XCTAssertTrue([values[@"value"] isEqualToData:octetStringArgument]); + [expectation fulfill]; }]; @@ -1806,6 +2034,7 @@ - (void)testSendClusterTestCluster_000088_ReadAttribute - (void)testSendClusterTestCluster_000089_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1818,6 +2047,7 @@ - (void)testSendClusterTestCluster_000089_WriteAttribute NSLog(@"Write attribute OCTET_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1826,6 +2056,7 @@ - (void)testSendClusterTestCluster_000089_WriteAttribute - (void)testSendClusterTestCluster_000090_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1835,9 +2066,11 @@ - (void)testSendClusterTestCluster_000090_ReadAttribute NSLog(@"Read attribute OCTET_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + NSString * octetStringArgumentString = @"TestValue"; NSData * octetStringArgument = [octetStringArgumentString dataUsingEncoding:NSUTF8StringEncoding]; XCTAssertTrue([values[@"value"] isEqualToData:octetStringArgument]); + [expectation fulfill]; }]; @@ -1846,6 +2079,7 @@ - (void)testSendClusterTestCluster_000090_ReadAttribute - (void)testSendClusterTestCluster_000091_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1866,6 +2100,7 @@ - (void)testSendClusterTestCluster_000091_WriteAttribute - (void)testSendClusterTestCluster_000092_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1875,9 +2110,11 @@ - (void)testSendClusterTestCluster_000092_ReadAttribute NSLog(@"Read attribute OCTET_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + NSString * octetStringArgumentString = @"TestValue"; NSData * octetStringArgument = [octetStringArgumentString dataUsingEncoding:NSUTF8StringEncoding]; XCTAssertTrue([values[@"value"] isEqualToData:octetStringArgument]); + [expectation fulfill]; }]; @@ -1886,6 +2123,7 @@ - (void)testSendClusterTestCluster_000092_ReadAttribute - (void)testSendClusterTestCluster_000093_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1898,6 +2136,7 @@ - (void)testSendClusterTestCluster_000093_WriteAttribute NSLog(@"Write attribute OCTET_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1906,6 +2145,7 @@ - (void)testSendClusterTestCluster_000093_WriteAttribute - (void)testSendClusterTestCluster_000094_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LONG_OCTET_STRING Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1915,9 +2155,11 @@ - (void)testSendClusterTestCluster_000094_ReadAttribute NSLog(@"Read attribute LONG_OCTET_STRING Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + NSString * longOctetStringArgumentString = @""; NSData * longOctetStringArgument = [longOctetStringArgumentString dataUsingEncoding:NSUTF8StringEncoding]; XCTAssertTrue([values[@"value"] isEqualToData:longOctetStringArgument]); + [expectation fulfill]; }]; @@ -1926,6 +2168,7 @@ - (void)testSendClusterTestCluster_000094_ReadAttribute - (void)testSendClusterTestCluster_000095_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute LONG_OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1941,6 +2184,7 @@ - (void)testSendClusterTestCluster_000095_WriteAttribute NSLog(@"Write attribute LONG_OCTET_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1949,6 +2193,7 @@ - (void)testSendClusterTestCluster_000095_WriteAttribute - (void)testSendClusterTestCluster_000096_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LONG_OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1958,12 +2203,14 @@ - (void)testSendClusterTestCluster_000096_ReadAttribute NSLog(@"Read attribute LONG_OCTET_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + NSString * longOctetStringArgumentString = @"1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" @"1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" @"1111111111111111111111111111111111111111111111111111111111111111111111"; NSData * longOctetStringArgument = [longOctetStringArgumentString dataUsingEncoding:NSUTF8StringEncoding]; XCTAssertTrue([values[@"value"] isEqualToData:longOctetStringArgument]); + [expectation fulfill]; }]; @@ -1972,6 +2219,7 @@ - (void)testSendClusterTestCluster_000096_ReadAttribute - (void)testSendClusterTestCluster_000097_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute LONG_OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -1984,6 +2232,7 @@ - (void)testSendClusterTestCluster_000097_WriteAttribute NSLog(@"Write attribute LONG_OCTET_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -1992,6 +2241,7 @@ - (void)testSendClusterTestCluster_000097_WriteAttribute - (void)testSendClusterTestCluster_000098_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute CHAR_STRING Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2001,8 +2251,10 @@ - (void)testSendClusterTestCluster_000098_ReadAttribute NSLog(@"Read attribute CHAR_STRING Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + NSString * charStringArgument = @""; XCTAssertTrue([values[@"value"] isEqualToString:charStringArgument]); + [expectation fulfill]; }]; @@ -2011,6 +2263,7 @@ - (void)testSendClusterTestCluster_000098_ReadAttribute - (void)testSendClusterTestCluster_000099_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2022,6 +2275,7 @@ - (void)testSendClusterTestCluster_000099_WriteAttribute NSLog(@"Write attribute CHAR_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2030,6 +2284,7 @@ - (void)testSendClusterTestCluster_000099_WriteAttribute - (void)testSendClusterTestCluster_000100_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING - Value too long"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2049,6 +2304,7 @@ - (void)testSendClusterTestCluster_000100_WriteAttribute - (void)testSendClusterTestCluster_000101_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute CHAR_STRING - Empty"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2060,6 +2316,7 @@ - (void)testSendClusterTestCluster_000101_WriteAttribute NSLog(@"Write attribute CHAR_STRING - Empty Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2068,6 +2325,7 @@ - (void)testSendClusterTestCluster_000101_WriteAttribute - (void)testSendClusterTestCluster_000102_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LONG_CHAR_STRING Default Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2077,8 +2335,10 @@ - (void)testSendClusterTestCluster_000102_ReadAttribute NSLog(@"Read attribute LONG_CHAR_STRING Default Value Error: %@", err); XCTAssertEqual(err.code, 0); + NSString * longCharStringArgument = @""; XCTAssertTrue([values[@"value"] isEqualToString:longCharStringArgument]); + [expectation fulfill]; }]; @@ -2087,6 +2347,7 @@ - (void)testSendClusterTestCluster_000102_ReadAttribute - (void)testSendClusterTestCluster_000103_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute LONG_CHAR_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2101,6 +2362,7 @@ - (void)testSendClusterTestCluster_000103_WriteAttribute NSLog(@"Write attribute LONG_CHAR_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2109,6 +2371,7 @@ - (void)testSendClusterTestCluster_000103_WriteAttribute - (void)testSendClusterTestCluster_000104_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LONG_CHAR_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2118,11 +2381,13 @@ - (void)testSendClusterTestCluster_000104_ReadAttribute NSLog(@"Read attribute LONG_CHAR_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + NSString * longCharStringArgument = @"☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" @"☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" @"☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉"; XCTAssertTrue([values[@"value"] isEqualToString:longCharStringArgument]); + [expectation fulfill]; }]; @@ -2131,6 +2396,7 @@ - (void)testSendClusterTestCluster_000104_ReadAttribute - (void)testSendClusterTestCluster_000105_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute LONG_CHAR_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2142,6 +2408,7 @@ - (void)testSendClusterTestCluster_000105_WriteAttribute NSLog(@"Write attribute LONG_CHAR_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2150,6 +2417,7 @@ - (void)testSendClusterTestCluster_000105_WriteAttribute - (void)testSendClusterTestCluster_000106_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LIST"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2159,7 +2427,9 @@ - (void)testSendClusterTestCluster_000106_ReadAttribute NSLog(@"Read attribute LIST Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] count], 4); + [expectation fulfill]; }]; @@ -2168,6 +2438,7 @@ - (void)testSendClusterTestCluster_000106_ReadAttribute - (void)testSendClusterTestCluster_000107_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LIST_OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2177,7 +2448,9 @@ - (void)testSendClusterTestCluster_000107_ReadAttribute NSLog(@"Read attribute LIST_OCTET_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] count], 4); + [expectation fulfill]; }]; @@ -2186,6 +2459,7 @@ - (void)testSendClusterTestCluster_000107_ReadAttribute - (void)testSendClusterTestCluster_000108_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute LIST_STRUCT_OCTET_STRING"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2195,7 +2469,9 @@ - (void)testSendClusterTestCluster_000108_ReadAttribute NSLog(@"Read attribute LIST_STRUCT_OCTET_STRING Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] count], 4); + [expectation fulfill]; }]; @@ -2204,6 +2480,7 @@ - (void)testSendClusterTestCluster_000108_ReadAttribute - (void)testSendClusterTestCluster_000109_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute UNSUPPORTED"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2218,7 +2495,9 @@ - (void)testSendClusterTestCluster_000109_ReadAttribute } XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -2227,6 +2506,7 @@ - (void)testSendClusterTestCluster_000109_ReadAttribute - (void)testSendClusterTestCluster_000110_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Writeattribute UNSUPPORTED"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2243,6 +2523,7 @@ - (void)testSendClusterTestCluster_000110_WriteAttribute } XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2251,6 +2532,7 @@ - (void)testSendClusterTestCluster_000110_WriteAttribute - (void)testSendClusterTestCluster_000111_Test { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Command to unsupported endpoint"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:200 queue:queue]; @@ -2269,6 +2551,7 @@ - (void)testSendClusterTestCluster_000111_Test - (void)testSendClusterTestConstraints_000000_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Write attribute INT32U Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2280,6 +2563,7 @@ - (void)testSendClusterTestConstraints_000000_WriteAttribute NSLog(@"Write attribute INT32U Value Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2288,6 +2572,7 @@ - (void)testSendClusterTestConstraints_000000_WriteAttribute - (void)testSendClusterTestConstraints_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Value MinValue Constraints"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2297,7 +2582,9 @@ - (void)testSendClusterTestConstraints_000001_ReadAttribute NSLog(@"Read attribute INT32U Value MinValue Constraints Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertGreaterThanOrEqual([values[@"value"] unsignedLongValue], 5); + [expectation fulfill]; }]; @@ -2306,6 +2593,7 @@ - (void)testSendClusterTestConstraints_000001_ReadAttribute - (void)testSendClusterTestConstraints_000002_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Value MaxValue Constraints"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2315,7 +2603,9 @@ - (void)testSendClusterTestConstraints_000002_ReadAttribute NSLog(@"Read attribute INT32U Value MaxValue Constraints Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertLessThanOrEqual([values[@"value"] unsignedLongValue], 5); + [expectation fulfill]; }]; @@ -2324,6 +2614,7 @@ - (void)testSendClusterTestConstraints_000002_ReadAttribute - (void)testSendClusterTestConstraints_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Value NotValue Constraints"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2333,7 +2624,9 @@ - (void)testSendClusterTestConstraints_000003_ReadAttribute NSLog(@"Read attribute INT32U Value NotValue Constraints Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertNotEqual([values[@"value"] unsignedLongValue], 6); + [expectation fulfill]; }]; @@ -2343,6 +2636,7 @@ - (void)testSendClusterTestConstraints_000003_ReadAttribute - (void)testSendClusterTestDelayCommands_000000_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + dispatch_queue_t queue = dispatch_get_main_queue(); WaitForMs(expectation, queue, 100); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; @@ -2351,6 +2645,7 @@ - (void)testSendClusterTestDelayCommands_000000_WaitForMs - (void)testSendClusterTestSubscribe_OnOff_000000_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Set OnOff Attribute to false"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2360,26 +2655,39 @@ - (void)testSendClusterTestSubscribe_OnOff_000000_Off NSLog(@"Set OnOff Attribute to false Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestSubscribe_OnOff_000001_SubscribeAttribute +bool testSendClusterTestSubscribe_OnOff_000001_WaitForReport_Fulfilled = false; +- (void)testSendClusterTestSubscribe_OnOff_000001_WaitForReport { - XCTestExpectation * expectation = [self expectationWithDescription:@"Subscribe OnOff Attribute"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __block bool initialReportReceived = false; [cluster reportAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reporting Test Report: %@", err); + NSLog(@"Report: Subscribe OnOff Attribute Error: %@", err); + XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], false); - initialReportReceived = true; + + testSendClusterTestSubscribe_OnOff_000001_WaitForReport_Fulfilled = true; }]; +} +- (void)testSendClusterTestSubscribe_OnOff_000002_SubscribeAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Subscribe OnOff Attribute"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); [cluster configureAttributeOnOffWithMinInterval:2 maxInterval:10 @@ -2387,15 +2695,16 @@ - (void)testSendClusterTestSubscribe_OnOff_000001_SubscribeAttribute NSLog(@"Subscribe OnOff Attribute Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual(initialReportReceived, true); + XCTAssertEqual(testSendClusterTestSubscribe_OnOff_000001_WaitForReport_Fulfilled, true); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestSubscribe_OnOff_000002_On +- (void)testSendClusterTestSubscribe_OnOff_000003_On { XCTestExpectation * expectation = [self expectationWithDescription:@"Turn On the light to see attribute change"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2405,32 +2714,78 @@ - (void)testSendClusterTestSubscribe_OnOff_000002_On NSLog(@"Turn On the light to see attribute change Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestSubscribe_OnOff_000003_WaitForAttributeReport +- (void)testSendClusterTestSubscribe_OnOff_000004_WaitForReport { XCTestExpectation * expectation = [self expectationWithDescription:@"Check for attribute report"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); [cluster reportAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reporting Test Report: %@", err); + NSLog(@"Check for attribute report Error: %@", err); + XCTAssertEqual(err.code, 0); XCTAssertEqual([values[@"value"] boolValue], true); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestSubscribe_OnOff_000005_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Turn Off the light to see attribute change"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Turn Off the light to see attribute change Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestSubscribe_OnOff_000006_WaitForReport +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Check for attribute report"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster reportAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check for attribute report Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], false); + [expectation fulfill]; }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_OO_1_1_000000_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2440,7 +2795,9 @@ - (void)testSendClusterTest_TC_OO_1_1_000000_ReadAttribute NSLog(@"read the global attribute: ClusterRevision Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 3); + [expectation fulfill]; }]; @@ -2449,6 +2806,7 @@ - (void)testSendClusterTest_TC_OO_1_1_000000_ReadAttribute - (void)testSendClusterTest_TC_OO_1_1_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2458,7 +2816,9 @@ - (void)testSendClusterTest_TC_OO_1_1_000001_ReadAttribute NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 3); + [expectation fulfill]; }]; @@ -2467,6 +2827,7 @@ - (void)testSendClusterTest_TC_OO_1_1_000001_ReadAttribute - (void)testSendClusterTest_TC_OO_1_1_000002_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional global attribute: FeatureMap"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2476,7 +2837,9 @@ - (void)testSendClusterTest_TC_OO_1_1_000002_ReadAttribute NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongValue], 0); + [expectation fulfill]; }]; @@ -2485,6 +2848,7 @@ - (void)testSendClusterTest_TC_OO_1_1_000002_ReadAttribute - (void)testSendClusterTest_TC_OO_1_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back optional global attribute: FeatureMap"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2494,7 +2858,9 @@ - (void)testSendClusterTest_TC_OO_1_1_000003_ReadAttribute NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedLongValue], 0); + [expectation fulfill]; }]; @@ -2504,6 +2870,7 @@ - (void)testSendClusterTest_TC_OO_1_1_000003_ReadAttribute - (void)testSendClusterTest_TC_OO_2_1_000000_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: OnOff"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2513,7 +2880,9 @@ - (void)testSendClusterTest_TC_OO_2_1_000000_ReadAttribute NSLog(@"read the mandatory attribute: OnOff Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -2522,6 +2891,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000000_ReadAttribute - (void)testSendClusterTest_TC_OO_2_1_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back mandatory attribute: OnOff"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2531,7 +2901,9 @@ - (void)testSendClusterTest_TC_OO_2_1_000001_ReadAttribute NSLog(@"reads back mandatory attribute: OnOff Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -2540,6 +2912,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000001_ReadAttribute - (void)testSendClusterTest_TC_OO_2_1_000002_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: GlobalSceneControl"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2549,7 +2922,9 @@ - (void)testSendClusterTest_TC_OO_2_1_000002_ReadAttribute NSLog(@"read LT attribute: GlobalSceneControl Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 1); + [expectation fulfill]; }]; @@ -2558,6 +2933,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000002_ReadAttribute - (void)testSendClusterTest_TC_OO_2_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OnTime"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2567,7 +2943,9 @@ - (void)testSendClusterTest_TC_OO_2_1_000003_ReadAttribute NSLog(@"read LT attribute: OnTime Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0); + [expectation fulfill]; }]; @@ -2576,6 +2954,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000003_ReadAttribute - (void)testSendClusterTest_TC_OO_2_1_000004_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OffWaitTime"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2585,7 +2964,9 @@ - (void)testSendClusterTest_TC_OO_2_1_000004_ReadAttribute NSLog(@"read LT attribute: OffWaitTime Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0); + [expectation fulfill]; }]; @@ -2594,6 +2975,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000004_ReadAttribute - (void)testSendClusterTest_TC_OO_2_1_000005_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: StartUpOnOff"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2603,7 +2985,9 @@ - (void)testSendClusterTest_TC_OO_2_1_000005_ReadAttribute NSLog(@"read LT attribute: StartUpOnOff Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -2612,6 +2996,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000005_ReadAttribute - (void)testSendClusterTest_TC_OO_2_1_000006_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: OnTime"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2623,6 +3008,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000006_WriteAttribute NSLog(@"write the default value to LT attribute: OnTime Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2631,6 +3017,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000006_WriteAttribute - (void)testSendClusterTest_TC_OO_2_1_000007_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: OffWaitTime"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2642,6 +3029,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000007_WriteAttribute NSLog(@"write the default value to LT attribute: OffWaitTime Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2650,6 +3038,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000007_WriteAttribute - (void)testSendClusterTest_TC_OO_2_1_000008_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: StartUpOnOff"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2661,6 +3050,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000008_WriteAttribute NSLog(@"write the default value to LT attribute: StartUpOnOff Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2669,6 +3059,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000008_WriteAttribute - (void)testSendClusterTest_TC_OO_2_1_000009_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: OnTime"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2678,7 +3069,9 @@ - (void)testSendClusterTest_TC_OO_2_1_000009_ReadAttribute NSLog(@"reads back LT attribute: OnTime Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0); + [expectation fulfill]; }]; @@ -2687,6 +3080,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000009_ReadAttribute - (void)testSendClusterTest_TC_OO_2_1_000010_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: OffWaitTime"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2696,7 +3090,9 @@ - (void)testSendClusterTest_TC_OO_2_1_000010_ReadAttribute NSLog(@"reads back LT attribute: OffWaitTime Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0); + [expectation fulfill]; }]; @@ -2705,6 +3101,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000010_ReadAttribute - (void)testSendClusterTest_TC_OO_2_1_000011_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: StartUpOnOff"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2714,7 +3111,9 @@ - (void)testSendClusterTest_TC_OO_2_1_000011_ReadAttribute NSLog(@"reads back LT attribute: StartUpOnOff Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -2724,6 +3123,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000011_ReadAttribute - (void)testSendClusterTest_TC_OO_2_2_000000_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2733,6 +3133,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000000_Off NSLog(@"Send Off Command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2741,6 +3142,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000000_Off - (void)testSendClusterTest_TC_OO_2_2_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2750,7 +3152,9 @@ - (void)testSendClusterTest_TC_OO_2_2_000001_ReadAttribute NSLog(@"Check on/off attribute value is false after off command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -2759,6 +3163,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000001_ReadAttribute - (void)testSendClusterTest_TC_OO_2_2_000002_On { XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2768,6 +3173,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000002_On NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2776,6 +3182,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000002_On - (void)testSendClusterTest_TC_OO_2_2_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2785,7 +3192,9 @@ - (void)testSendClusterTest_TC_OO_2_2_000003_ReadAttribute NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 1); + [expectation fulfill]; }]; @@ -2794,6 +3203,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000003_ReadAttribute - (void)testSendClusterTest_TC_OO_2_2_000004_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2803,6 +3213,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000004_Off NSLog(@"Send Off Command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2811,6 +3222,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000004_Off - (void)testSendClusterTest_TC_OO_2_2_000005_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2820,7 +3232,9 @@ - (void)testSendClusterTest_TC_OO_2_2_000005_ReadAttribute NSLog(@"Check on/off attribute value is false after off command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -2829,6 +3243,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000005_ReadAttribute - (void)testSendClusterTest_TC_OO_2_2_000006_Toggle { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2838,6 +3253,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000006_Toggle NSLog(@"Send Toggle Command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2847,6 +3263,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000007_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after toggle command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2856,7 +3273,9 @@ - (void)testSendClusterTest_TC_OO_2_2_000007_ReadAttribute NSLog(@"Check on/off attribute value is true after toggle command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 1); + [expectation fulfill]; }]; @@ -2865,6 +3284,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000007_ReadAttribute - (void)testSendClusterTest_TC_OO_2_2_000008_Toggle { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2874,6 +3294,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000008_Toggle NSLog(@"Send Toggle Command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2883,6 +3304,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000009_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after toggle command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2892,7 +3314,9 @@ - (void)testSendClusterTest_TC_OO_2_2_000009_ReadAttribute NSLog(@"Check on/off attribute value is false after toggle command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -2901,6 +3325,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000009_ReadAttribute - (void)testSendClusterTest_TC_OO_2_2_000010_On { XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2910,6 +3335,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000010_On NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2918,6 +3344,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000010_On - (void)testSendClusterTest_TC_OO_2_2_000011_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2927,7 +3354,9 @@ - (void)testSendClusterTest_TC_OO_2_2_000011_ReadAttribute NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 1); + [expectation fulfill]; }]; @@ -2936,6 +3365,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000011_ReadAttribute - (void)testSendClusterTest_TC_OO_2_2_000012_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2945,6 +3375,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000012_Off NSLog(@"Send Off Command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2953,6 +3384,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000012_Off - (void)testSendClusterTest_TC_OO_2_2_000013_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -2962,7 +3394,9 @@ - (void)testSendClusterTest_TC_OO_2_2_000013_ReadAttribute NSLog(@"Check on/off attribute value is false after off command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -2972,6 +3406,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000013_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000000_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query Interaction Model Version"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -2981,6 +3416,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000000_ReadAttribute NSLog(@"Query Interaction Model Version Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -2989,6 +3425,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000000_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query Vendor Name"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -2998,7 +3435,9 @@ - (void)testSendClusterTest_TC_DM_1_1_000001_ReadAttribute NSLog(@"Query Vendor Name Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertLessThanOrEqual([values[@"value"] length], 32); + [expectation fulfill]; }]; @@ -3007,6 +3446,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000001_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000002_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query VendorID"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3016,6 +3456,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000002_ReadAttribute NSLog(@"Query VendorID Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3024,6 +3465,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000002_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query Product Name"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3033,7 +3475,9 @@ - (void)testSendClusterTest_TC_DM_1_1_000003_ReadAttribute NSLog(@"Query Product Name Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertLessThanOrEqual([values[@"value"] length], 32); + [expectation fulfill]; }]; @@ -3042,6 +3486,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000003_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000004_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductID"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3051,6 +3496,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000004_ReadAttribute NSLog(@"Query ProductID Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3059,6 +3505,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000004_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000005_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query User Label"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3068,7 +3515,9 @@ - (void)testSendClusterTest_TC_DM_1_1_000005_ReadAttribute NSLog(@"Query User Label Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertLessThanOrEqual([values[@"value"] length], 32); + [expectation fulfill]; }]; @@ -3077,6 +3526,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000005_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000006_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query User Location"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3086,7 +3536,9 @@ - (void)testSendClusterTest_TC_DM_1_1_000006_ReadAttribute NSLog(@"Query User Location Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertLessThanOrEqual([values[@"value"] length], 2); + [expectation fulfill]; }]; @@ -3095,6 +3547,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000006_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000007_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersion"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3104,6 +3557,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000007_ReadAttribute NSLog(@"Query HardwareVersion Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3112,6 +3566,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000007_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000008_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersionString"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3121,8 +3576,10 @@ - (void)testSendClusterTest_TC_DM_1_1_000008_ReadAttribute NSLog(@"Query HardwareVersionString Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertGreaterThanOrEqual([values[@"value"] length], 1); XCTAssertLessThanOrEqual([values[@"value"] length], 64); + [expectation fulfill]; }]; @@ -3131,6 +3588,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000008_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000009_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersion"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3140,6 +3598,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000009_ReadAttribute NSLog(@"Query SoftwareVersion Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3148,6 +3607,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000009_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000010_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersionString"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3157,8 +3617,10 @@ - (void)testSendClusterTest_TC_DM_1_1_000010_ReadAttribute NSLog(@"Query SoftwareVersionString Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertGreaterThanOrEqual([values[@"value"] length], 1); XCTAssertLessThanOrEqual([values[@"value"] length], 64); + [expectation fulfill]; }]; @@ -3167,6 +3629,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000010_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000011_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query ManufacturingDate"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3181,8 +3644,10 @@ - (void)testSendClusterTest_TC_DM_1_1_000011_ReadAttribute } XCTAssertEqual(err.code, 0); + XCTAssertGreaterThanOrEqual([values[@"value"] length], 8); XCTAssertLessThanOrEqual([values[@"value"] length], 16); + [expectation fulfill]; }]; @@ -3191,6 +3656,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000011_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000012_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query PartNumber"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3205,7 +3671,9 @@ - (void)testSendClusterTest_TC_DM_1_1_000012_ReadAttribute } XCTAssertEqual(err.code, 0); + XCTAssertLessThanOrEqual([values[@"value"] length], 32); + [expectation fulfill]; }]; @@ -3214,6 +3682,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000012_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000013_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductURL"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3228,7 +3697,9 @@ - (void)testSendClusterTest_TC_DM_1_1_000013_ReadAttribute } XCTAssertEqual(err.code, 0); + XCTAssertLessThanOrEqual([values[@"value"] length], 256); + [expectation fulfill]; }]; @@ -3237,6 +3708,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000013_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000014_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductLabel"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3251,7 +3723,9 @@ - (void)testSendClusterTest_TC_DM_1_1_000014_ReadAttribute } XCTAssertEqual(err.code, 0); + XCTAssertLessThanOrEqual([values[@"value"] length], 64); + [expectation fulfill]; }]; @@ -3260,6 +3734,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000014_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000015_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query SerialNumber"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3274,7 +3749,9 @@ - (void)testSendClusterTest_TC_DM_1_1_000015_ReadAttribute } XCTAssertEqual(err.code, 0); + XCTAssertLessThanOrEqual([values[@"value"] length], 32); + [expectation fulfill]; }]; @@ -3283,6 +3760,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000015_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000016_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query LocalConfigDisabled"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3297,6 +3775,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000016_ReadAttribute } XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3305,6 +3784,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000016_ReadAttribute - (void)testSendClusterTest_TC_DM_1_1_000017_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Query Reachable"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBasic * cluster = [[CHIPBasic alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -3319,6 +3799,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000017_ReadAttribute } XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3328,6 +3809,7 @@ - (void)testSendClusterTest_TC_DM_1_1_000017_ReadAttribute - (void)testSendClusterTest_TC_CC_3_4_000000_On { XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3337,6 +3819,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000000_On NSLog(@"Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3345,6 +3828,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000000_On - (void)testSendClusterTest_TC_CC_3_4_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3354,7 +3838,9 @@ - (void)testSendClusterTest_TC_CC_3_4_000001_ReadAttribute NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 1); + [expectation fulfill]; }]; @@ -3363,6 +3849,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000001_ReadAttribute - (void)testSendClusterTest_TC_CC_3_4_000002_MoveToHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Move to hue shortest distance command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3382,6 +3869,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000002_MoveToHue NSLog(@"Move to hue shortest distance command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3390,6 +3878,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000002_MoveToHue - (void)testSendClusterTest_TC_CC_3_4_000003_MoveToHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Move to hue longest distance command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3409,6 +3898,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000003_MoveToHue NSLog(@"Move to hue longest distance command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3417,6 +3907,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000003_MoveToHue - (void)testSendClusterTest_TC_CC_3_4_000004_MoveToHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Move to hue up command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3436,6 +3927,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000004_MoveToHue NSLog(@"Move to hue up command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3444,6 +3936,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000004_MoveToHue - (void)testSendClusterTest_TC_CC_3_4_000005_MoveToHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Move to hue down command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3463,6 +3956,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000005_MoveToHue NSLog(@"Move to hue down command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3471,6 +3965,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000005_MoveToHue - (void)testSendClusterTest_TC_CC_3_4_000006_MoveHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Move hue up command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3488,6 +3983,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000006_MoveHue NSLog(@"Move hue up command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3496,6 +3992,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000006_MoveHue - (void)testSendClusterTest_TC_CC_3_4_000007_MoveHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Move hue stop command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3513,6 +4010,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000007_MoveHue NSLog(@"Move hue stop command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3521,6 +4019,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000007_MoveHue - (void)testSendClusterTest_TC_CC_3_4_000008_MoveHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Move hue down command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3538,6 +4037,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000008_MoveHue NSLog(@"Move hue down command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3546,6 +4046,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000008_MoveHue - (void)testSendClusterTest_TC_CC_3_4_000009_MoveHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Move hue stop command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3563,6 +4064,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000009_MoveHue NSLog(@"Move hue stop command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3571,6 +4073,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000009_MoveHue - (void)testSendClusterTest_TC_CC_3_4_000010_StepHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Step hue up command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3590,6 +4093,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000010_StepHue NSLog(@"Step hue up command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3598,6 +4102,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000010_StepHue - (void)testSendClusterTest_TC_CC_3_4_000011_StepHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Step hue down command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3617,6 +4122,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000011_StepHue NSLog(@"Step hue down command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3625,6 +4131,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000011_StepHue - (void)testSendClusterTest_TC_CC_3_4_000012_MoveToSaturation { XCTestExpectation * expectation = [self expectationWithDescription:@"Move to saturation command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3642,6 +4149,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000012_MoveToSaturation NSLog(@"Move to saturation command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3650,6 +4158,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000012_MoveToSaturation - (void)testSendClusterTest_TC_CC_3_4_000013_MoveSaturation { XCTestExpectation * expectation = [self expectationWithDescription:@"Move saturation up command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3667,6 +4176,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000013_MoveSaturation NSLog(@"Move saturation up command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3675,6 +4185,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000013_MoveSaturation - (void)testSendClusterTest_TC_CC_3_4_000014_MoveSaturation { XCTestExpectation * expectation = [self expectationWithDescription:@"Move saturation down command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3692,6 +4203,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000014_MoveSaturation NSLog(@"Move saturation down command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3700,6 +4212,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000014_MoveSaturation - (void)testSendClusterTest_TC_CC_3_4_000015_StepSaturation { XCTestExpectation * expectation = [self expectationWithDescription:@"Step saturation up command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3719,6 +4232,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000015_StepSaturation NSLog(@"Step saturation up command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3727,6 +4241,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000015_StepSaturation - (void)testSendClusterTest_TC_CC_3_4_000016_StepSaturation { XCTestExpectation * expectation = [self expectationWithDescription:@"Step saturation down command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3746,6 +4261,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000016_StepSaturation NSLog(@"Step saturation down command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3754,6 +4270,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000016_StepSaturation - (void)testSendClusterTest_TC_CC_3_4_000017_MoveToHueAndSaturation { XCTestExpectation * expectation = [self expectationWithDescription:@"Move To current hue and saturation command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3773,6 +4290,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000017_MoveToHueAndSaturation NSLog(@"Move To current hue and saturation command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3781,6 +4299,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000017_MoveToHueAndSaturation - (void)testSendClusterTest_TC_CC_3_4_000018_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3790,6 +4309,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000018_Off NSLog(@"Turn off light that we turned on Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3798,6 +4318,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000018_Off - (void)testSendClusterTest_TC_CC_3_4_000019_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3807,7 +4328,9 @@ - (void)testSendClusterTest_TC_CC_3_4_000019_ReadAttribute NSLog(@"Check on/off attribute value is false after off command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -3817,6 +4340,7 @@ - (void)testSendClusterTest_TC_CC_3_4_000019_ReadAttribute - (void)testSendClusterTest_TC_CC_5_000000_On { XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3826,6 +4350,7 @@ - (void)testSendClusterTest_TC_CC_5_000000_On NSLog(@"Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3834,6 +4359,7 @@ - (void)testSendClusterTest_TC_CC_5_000000_On - (void)testSendClusterTest_TC_CC_5_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3843,7 +4369,9 @@ - (void)testSendClusterTest_TC_CC_5_000001_ReadAttribute NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 1); + [expectation fulfill]; }]; @@ -3852,6 +4380,7 @@ - (void)testSendClusterTest_TC_CC_5_000001_ReadAttribute - (void)testSendClusterTest_TC_CC_5_000002_MoveToColor { XCTestExpectation * expectation = [self expectationWithDescription:@"Move to Color command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3871,6 +4400,7 @@ - (void)testSendClusterTest_TC_CC_5_000002_MoveToColor NSLog(@"Move to Color command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3879,6 +4409,7 @@ - (void)testSendClusterTest_TC_CC_5_000002_MoveToColor - (void)testSendClusterTest_TC_CC_5_000003_MoveColor { XCTestExpectation * expectation = [self expectationWithDescription:@"Move Color command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3896,6 +4427,7 @@ - (void)testSendClusterTest_TC_CC_5_000003_MoveColor NSLog(@"Move Color command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3904,6 +4436,7 @@ - (void)testSendClusterTest_TC_CC_5_000003_MoveColor - (void)testSendClusterTest_TC_CC_5_000004_StopMoveStep { XCTestExpectation * expectation = [self expectationWithDescription:@"Stop Move Step command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3917,6 +4450,7 @@ - (void)testSendClusterTest_TC_CC_5_000004_StopMoveStep NSLog(@"Stop Move Step command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3925,6 +4459,7 @@ - (void)testSendClusterTest_TC_CC_5_000004_StopMoveStep - (void)testSendClusterTest_TC_CC_5_000005_StepColor { XCTestExpectation * expectation = [self expectationWithDescription:@"Step Color command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3944,6 +4479,7 @@ - (void)testSendClusterTest_TC_CC_5_000005_StepColor NSLog(@"Step Color command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3952,6 +4488,7 @@ - (void)testSendClusterTest_TC_CC_5_000005_StepColor - (void)testSendClusterTest_TC_CC_5_000006_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3961,6 +4498,7 @@ - (void)testSendClusterTest_TC_CC_5_000006_Off NSLog(@"Turn off light that we turned on Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -3969,6 +4507,7 @@ - (void)testSendClusterTest_TC_CC_5_000006_Off - (void)testSendClusterTest_TC_CC_5_000007_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3978,7 +4517,9 @@ - (void)testSendClusterTest_TC_CC_5_000007_ReadAttribute NSLog(@"Check on/off attribute value is false after off command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -3988,6 +4529,7 @@ - (void)testSendClusterTest_TC_CC_5_000007_ReadAttribute - (void)testSendClusterTest_TC_CC_6_000000_On { XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -3997,6 +4539,7 @@ - (void)testSendClusterTest_TC_CC_6_000000_On NSLog(@"Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4005,6 +4548,7 @@ - (void)testSendClusterTest_TC_CC_6_000000_On - (void)testSendClusterTest_TC_CC_6_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4014,7 +4558,9 @@ - (void)testSendClusterTest_TC_CC_6_000001_ReadAttribute NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 1); + [expectation fulfill]; }]; @@ -4023,6 +4569,7 @@ - (void)testSendClusterTest_TC_CC_6_000001_ReadAttribute - (void)testSendClusterTest_TC_CC_6_000002_MoveToColorTemperature { XCTestExpectation * expectation = [self expectationWithDescription:@"Move To Color Temperature command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4040,6 +4587,7 @@ - (void)testSendClusterTest_TC_CC_6_000002_MoveToColorTemperature NSLog(@"Move To Color Temperature command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4048,6 +4596,7 @@ - (void)testSendClusterTest_TC_CC_6_000002_MoveToColorTemperature - (void)testSendClusterTest_TC_CC_6_000003_MoveColorTemperature { XCTestExpectation * expectation = [self expectationWithDescription:@"Move up color temperature command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4069,6 +4618,7 @@ - (void)testSendClusterTest_TC_CC_6_000003_MoveColorTemperature NSLog(@"Move up color temperature command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4077,6 +4627,7 @@ - (void)testSendClusterTest_TC_CC_6_000003_MoveColorTemperature - (void)testSendClusterTest_TC_CC_6_000004_MoveColorTemperature { XCTestExpectation * expectation = [self expectationWithDescription:@"Stop Color Temperature command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4098,6 +4649,7 @@ - (void)testSendClusterTest_TC_CC_6_000004_MoveColorTemperature NSLog(@"Stop Color Temperature command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4106,6 +4658,7 @@ - (void)testSendClusterTest_TC_CC_6_000004_MoveColorTemperature - (void)testSendClusterTest_TC_CC_6_000005_MoveColorTemperature { XCTestExpectation * expectation = [self expectationWithDescription:@"Move down color temperature command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4127,6 +4680,7 @@ - (void)testSendClusterTest_TC_CC_6_000005_MoveColorTemperature NSLog(@"Move down color temperature command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4135,6 +4689,7 @@ - (void)testSendClusterTest_TC_CC_6_000005_MoveColorTemperature - (void)testSendClusterTest_TC_CC_6_000006_StepColorTemperature { XCTestExpectation * expectation = [self expectationWithDescription:@"Step up color temperature command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4158,6 +4713,7 @@ - (void)testSendClusterTest_TC_CC_6_000006_StepColorTemperature NSLog(@"Step up color temperature command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4166,6 +4722,7 @@ - (void)testSendClusterTest_TC_CC_6_000006_StepColorTemperature - (void)testSendClusterTest_TC_CC_6_000007_StepColorTemperature { XCTestExpectation * expectation = [self expectationWithDescription:@"Step down color temperature command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4189,6 +4746,7 @@ - (void)testSendClusterTest_TC_CC_6_000007_StepColorTemperature NSLog(@"Step down color temperature command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4197,6 +4755,7 @@ - (void)testSendClusterTest_TC_CC_6_000007_StepColorTemperature - (void)testSendClusterTest_TC_CC_6_000008_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4206,6 +4765,7 @@ - (void)testSendClusterTest_TC_CC_6_000008_Off NSLog(@"Turn off light that we turned on Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4214,6 +4774,7 @@ - (void)testSendClusterTest_TC_CC_6_000008_Off - (void)testSendClusterTest_TC_CC_6_000009_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4223,7 +4784,9 @@ - (void)testSendClusterTest_TC_CC_6_000009_ReadAttribute NSLog(@"Check on/off attribute value is false after off command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -4233,6 +4796,7 @@ - (void)testSendClusterTest_TC_CC_6_000009_ReadAttribute - (void)testSendClusterTest_TC_CC_7_000000_On { XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4242,6 +4806,7 @@ - (void)testSendClusterTest_TC_CC_7_000000_On NSLog(@"Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4250,6 +4815,7 @@ - (void)testSendClusterTest_TC_CC_7_000000_On - (void)testSendClusterTest_TC_CC_7_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4259,7 +4825,9 @@ - (void)testSendClusterTest_TC_CC_7_000001_ReadAttribute NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 1); + [expectation fulfill]; }]; @@ -4268,6 +4836,7 @@ - (void)testSendClusterTest_TC_CC_7_000001_ReadAttribute - (void)testSendClusterTest_TC_CC_7_000002_EnhancedMoveToHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move To Hue command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4287,6 +4856,7 @@ - (void)testSendClusterTest_TC_CC_7_000002_EnhancedMoveToHue NSLog(@"Enhanced Move To Hue command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4296,6 +4866,7 @@ - (void)testSendClusterTest_TC_CC_7_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check Remaining time attribute value matched the value sent by the last command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4305,7 +4876,9 @@ - (void)testSendClusterTest_TC_CC_7_000003_ReadAttribute NSLog(@"Check Remaining time attribute value matched the value sent by the last command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 1); + [expectation fulfill]; }]; @@ -4314,6 +4887,7 @@ - (void)testSendClusterTest_TC_CC_7_000003_ReadAttribute - (void)testSendClusterTest_TC_CC_7_000004_EnhancedMoveHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move Hue Down command "]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4331,6 +4905,7 @@ - (void)testSendClusterTest_TC_CC_7_000004_EnhancedMoveHue NSLog(@"Enhanced Move Hue Down command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4339,6 +4914,7 @@ - (void)testSendClusterTest_TC_CC_7_000004_EnhancedMoveHue - (void)testSendClusterTest_TC_CC_7_000005_EnhancedMoveHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move Hue Stop command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4356,6 +4932,7 @@ - (void)testSendClusterTest_TC_CC_7_000005_EnhancedMoveHue NSLog(@"Enhanced Move Hue Stop command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4364,6 +4941,7 @@ - (void)testSendClusterTest_TC_CC_7_000005_EnhancedMoveHue - (void)testSendClusterTest_TC_CC_7_000006_EnhancedMoveHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move Hue Up command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4381,6 +4959,7 @@ - (void)testSendClusterTest_TC_CC_7_000006_EnhancedMoveHue NSLog(@"Enhanced Move Hue Up command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4389,6 +4968,7 @@ - (void)testSendClusterTest_TC_CC_7_000006_EnhancedMoveHue - (void)testSendClusterTest_TC_CC_7_000007_EnhancedMoveHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move Hue Stop command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4406,6 +4986,7 @@ - (void)testSendClusterTest_TC_CC_7_000007_EnhancedMoveHue NSLog(@"Enhanced Move Hue Stop command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4414,6 +4995,7 @@ - (void)testSendClusterTest_TC_CC_7_000007_EnhancedMoveHue - (void)testSendClusterTest_TC_CC_7_000008_EnhancedStepHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Step Hue Up command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4433,6 +5015,7 @@ - (void)testSendClusterTest_TC_CC_7_000008_EnhancedStepHue NSLog(@"Enhanced Step Hue Up command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4441,6 +5024,7 @@ - (void)testSendClusterTest_TC_CC_7_000008_EnhancedStepHue - (void)testSendClusterTest_TC_CC_7_000009_EnhancedStepHue { XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Step Hue Down command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4460,6 +5044,7 @@ - (void)testSendClusterTest_TC_CC_7_000009_EnhancedStepHue NSLog(@"Enhanced Step Hue Down command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4468,6 +5053,7 @@ - (void)testSendClusterTest_TC_CC_7_000009_EnhancedStepHue - (void)testSendClusterTest_TC_CC_7_000010_EnhancedMoveToHueAndSaturation { XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced move to hue and saturation command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4487,6 +5073,7 @@ - (void)testSendClusterTest_TC_CC_7_000010_EnhancedMoveToHueAndSaturation NSLog(@"Enhanced move to hue and saturation command Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4495,6 +5082,7 @@ - (void)testSendClusterTest_TC_CC_7_000010_EnhancedMoveToHueAndSaturation - (void)testSendClusterTest_TC_CC_7_000011_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4504,6 +5092,7 @@ - (void)testSendClusterTest_TC_CC_7_000011_Off NSLog(@"Turn off light that we turned on Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4512,6 +5101,7 @@ - (void)testSendClusterTest_TC_CC_7_000011_Off - (void)testSendClusterTest_TC_CC_7_000012_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4521,7 +5111,9 @@ - (void)testSendClusterTest_TC_CC_7_000012_ReadAttribute NSLog(@"Check on/off attribute value is false after off command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -4531,6 +5123,7 @@ - (void)testSendClusterTest_TC_CC_7_000012_ReadAttribute - (void)testSendClusterTest_TC_CC_8_000000_On { XCTestExpectation * expectation = [self expectationWithDescription:@"Turn on light for color control tests"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4540,6 +5133,7 @@ - (void)testSendClusterTest_TC_CC_8_000000_On NSLog(@"Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4548,6 +5142,7 @@ - (void)testSendClusterTest_TC_CC_8_000000_On - (void)testSendClusterTest_TC_CC_8_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4557,7 +5152,9 @@ - (void)testSendClusterTest_TC_CC_8_000001_ReadAttribute NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 1); + [expectation fulfill]; }]; @@ -4566,6 +5163,7 @@ - (void)testSendClusterTest_TC_CC_8_000001_ReadAttribute - (void)testSendClusterTest_TC_CC_8_000002_ColorLoopSet { XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributs"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4589,6 +5187,7 @@ - (void)testSendClusterTest_TC_CC_8_000002_ColorLoopSet NSLog(@"Color Loop Set Command - Set all Attributs Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4597,6 +5196,7 @@ - (void)testSendClusterTest_TC_CC_8_000002_ColorLoopSet - (void)testSendClusterTest_TC_CC_8_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopDirection Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4606,7 +5206,9 @@ - (void)testSendClusterTest_TC_CC_8_000003_ReadAttribute NSLog(@"Check ColorLoopDirection Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + [expectation fulfill]; }]; @@ -4615,6 +5217,7 @@ - (void)testSendClusterTest_TC_CC_8_000003_ReadAttribute - (void)testSendClusterTest_TC_CC_8_000004_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopTime Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4624,7 +5227,9 @@ - (void)testSendClusterTest_TC_CC_8_000004_ReadAttribute NSLog(@"Check ColorLoopTime Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 100); + [expectation fulfill]; }]; @@ -4633,6 +5238,7 @@ - (void)testSendClusterTest_TC_CC_8_000004_ReadAttribute - (void)testSendClusterTest_TC_CC_8_000005_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopStartEnhancedHue Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4642,7 +5248,9 @@ - (void)testSendClusterTest_TC_CC_8_000005_ReadAttribute NSLog(@"Check ColorLoopStartEnhancedHue Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 500); + [expectation fulfill]; }]; @@ -4651,6 +5259,7 @@ - (void)testSendClusterTest_TC_CC_8_000005_ReadAttribute - (void)testSendClusterTest_TC_CC_8_000006_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopActive Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4660,7 +5269,9 @@ - (void)testSendClusterTest_TC_CC_8_000006_ReadAttribute NSLog(@"Check ColorLoopActive Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -4669,6 +5280,7 @@ - (void)testSendClusterTest_TC_CC_8_000006_ReadAttribute - (void)testSendClusterTest_TC_CC_8_000007_ColorLoopSet { XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4692,6 +5304,7 @@ - (void)testSendClusterTest_TC_CC_8_000007_ColorLoopSet NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4700,6 +5313,7 @@ - (void)testSendClusterTest_TC_CC_8_000007_ColorLoopSet - (void)testSendClusterTest_TC_CC_8_000008_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopActive Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4709,7 +5323,9 @@ - (void)testSendClusterTest_TC_CC_8_000008_ReadAttribute NSLog(@"Check ColorLoopActive Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + [expectation fulfill]; }]; @@ -4719,6 +5335,7 @@ - (void)testSendClusterTest_TC_CC_8_000009_ColorLoopSet { XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set direction and time while running"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4742,6 +5359,7 @@ - (void)testSendClusterTest_TC_CC_8_000009_ColorLoopSet NSLog(@"Color Loop Set Command - Set direction and time while running Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4750,6 +5368,7 @@ - (void)testSendClusterTest_TC_CC_8_000009_ColorLoopSet - (void)testSendClusterTest_TC_CC_8_000010_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopDirection Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4759,7 +5378,9 @@ - (void)testSendClusterTest_TC_CC_8_000010_ReadAttribute NSLog(@"Check ColorLoopDirection Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -4768,6 +5389,7 @@ - (void)testSendClusterTest_TC_CC_8_000010_ReadAttribute - (void)testSendClusterTest_TC_CC_8_000011_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopTime Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4777,7 +5399,9 @@ - (void)testSendClusterTest_TC_CC_8_000011_ReadAttribute NSLog(@"Check ColorLoopTime Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 3500); + [expectation fulfill]; }]; @@ -4786,6 +5410,7 @@ - (void)testSendClusterTest_TC_CC_8_000011_ReadAttribute - (void)testSendClusterTest_TC_CC_8_000012_ColorLoopSet { XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set direction while running"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4809,6 +5434,7 @@ - (void)testSendClusterTest_TC_CC_8_000012_ColorLoopSet NSLog(@"Color Loop Set Command - Set direction while running Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4817,6 +5443,7 @@ - (void)testSendClusterTest_TC_CC_8_000012_ColorLoopSet - (void)testSendClusterTest_TC_CC_8_000013_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check ColorLoopDirection Value"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPColorControl * cluster = [[CHIPColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4826,7 +5453,9 @@ - (void)testSendClusterTest_TC_CC_8_000013_ReadAttribute NSLog(@"Check ColorLoopDirection Value Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + [expectation fulfill]; }]; @@ -4835,6 +5464,7 @@ - (void)testSendClusterTest_TC_CC_8_000013_ReadAttribute - (void)testSendClusterTest_TC_CC_8_000014_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4844,6 +5474,7 @@ - (void)testSendClusterTest_TC_CC_8_000014_Off NSLog(@"Turn off light that we turned on Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -4852,6 +5483,7 @@ - (void)testSendClusterTest_TC_CC_8_000014_Off - (void)testSendClusterTest_TC_CC_8_000015_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOnOff * cluster = [[CHIPOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4861,7 +5493,9 @@ - (void)testSendClusterTest_TC_CC_8_000015_ReadAttribute NSLog(@"Check on/off attribute value is false after off command Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; @@ -4871,6 +5505,7 @@ - (void)testSendClusterTest_TC_CC_8_000015_ReadAttribute - (void)testSendClusterTest_TC_WNCV_1_1_000000_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4880,7 +5515,9 @@ - (void)testSendClusterTest_TC_WNCV_1_1_000000_ReadAttribute NSLog(@"read the global attribute: ClusterRevision Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 5); + [expectation fulfill]; }]; @@ -4889,6 +5526,7 @@ - (void)testSendClusterTest_TC_WNCV_1_1_000000_ReadAttribute - (void)testSendClusterTest_TC_WNCV_1_1_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4898,7 +5536,9 @@ - (void)testSendClusterTest_TC_WNCV_1_1_000001_ReadAttribute NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 5); + [expectation fulfill]; }]; @@ -4908,6 +5548,7 @@ - (void)testSendClusterTest_TC_WNCV_1_1_000001_ReadAttribute - (void)testSendClusterTest_TC_WNCV_2_1_000000_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the RO mandatory attribute default: Type"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4917,7 +5558,9 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000000_ReadAttribute NSLog(@"read the RO mandatory attribute default: Type Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -4926,6 +5569,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000000_ReadAttribute - (void)testSendClusterTest_TC_WNCV_2_1_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back the RO mandatory attribute: Type"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4935,7 +5579,9 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000001_ReadAttribute NSLog(@"reads back the RO mandatory attribute: Type Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -4944,6 +5590,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000001_ReadAttribute - (void)testSendClusterTest_TC_WNCV_2_1_000002_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the RO mandatory attribute default: ConfigStatus"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4953,7 +5600,9 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000002_ReadAttribute NSLog(@"read the RO mandatory attribute default: ConfigStatus Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 3); + [expectation fulfill]; }]; @@ -4962,6 +5611,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000002_ReadAttribute - (void)testSendClusterTest_TC_WNCV_2_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back the RO mandatory attribute: ConfigStatus"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4971,7 +5621,9 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000003_ReadAttribute NSLog(@"reads back the RO mandatory attribute: ConfigStatus Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 3); + [expectation fulfill]; }]; @@ -4981,6 +5633,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000004_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the RO mandatory attribute default: OperationalStatus"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -4990,7 +5643,9 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000004_ReadAttribute NSLog(@"read the RO mandatory attribute default: OperationalStatus Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -4999,6 +5654,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000004_ReadAttribute - (void)testSendClusterTest_TC_WNCV_2_1_000005_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back the RO mandatory attribute: OperationalStatus"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5008,7 +5664,9 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000005_ReadAttribute NSLog(@"reads back the RO mandatory attribute: OperationalStatus Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -5017,6 +5675,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000005_ReadAttribute - (void)testSendClusterTest_TC_WNCV_2_1_000006_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the RO mandatory attribute default: EndProductType"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5026,7 +5685,9 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000006_ReadAttribute NSLog(@"read the RO mandatory attribute default: EndProductType Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -5035,6 +5696,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000006_ReadAttribute - (void)testSendClusterTest_TC_WNCV_2_1_000007_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back the RO mandatory attribute: EndProductType"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5044,7 +5706,9 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000007_ReadAttribute NSLog(@"reads back the RO mandatory attribute: EndProductType Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -5053,6 +5717,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000007_ReadAttribute - (void)testSendClusterTest_TC_WNCV_2_1_000008_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the RW mandatory attribute default: Mode"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5062,7 +5727,9 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000008_ReadAttribute NSLog(@"read the RW mandatory attribute default: Mode Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; }]; @@ -5071,6 +5738,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000008_ReadAttribute - (void)testSendClusterTest_TC_WNCV_2_1_000009_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"write a value into the RW mandatory attribute:: Mode"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5082,6 +5750,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000009_WriteAttribute NSLog(@"write a value into the RW mandatory attribute:: Mode Error: %@", err); XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -5090,6 +5759,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000009_WriteAttribute - (void)testSendClusterTest_TC_WNCV_2_1_000010_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back the RW mandatory attribute: Mode"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5099,7 +5769,9 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000010_ReadAttribute NSLog(@"reads back the RW mandatory attribute: Mode Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 7); + [expectation fulfill]; }]; @@ -5109,6 +5781,7 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000010_ReadAttribute - (void)testSendClusterTest_TC_BI_1_1_000000_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBinaryInputBasic * cluster = [[CHIPBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5118,7 +5791,9 @@ - (void)testSendClusterTest_TC_BI_1_1_000000_ReadAttribute NSLog(@"read the global attribute: ClusterRevision Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 1); + [expectation fulfill]; }]; @@ -5127,6 +5802,7 @@ - (void)testSendClusterTest_TC_BI_1_1_000000_ReadAttribute - (void)testSendClusterTest_TC_BI_1_1_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPBinaryInputBasic * cluster = [[CHIPBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5136,7 +5812,9 @@ - (void)testSendClusterTest_TC_BI_1_1_000001_ReadAttribute NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 1); + [expectation fulfill]; }]; @@ -5146,6 +5824,7 @@ - (void)testSendClusterTest_TC_BI_1_1_000001_ReadAttribute - (void)testSendClusterTest_TC_TM_1_1_000000_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTemperatureMeasurement * cluster = [[CHIPTemperatureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5155,7 +5834,9 @@ - (void)testSendClusterTest_TC_TM_1_1_000000_ReadAttribute NSLog(@"read the global attribute: ClusterRevision Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 3); + [expectation fulfill]; }]; @@ -5164,6 +5845,7 @@ - (void)testSendClusterTest_TC_TM_1_1_000000_ReadAttribute - (void)testSendClusterTest_TC_TM_1_1_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTemperatureMeasurement * cluster = [[CHIPTemperatureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5173,7 +5855,9 @@ - (void)testSendClusterTest_TC_TM_1_1_000001_ReadAttribute NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 3); + [expectation fulfill]; }]; @@ -5183,6 +5867,7 @@ - (void)testSendClusterTest_TC_TM_1_1_000001_ReadAttribute - (void)testSendClusterTest_TC_OCC_1_1_000000_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOccupancySensing * cluster = [[CHIPOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5192,7 +5877,9 @@ - (void)testSendClusterTest_TC_OCC_1_1_000000_ReadAttribute NSLog(@"read the global attribute: ClusterRevision Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 2); + [expectation fulfill]; }]; @@ -5201,6 +5888,7 @@ - (void)testSendClusterTest_TC_OCC_1_1_000000_ReadAttribute - (void)testSendClusterTest_TC_OCC_1_1_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOccupancySensing * cluster = [[CHIPOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; @@ -5210,7 +5898,9 @@ - (void)testSendClusterTest_TC_OCC_1_1_000001_ReadAttribute NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 2); + [expectation fulfill]; }]; @@ -5220,6 +5910,7 @@ - (void)testSendClusterTest_TC_OCC_1_1_000001_ReadAttribute - (void)testSendClusterTestOperationalCredentialsCluster_000000_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read number of supported fabrics"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOperationalCredentials * cluster = [[CHIPOperationalCredentials alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -5229,7 +5920,9 @@ - (void)testSendClusterTestOperationalCredentialsCluster_000000_ReadAttribute NSLog(@"Read number of supported fabrics Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertGreaterThanOrEqual([values[@"value"] unsignedCharValue], 4); + [expectation fulfill]; }]; @@ -5238,6 +5931,7 @@ - (void)testSendClusterTestOperationalCredentialsCluster_000000_ReadAttribute - (void)testSendClusterTestOperationalCredentialsCluster_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read number of commissioned fabrics"]; + CHIPDevice * device = GetPairedDevice(kDeviceId); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPOperationalCredentials * cluster = [[CHIPOperationalCredentials alloc] initWithDevice:device endpoint:0 queue:queue]; @@ -5247,7 +5941,9 @@ - (void)testSendClusterTestOperationalCredentialsCluster_000001_ReadAttribute NSLog(@"Read number of commissioned fabrics Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertGreaterThanOrEqual([values[@"value"] unsignedCharValue], 1); + [expectation fulfill]; }]; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 53d217738a0ccf..824cbc0ad19213 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -10580,7 +10580,7 @@ class TestDelayCommands : public TestCommand switch (mTestIndex++) { case 0: - err = TestSendClusterTestSuiteCommandWaitForMs_0(); + err = TestSendClusterDelayCommandsCommandWaitForMs_0(); break; } @@ -10599,9 +10599,9 @@ class TestDelayCommands : public TestCommand // Tests methods // - CHIP_ERROR TestSendClusterTestSuiteCommandWaitForMs_0() + CHIP_ERROR TestSendClusterDelayCommandsCommandWaitForMs_0() { - ChipLogProgress(chipTool, "TestSuite - WaitForMs - Wait 100ms"); + ChipLogProgress(chipTool, "DelayCommands - Wait 100ms"); return WaitForMs(100); } @@ -10633,13 +10633,22 @@ class TestSubscribe_OnOff : public TestCommand err = TestSendClusterOnOffCommandOff_0(); break; case 1: - err = TestSendClusterOnOffCommandSubscribeAttribute_1(); + err = TestSendClusterOnOffCommandWaitForReport_1(); break; case 2: - err = TestSendClusterOnOffCommandOn_2(); + err = TestSendClusterOnOffCommandSubscribeAttribute_2(); break; case 3: - err = TestSendClusterTestSuiteCommandWaitForAttributeReport_3(); + err = TestSendClusterOnOffCommandOn_3(); + break; + case 4: + err = TestSendClusterOnOffCommandWaitForReport_4(); + break; + case 5: + err = TestSendClusterOnOffCommandOff_5(); + break; + case 6: + err = TestSendClusterOnOffCommandWaitForReport_6(); break; } @@ -10652,7 +10661,7 @@ class TestSubscribe_OnOff : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + const uint16_t mTestCount = 7; // // Tests methods @@ -10712,56 +10721,109 @@ class TestSubscribe_OnOff : public TestCommand runner->NextTest(); } - // Test Subscribe OnOff Attribute + // Test Report: Subscribe OnOff Attribute using SuccessCallback_1 = void (*)(void * context, bool onOff); - chip::Callback::Callback mOnSuccessCallback_1{ - OnTestSendClusterOnOffCommandSubscribeAttribute_1_SuccessResponse, this - }; + chip::Callback::Callback mOnSuccessCallback_1{ OnTestSendClusterOnOffCommandWaitForReport_1_SuccessResponse, + this }; chip::Callback::Callback mOnFailureCallback_1{ - OnTestSendClusterOnOffCommandSubscribeAttribute_1_FailureResponse, this - }; - chip::Callback::Callback mOnSubscriptionEstablishedCallback_1{ - SubscribeAttribute_1_OnSubscriptionEstablishedCallback, this + OnTestSendClusterOnOffCommandWaitForReport_1_FailureResponse, this }; bool mIsFailureExpected_1 = 0; bool mReceivedReport_1 = false; - CHIP_ERROR TestSendClusterOnOffCommandSubscribeAttribute_1() + CHIP_ERROR TestSendClusterOnOffCommandWaitForReport_1() { - ChipLogProgress(chipTool, "On/Off - Subscribe OnOff Attribute: Sending command..."); + ChipLogProgress(chipTool, "On/Off - Report: Subscribe OnOff Attribute: Sending command..."); chip::Controller::OnOffCluster cluster; cluster.Associate(mDevice, 1); CHIP_ERROR err = CHIP_NO_ERROR; - cluster.ReportAttributeOnOff(mOnSuccessCallback_1.Cancel()); - err = cluster.ConfigureAttributeOnOff(mOnSubscriptionEstablishedCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), 2, 10); + err = cluster.ReportAttributeOnOff(mOnSuccessCallback_1.Cancel()); + + ReturnErrorOnFailure(chip::DeviceLayer::SystemLayer().StartTimer(0, OnWaitForMsFn, this)); return err; } - static void SubscribeAttribute_1_OnSubscriptionEstablishedCallback(void * context) + static void OnTestSendClusterOnOffCommandWaitForReport_1_FailureResponse(void * context, uint8_t status) { + ChipLogProgress(chipTool, "On/Off - Report: Subscribe OnOff Attribute: Failure Response"); + TestSubscribe_OnOff * runner = reinterpret_cast(context); - if (!runner->mReceivedReport_1) + + if (runner->mIsFailureExpected_1 == false) { - ChipLogError(chipTool, "Error: Initial report not received!"); + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } - runner->NextTest(); } - static void OnTestSendClusterOnOffCommandSubscribeAttribute_1_FailureResponse(void * context, uint8_t status) + static void OnTestSendClusterOnOffCommandWaitForReport_1_SuccessResponse(void * context, bool onOff) + { + ChipLogProgress(chipTool, "On/Off - Report: Subscribe OnOff Attribute: Success Response"); + + TestSubscribe_OnOff * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_1 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + if (runner->mReceivedReport_1) + { + // Receiving report more than once is not an error since the subscription may be alive for a long time. + ChipLogProgress(chipTool, "Note: on report called more than once."); + return; + } + runner->mReceivedReport_1 = true; + + if (onOff != false) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "false"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + } + + // Test Subscribe OnOff Attribute + using SuccessCallback_2 = void (*)(void * context, bool onOff); + chip::Callback::Callback mOnSuccessCallback_2{ + OnTestSendClusterOnOffCommandSubscribeAttribute_2_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_2{ + OnTestSendClusterOnOffCommandSubscribeAttribute_2_FailureResponse, this + }; + + bool mIsFailureExpected_2 = 0; + + CHIP_ERROR TestSendClusterOnOffCommandSubscribeAttribute_2() + { + ChipLogProgress(chipTool, "On/Off - Subscribe OnOff Attribute: Sending command..."); + + chip::Controller::OnOffCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ConfigureAttributeOnOff(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), 2, 10); + + return err; + } + + static void OnTestSendClusterOnOffCommandSubscribeAttribute_2_FailureResponse(void * context, uint8_t status) { ChipLogProgress(chipTool, "On/Off - Subscribe OnOff Attribute: Failure Response"); TestSubscribe_OnOff * runner = reinterpret_cast(context); - if (runner->mIsFailureExpected_1 == false) + if (runner->mIsFailureExpected_2 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); @@ -10771,38 +10833,38 @@ class TestSubscribe_OnOff : public TestCommand runner->NextTest(); } - static void OnTestSendClusterOnOffCommandSubscribeAttribute_1_SuccessResponse(void * context, bool onOff) + static void OnTestSendClusterOnOffCommandSubscribeAttribute_2_SuccessResponse(void * context, bool onOff) { ChipLogProgress(chipTool, "On/Off - Subscribe OnOff Attribute: Success Response"); TestSubscribe_OnOff * runner = reinterpret_cast(context); - if (runner->mIsFailureExpected_1 == true) + if (runner->mIsFailureExpected_2 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } - if (onOff != false) + if (!runner->mReceivedReport_1) { - ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "false"); + ChipLogError(chipTool, "Error: Initial report not received!"); runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } - runner->mReceivedReport_1 = true; + runner->NextTest(); } // Test Turn On the light to see attribute change - using SuccessCallback_2 = void (*)(void * context); - chip::Callback::Callback mOnSuccessCallback_2{ OnTestSendClusterOnOffCommandOn_2_SuccessResponse, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnTestSendClusterOnOffCommandOn_2_FailureResponse, + using SuccessCallback_3 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_3{ OnTestSendClusterOnOffCommandOn_3_SuccessResponse, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnTestSendClusterOnOffCommandOn_3_FailureResponse, this }; - bool mIsFailureExpected_2 = 0; + bool mIsFailureExpected_3 = 0; - CHIP_ERROR TestSendClusterOnOffCommandOn_2() + CHIP_ERROR TestSendClusterOnOffCommandOn_3() { ChipLogProgress(chipTool, "On/Off - Turn On the light to see attribute change: Sending command..."); @@ -10811,18 +10873,18 @@ class TestSubscribe_OnOff : public TestCommand CHIP_ERROR err = CHIP_NO_ERROR; - err = cluster.On(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + err = cluster.On(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); return err; } - static void OnTestSendClusterOnOffCommandOn_2_FailureResponse(void * context, uint8_t status) + static void OnTestSendClusterOnOffCommandOn_3_FailureResponse(void * context, uint8_t status) { ChipLogProgress(chipTool, "On/Off - Turn On the light to see attribute change: Failure Response"); TestSubscribe_OnOff * runner = reinterpret_cast(context); - if (runner->mIsFailureExpected_2 == false) + if (runner->mIsFailureExpected_3 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); @@ -10832,13 +10894,13 @@ class TestSubscribe_OnOff : public TestCommand runner->NextTest(); } - static void OnTestSendClusterOnOffCommandOn_2_SuccessResponse(void * context) + static void OnTestSendClusterOnOffCommandOn_3_SuccessResponse(void * context) { ChipLogProgress(chipTool, "On/Off - Turn On the light to see attribute change: Success Response"); TestSubscribe_OnOff * runner = reinterpret_cast(context); - if (runner->mIsFailureExpected_2 == true) + if (runner->mIsFailureExpected_3 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); @@ -10848,30 +10910,68 @@ class TestSubscribe_OnOff : public TestCommand runner->NextTest(); } - // The callback should be called atleast once - using OnReportCallback_3 = void (*)(void * context, bool onOff); - chip::Callback::Callback mOnReportCallback_3{ SubscribeAttribute_3_OnReportCallback, this }; + // Test Check for attribute report + using SuccessCallback_4 = void (*)(void * context, bool onOff); + chip::Callback::Callback mOnSuccessCallback_4{ OnTestSendClusterOnOffCommandWaitForReport_4_SuccessResponse, + this }; + chip::Callback::Callback mOnFailureCallback_4{ + OnTestSendClusterOnOffCommandWaitForReport_4_FailureResponse, this + }; + + bool mIsFailureExpected_4 = 0; - bool mReceivedReport_3 = false; + bool mReceivedReport_4 = false; - CHIP_ERROR TestSendClusterTestSuiteCommandWaitForAttributeReport_3() + CHIP_ERROR TestSendClusterOnOffCommandWaitForReport_4() { - ChipLogProgress(chipTool, "TestSuite - WaitForAttributeReport - Check for attribute report"); + ChipLogProgress(chipTool, "On/Off - Check for attribute report: Sending command..."); + chip::Controller::OnOffCluster cluster; cluster.Associate(mDevice, 1); - return cluster.ReportAttributeOnOff(mOnReportCallback_3.Cancel()); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReportAttributeOnOff(mOnSuccessCallback_4.Cancel()); + + return err; + } + + static void OnTestSendClusterOnOffCommandWaitForReport_4_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "On/Off - Check for attribute report: Failure Response"); + + TestSubscribe_OnOff * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_4 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); } - static void SubscribeAttribute_3_OnReportCallback(void * context, bool onOff) + static void OnTestSendClusterOnOffCommandWaitForReport_4_SuccessResponse(void * context, bool onOff) { - ChipLogProgress(chipTool, "On/Off - Subscribe OnOff Attribute: Report Data"); + ChipLogProgress(chipTool, "On/Off - Check for attribute report: Success Response"); + TestSubscribe_OnOff * runner = reinterpret_cast(context); - if (runner->mReceivedReport_3) + if (runner->mIsFailureExpected_4 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + if (runner->mReceivedReport_4) { - // Receiving attribute more than once is not an issue, since the following handler will override previous handlers. + // Receiving report more than once is not an error since the subscription may be alive for a long time. + ChipLogProgress(chipTool, "Note: on report called more than once."); return; } + runner->mReceivedReport_4 = true; if (onOff != true) { @@ -10880,8 +10980,133 @@ class TestSubscribe_OnOff : public TestCommand return; } - runner->mReceivedReport_3 = true; - ChipLogProgress(chipTool, "On/Off - report received."); + runner->NextTest(); + } + + // Test Turn Off the light to see attribute change + using SuccessCallback_5 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_5{ OnTestSendClusterOnOffCommandOff_5_SuccessResponse, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnTestSendClusterOnOffCommandOff_5_FailureResponse, + this }; + + bool mIsFailureExpected_5 = 0; + + CHIP_ERROR TestSendClusterOnOffCommandOff_5() + { + ChipLogProgress(chipTool, "On/Off - Turn Off the light to see attribute change: Sending command..."); + + chip::Controller::OnOffCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.Off(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + + return err; + } + + static void OnTestSendClusterOnOffCommandOff_5_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "On/Off - Turn Off the light to see attribute change: Failure Response"); + + TestSubscribe_OnOff * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_5 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterOnOffCommandOff_5_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "On/Off - Turn Off the light to see attribute change: Success Response"); + + TestSubscribe_OnOff * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_5 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check for attribute report + using SuccessCallback_6 = void (*)(void * context, bool onOff); + chip::Callback::Callback mOnSuccessCallback_6{ OnTestSendClusterOnOffCommandWaitForReport_6_SuccessResponse, + this }; + chip::Callback::Callback mOnFailureCallback_6{ + OnTestSendClusterOnOffCommandWaitForReport_6_FailureResponse, this + }; + + bool mIsFailureExpected_6 = 0; + + bool mReceivedReport_6 = false; + + CHIP_ERROR TestSendClusterOnOffCommandWaitForReport_6() + { + ChipLogProgress(chipTool, "On/Off - Check for attribute report: Sending command..."); + + chip::Controller::OnOffCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReportAttributeOnOff(mOnSuccessCallback_6.Cancel()); + + return err; + } + + static void OnTestSendClusterOnOffCommandWaitForReport_6_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "On/Off - Check for attribute report: Failure Response"); + + TestSubscribe_OnOff * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_6 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterOnOffCommandWaitForReport_6_SuccessResponse(void * context, bool onOff) + { + ChipLogProgress(chipTool, "On/Off - Check for attribute report: Success Response"); + + TestSubscribe_OnOff * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_6 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + if (runner->mReceivedReport_6) + { + // Receiving report more than once is not an error since the subscription may be alive for a long time. + ChipLogProgress(chipTool, "Note: on report called more than once."); + return; + } + runner->mReceivedReport_6 = true; + + if (onOff != false) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "false"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + runner->NextTest(); } };