diff --git a/examples/chip-tool/templates/partials/test_cluster.zapt b/examples/chip-tool/templates/partials/test_cluster.zapt index 7fa003afa1a389..4a62f625feca4d 100644 --- a/examples/chip-tool/templates/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/partials/test_cluster.zapt @@ -2,7 +2,11 @@ class {{filename}}: public TestCommand { public: + {{#if ../credsIssuerConfigArg}} {{filename}}(CredentialIssuerCommands * credsIssuerConfig): TestCommand("{{filename}}", credsIssuerConfig), mTestIndex(0) + {{else}} + {{filename}}(): TestCommand("{{filename}}"), mTestIndex(0) + {{/if}} { {{#chip_tests_config}} {{#if (isString type)}} @@ -93,7 +97,7 @@ class {{filename}}: public TestCommand {{#chip_tests_item_response_parameters}} {{#if saveAs}} {{~#if (isString type)}}{{#if (isOctetString type)}}uint8_t{{else}}char{{/if}} * {{saveAs}}Buffer = nullptr;{{/if~}} - {{chipType}} {{saveAs}}; + {{zapTypeToDecodableClusterObjectType type ns=../cluster}} {{saveAs}}; {{/if}} {{/chip_tests_item_response_parameters}} {{/chip_tests_items}} diff --git a/examples/chip-tool/templates/partials/test_cluster_placeholder.zapt b/examples/chip-tool/templates/partials/test_cluster_placeholder.zapt deleted file mode 100644 index e8dcdf642b7798..00000000000000 --- a/examples/chip-tool/templates/partials/test_cluster_placeholder.zapt +++ /dev/null @@ -1,415 +0,0 @@ -{{#chip_tests tests}} -class {{filename}}: public TestCommand -{ - public: - {{filename}}(): TestCommand("{{filename}}"), mTestIndex(0) - { - {{#chip_tests_config}} - {{#if (isString type)}} - AddArgument("{{name}}", &m{{asUpperCamelCase name}}); - {{else}} - AddArgument("{{name}}", {{asTypeMinValue type}}, {{asTypeMaxValue type}}, &m{{asUpperCamelCase name}}); - {{/if}} - {{/chip_tests_config}} - } - - ~{{filename}}() - { - {{#chip_tests_items}} - {{#chip_tests_item_response_parameters}} - {{#if saveAs}} - {{#if (isString type)}} - if ({{saveAs}}Buffer != nullptr) - { - chip::Platform::MemoryFree({{saveAs}}Buffer); - {{saveAs}}Buffer = nullptr; - } - {{/if}} - {{/if}} - {{/chip_tests_item_response_parameters}} - {{/chip_tests_items}} - } - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: {{filename}}\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: {{filename}}\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - {{#chip_tests_items}} - case {{index}}: - ChipLogProgress(chipTool, " ***** Test Step {{index}} : {{label}}\n"); - {{#if PICS}} - if (ShouldSkip("{{PICS}}")) - { - NextTest(); - return; - } - {{/if}} - err = Test{{asUpperCamelCase label}}_{{index}}(); - break; - {{/chip_tests_items}} - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - {{#if timeout}} - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.HasValue() ? mTimeout.Value() : {{timeout}}); } - {{/if}} - - private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = {{totalTests}}; - - {{#chip_tests_config}} - chip::Optional<{{chipType}}> m{{asUpperCamelCase name}}; - {{/chip_tests_config}} - - {{#chip_tests_items}} - {{#chip_tests_item_response_parameters}} - {{#if saveAs}} - {{~#if (isString type)}}{{#if (isOctetString type)}}uint8_t{{else}}char{{/if}} * {{saveAs}}Buffer = nullptr;{{/if~}} - {{chipType}} {{saveAs}}; - {{/if}} - {{/chip_tests_item_response_parameters}} - {{/chip_tests_items}} - - {{! Helper around zapTypeToDecodableClusterObjectType that lets us set the - array/nullable/etc context appropriately.}} - {{~#*inline "subscribeResponseDataArgument"~}} - {{zapTypeToDecodableClusterObjectType type ns=cluster isArgument=true}} value - {{~/inline~}} - {{~#*inline "subscribeResponseArguments"~}} - {{> subscribeResponseDataArgument type=attr.type isArray=attr.isArray isNullable=attr.isNullable}} - {{~/inline~}} - - {{~#*inline "subscribeDataCallback"}} - mTest_{{parent.filename}}_{{attribute}}_Reported - {{/inline}} - {{#*inline "subscribeDataCallbackType"}} - Test_{{parent.filename}}_{{attribute}}_ReportCallback - {{/inline}} - {{#chip_tests_items}} - {{#if allocateSubscribeDataCallback}} - typedef void (*{{> subscribeDataCallbackType}})(void * context, {{> subscribeResponseArguments attr=attributeObject}}); - {{> subscribeDataCallbackType}} {{> subscribeDataCallback}} = nullptr; - {{/if}} - {{/chip_tests_items}} - - {{#*inline "failureResponse"}}OnFailureResponse_{{index}}{{/inline}} - {{#*inline "successResponse"}}OnSuccessResponse_{{index}}{{/inline}} - {{#*inline "subscriptionEstablished"}}OnSubscriptionEstablishedResponse_{{index}}{{/inline}} - {{#*inline "doneResponse"}}OnDoneResponse_{{index}}{{/inline}} - - {{#*inline "staticFailureResponse"}}OnFailureCallback_{{index}}{{/inline}} - {{#*inline "staticSuccessResponse"}}OnSuccessCallback_{{index}}{{/inline}} - {{#*inline "staticSubscriptionEstablished"}}OnSubscriptionEstablished_{{index}}{{/inline}} - {{#*inline "staticDoneResponse"}}OnDoneCallback_{{index}}{{/inline}} - - {{#*inline "successArguments"}}{{#chip_tests_item_response_parameters}}{{#first}}{{#if ../leadingComma}}, {{/if}}{{/first}} {{zapTypeToDecodableClusterObjectType type ns=parent.cluster isArgument=true}} {{asLowerCamelCase name}}{{#not_last}}, {{/not_last}}{{/chip_tests_item_response_parameters}}{{/inline}} - {{! TODO: Temporary if cascade until everything is converted to the new status setup }} - {{#*inline "failureArguments"}}{{#if leadingComma}}, {{/if}}CHIP_ERROR error{{/inline}} - {{#*inline "staticSuccessArguments"}}void * context{{> successArguments leadingComma=true}}{{/inline}} - {{#*inline "staticFailureArguments"}}void * context{{> failureArguments leadingComma=true}}{{/inline}} - {{#*inline "staticDoneArguments"}}void * context{{/inline}} - {{#*inline "doneArguments"}}{{/inline}} - - {{#*inline "staticSubscriptionEstablishedArguments"}}void * context{{/inline}} - {{#*inline "subscriptionEstablishedArguments"}}{{/inline}} - - {{#chip_tests_items}} - {{#unless (isTestOnlyCluster cluster)}} - {{#unless isWait}} - {{#unless isCommand}} - {{#if isWriteAttribute}} - {{#if isGroupCommand}} - static void {{>staticDoneResponse}}({{>staticDoneArguments}}) - { - (static_cast<{{filename}} *>(context))->{{> doneResponse }}(); - } - {{/if}} - {{/if}} - - static void {{>staticFailureResponse}}({{>staticFailureArguments}}) - { - (static_cast<{{filename}} *>(context))->{{>failureResponse}}(error); - } - - static void {{>staticSuccessResponse}}({{> staticSuccessArguments}}) - { - (static_cast<{{filename}} *>(context))->{{>successResponse}}({{#chip_tests_item_response_parameters}}{{#not_first}}, {{/not_first}}{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}); - } - - {{#if isSubscribe}} - static void {{> staticSubscriptionEstablished}}({{> staticSubscriptionEstablishedArguments}}) - { - (static_cast<{{filename}} *>(context))->{{> subscriptionEstablished}}(); - } - {{/if}} - - {{#if isWaitForReport}} - bool mReceivedReport_{{index}} = false; - {{/if}} - - {{/unless}} - {{/unless}} - {{/unless}} - {{/chip_tests_items}} - - // - // Tests methods - // - - {{#chip_tests_items}} - {{#*inline "testCommand"}}Test{{asUpperCamelCase label}}_{{index}}{{/inline}} - {{#if (isTestOnlyCluster cluster)}} - CHIP_ERROR {{>testCommand}}() - { - SetIdentity(kIdentity{{asUpperCamelCase identity}}); - return {{command}}({{#chip_tests_item_parameters}}{{#not_first}}, {{/not_first}}{{#if (isString type)}}"{{/if}}{{definedValue}}{{#if (isString type)}}"{{/if}}{{/chip_tests_item_parameters}}); - } - {{else if isWait}} - CHIP_ERROR {{>testCommand}}() - { - const chip::EndpointId endpoint = {{#if (chip_tests_config_has "endpoint")}}mEndpoint.HasValue() ? mEndpoint.Value() : {{/if}}{{endpoint}}; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: {{cluster}} {{#if isAttribute}}Attribute: {{attribute}}{{else}}Command: {{wait}}{{/if}}] {{label}}", endpoint); - {{#*inline "waitForTypeName"}}{{#if isAttribute}}Attribute{{else}}Command{{/if}}{{/inline}} - {{#*inline "waitForTypeId"}}chip::app::Clusters::{{asUpperCamelCase cluster}}::{{#if isAttribute}}Attributes::{{attribute}}{{else}}Commands::{{wait}}{{/if}}::Id{{/inline}} - ClearAttributeAndCommandPaths(); - m{{>waitForTypeName}}Path = chip::app::Concrete{{>waitForTypeName}}Path(endpoint, chip::app::Clusters::{{asUpperCamelCase cluster}}::Id, {{>waitForTypeId}}); - return CHIP_NO_ERROR; - } - {{else}} - - {{#*inline "device"}}mDevices[kIdentity{{asUpperCamelCase identity}}]{{/inline}} - CHIP_ERROR {{>testCommand}}() - { - {{#if isGroupCommand}} - const chip::GroupId groupId = {{groupId}}; - {{else}} - const chip::EndpointId endpoint = {{#if (chip_tests_config_has "endpoint")}}mEndpoint.HasValue() ? mEndpoint.Value() : {{/if}}{{endpoint}}; - {{/if}} - - {{~#*inline "maybeTimedInteractionTimeout"}} - {{#if timedInteractionTimeoutMs}} - , {{timedInteractionTimeoutMs}} - {{else if commandObject.mustUseTimedInvoke}} - , chip::NullOptional - {{else if attributeObject.mustUseTimedWrite}} - , chip::NullOptional - {{/if}} - {{/inline~}} - - {{~#*inline "maybeWait"}} - {{#if busyWaitMs}} - { - using namespace chip::System::Clock::Literals; - // Busy-wait for {{busyWaitMs}} milliseconds. - auto & clock = chip::System::SystemClock(); - auto start = clock.GetMonotonicTimestamp(); - while (clock.GetMonotonicTimestamp() - start < {{busyWaitMs}}_ms); - } - {{/if}} - {{/inline~}} - - {{#if isCommand}} - using RequestType = chip::app::Clusters::{{asUpperCamelCase cluster}}::Commands::{{asUpperCamelCase command}}::Type; - - RequestType request; - {{#chip_tests_item_parameters}} - {{>commandValue ns=parent.cluster container=(concat "request." (asLowerCamelCase label)) definedValue=definedValue depth=0}} - {{/chip_tests_item_parameters}} - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast<{{filename}} *>(context))->{{>successResponse}}({{#chip_tests_item_response_parameters}}{{#not_first}}, {{/not_first}}data.{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast<{{filename}} *>(context))->{{>failureResponse}}(error); - }; - - {{#if isGroupCommand}} - auto done = [](void * context) { - (static_cast<{{filename}} *>(context))->OnDoneResponse_{{index}}(); - }; - {{/if}} - - ReturnErrorOnFailure(chip::Controller::{{#if isGroupCommand}}InvokeGroupCommand{{else}}InvokeCommand{{/if}}({{>device}}, this, success, failure, {{#if isGroupCommand}}done,{{/if}} - {{#if isGroupCommand}}groupId{{else}}endpoint{{/if}}, - request - {{> maybeTimedInteractionTimeout }} - )); - {{> maybeWait }} - {{else}} - chip::Controller::{{asUpperCamelCase cluster}}ClusterTest cluster; - {{#if isGroupCommand}} - cluster.AssociateWithGroup({{>device}}, groupId); - {{else}} - cluster.Associate({{>device}}, endpoint); - {{/if}} - - {{#chip_tests_item_parameters}} - {{zapTypeToEncodableClusterObjectType type ns=parent.cluster}} {{asLowerCamelCase name}}Argument; - {{>commandValue ns=parent.cluster container=(concat (asLowerCamelCase name) "Argument") definedValue=definedValue depth=0}} - {{/chip_tests_item_parameters}} - - {{#if isWriteAttribute}} - ReturnErrorOnFailure(cluster.WriteAttribute({{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument, {{/chip_tests_item_parameters}}this, {{>staticSuccessResponse}}, {{>staticFailureResponse}} - {{~> maybeTimedInteractionTimeout ~}} - {{~#if isGroupCommand}}, {{>staticDoneResponse}}{{/if~}} - )); - {{> maybeWait }} - {{else if isReadEvent}} - ReturnErrorOnFailure(cluster.ReadEvent<{{zapTypeToDecodableClusterObjectType event ns=cluster isArgument=true}}>(this, {{>staticSuccessResponse}}, {{>staticFailureResponse}})); - {{else if isSubscribeEvent}} - ReturnErrorOnFailure(cluster.SubscribeEvent<{{zapTypeToDecodableClusterObjectType event ns=cluster isArgument=true}}>(this, {{>staticSuccessResponse}}, {{>staticFailureResponse}}, minIntervalArgument, maxIntervalArgument, {{>staticSubscriptionEstablished}})); - {{else if isReadAttribute}} - ReturnErrorOnFailure(cluster.ReadAttribute({{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument, {{/chip_tests_item_parameters}}this, {{>staticSuccessResponse}}, {{>staticFailureResponse}})); - {{else if isSubscribeAttribute}} - ReturnErrorOnFailure(cluster.SubscribeAttribute(this, {{>staticSuccessResponse}}, {{>staticFailureResponse}}, minIntervalArgument, maxIntervalArgument, {{>staticSubscriptionEstablished}})); - {{else if isWaitForReport}} - {{> subscribeDataCallback}} = {{> staticSuccessResponse}}; - {{else}} - UNEXPECTED COMMAND: {{>commandName}} - {{/if}} - {{/if}} - {{#if async}} - return WaitForMs(0); - {{else}} - return CHIP_NO_ERROR; - {{/if}} - } - - void {{>failureResponse}}({{>failureArguments}}) - { - chip::app::StatusIB status(error); - {{#if response.error}} - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), {{response.error}})); - {{#unless async}}NextTest();{{/unless}} - {{else if response.errorWrongValue}} - VerifyOrReturn(CheckConstraintNotValue("status", chip::to_underlying(status.mStatus), 0)); - {{#unless async}}NextTest();{{/unless}} - {{else}} - {{#if optional}}(status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : {{/if}}ThrowFailureResponse(); - {{/if}} - } - - {{#if isSubscribe}} - void {{>successResponse}}({{> subscribeResponseArguments attr=attributeObject}}) - { - {{#if response.error}} - ThrowSuccessResponse(); - {{else if response.errorWrongValue}} - ThrowSuccessResponse(); - {{else}} - if ({{> subscribeDataCallback}}) { - auto callback = {{> subscribeDataCallback}}; - {{> subscribeDataCallback}} = nullptr; - callback(this, value); - } - {{/if}} - } - - void {{>subscriptionEstablished}}({{> subscriptionEstablishedArguments}}) - { - {{#if hasWaitForReport}} - VerifyOrReturn(mReceivedReport_{{waitForReport.index}}, Exit("Initial report not received!")); - {{/if}} - {{#unless async}}NextTest();{{/unless}} - } - {{else}} - void {{>successResponse}}({{>successArguments}}) - { - {{~#if response.error}} - ThrowSuccessResponse(); - {{else if response.errorWrongValue}} - ThrowSuccessResponse(); - {{else}} - {{#if isWaitForReport}} - mReceivedReport_{{index}} = true; - {{/if}} - {{#chip_tests_item_response_parameters}} - {{~#*inline "item"}}{{asLowerCamelCase name}}{{#if isOptional}}.Value(){{/if}}{{/inline}} - {{#if hasExpectedValue}} - {{>valueEquals actual=(asLowerCamelCase name) label=(asLowerCamelCase name) expected=expectedValue depth=0}} - {{/if}} - {{#if hasExpectedConstraints}} - {{#if isOptional}} - {{~#*inline "item"}}{{asLowerCamelCase name}}{{/inline}} - VerifyOrReturn(CheckValuePresent("{{> item}}", {{> item}})); - {{/if}} - {{#if (hasProperty expectedConstraints "type")}}VerifyOrReturn(CheckConstraintType("{{>item}}", "", "{{expectedConstraints.type}}"));{{/if}} - {{~#if (hasProperty expectedConstraints "format")}}VerifyOrReturn(CheckConstraintFormat("{{>item}}", "", "{{expectedConstraints.format}}"));{{/if}} - {{~#if (hasProperty expectedConstraints "startsWith")}}VerifyOrReturn(CheckConstraintStartsWith("{{>item}}", {{>item}}, "{{expectedConstraints.startsWith}}"));{{/if}} - {{~#if (hasProperty expectedConstraints "endsWith")}}VerifyOrReturn(CheckConstraintEndsWith("{{>item}}", {{>item}}, "{{expectedConstraints.endsWith}}"));{{/if}} - {{~#if (hasProperty expectedConstraints "isUpperCase")}}VerifyOrReturn(CheckConstraintIsUpperCase("{{>item}}", {{>item}}, {{expectedConstraints.isUpperCase}}));{{/if}} - {{~#if (hasProperty expectedConstraints "isLowerCase")}}VerifyOrReturn(CheckConstraintIsLowerCase("{{>item}}", {{>item}}, {{expectedConstraints.isLowerCase}}));{{/if}} - {{~#if (hasProperty expectedConstraints "isHexString")}}VerifyOrReturn(CheckConstraintIsHexString("{{>item}}", {{>item}}, {{expectedConstraints.isHexString}}));{{/if}} - {{~#if (hasProperty expectedConstraints "minLength")}}VerifyOrReturn(CheckConstraintMinLength("{{>item}}", {{>item}}.size(), {{expectedConstraints.minLength}}));{{/if}} - {{~#if (hasProperty expectedConstraints "maxLength")}}VerifyOrReturn(CheckConstraintMaxLength("{{>item}}", {{>item}}.size(), {{expectedConstraints.maxLength}}));{{/if}} - {{~#if (hasProperty expectedConstraints "minValue")}}VerifyOrReturn(CheckConstraintMinValue<{{chipType}}>("{{>item}}", {{>item}}, {{asTypedLiteral expectedConstraints.minValue type}}));{{/if}} - {{~#if (hasProperty expectedConstraints "maxValue")}}VerifyOrReturn(CheckConstraintMaxValue<{{chipType}}>("{{>item}}", {{>item}}, {{asTypedLiteral expectedConstraints.maxValue type}}));{{/if}} - {{~#if (hasProperty expectedConstraints "notValue")}} - {{#if (isLiteralNull expectedConstraints.notValue)}} - VerifyOrReturn(CheckValueNonNull("{{>item}}", {{>item}})); - {{else}} - VerifyOrReturn(CheckConstraintNotValue("{{>item}}", {{>item}}, {{asTypedLiteral expectedConstraints.notValue type}})); - {{/if}} - {{/if}} - {{/if}} - - {{#if saveAs}} - {{#if (isString type)}} - if ({{saveAs}}Buffer != nullptr) - { - chip::Platform::MemoryFree({{saveAs}}Buffer); - } - {{saveAs}}Buffer = static_cast<{{#if (isOctetString type)}}uint8_t{{else}}char{{/if}} *>(chip::Platform::MemoryAlloc({{>item}}.size())); - memcpy({{saveAs}}Buffer, {{>item}}.data(), {{>item}}.size()); - {{saveAs}} = {{chipType}}({{saveAs}}Buffer, {{>item}}.size()); - {{else}} - {{saveAs}} = {{>item}}; - {{/if}} - {{/if}} - {{/chip_tests_item_response_parameters}} - {{#unless async}}NextTest();{{/unless}} - {{/if}} - } - {{/if}} - - {{#if isGroupCommand}} - void {{>doneResponse}}({{>doneArguments}}) - { - NextTest(); - } - {{/if}} - - {{/if}} - {{/chip_tests_items}} -}; - -{{/chip_tests}} diff --git a/examples/chip-tool/templates/partials/test_cluster_value_equals.zapt b/examples/chip-tool/templates/partials/test_cluster_value_equals.zapt index 179e3cda27a993..9018d3dfbc063f 100644 --- a/examples/chip-tool/templates/partials/test_cluster_value_equals.zapt +++ b/examples/chip-tool/templates/partials/test_cluster_value_equals.zapt @@ -5,8 +5,20 @@ {{#if (isLiteralNull expected)}} VerifyOrReturn(CheckValueNull("{{label}}", {{actual}})); {{else}} - VerifyOrReturn(CheckValueNonNull("{{label}}", {{actual}})); - {{>valueEquals label=(concat label ".Value()") actual=(concat actual ".Value()") expected=expected isNullable=false depth=(incrementDepth depth)}} + {{#if (chip_tests_variables_has expected)}} + {{! Expected value is also a nullable. }} + if ({{expected}}.IsNull()) { + VerifyOrReturn(CheckValueNull("{{label}}", {{actual}})); + } + else + { + VerifyOrReturn(CheckValueNonNull("{{label}}", {{actual}})); + {{>valueEquals label=(concat label ".Value()") actual=(concat actual ".Value()") expected=(concat expected ".Value()") isNullable=false depth=(incrementDepth depth)}} + } + {{else}} + VerifyOrReturn(CheckValueNonNull("{{label}}", {{actual}})); + {{>valueEquals label=(concat label ".Value()") actual=(concat actual ".Value()") expected=expected isNullable=false depth=(incrementDepth depth)}} + {{/if}} {{/if}} {{else if isArray}} { diff --git a/examples/chip-tool/templates/tests-commands.zapt b/examples/chip-tool/templates/tests-commands.zapt index 828c4fb3d61351..f8df5cc8f75c6c 100644 --- a/examples/chip-tool/templates/tests-commands.zapt +++ b/examples/chip-tool/templates/tests-commands.zapt @@ -21,7 +21,7 @@ public: } }; -{{>test_cluster tests=(getTests)}} +{{>test_cluster tests=(getTests) credsIssuerConfigArg=true}} void registerCommandsTests(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { diff --git a/examples/placeholder/templates/templates.json b/examples/placeholder/templates/templates.json index 09a0790ec1505e..f08de0822f95fa 100644 --- a/examples/placeholder/templates/templates.json +++ b/examples/placeholder/templates/templates.json @@ -26,7 +26,7 @@ }, { "name": "test_cluster", - "path": "../../../examples/chip-tool/templates/partials/test_cluster_placeholder.zapt" + "path": "../../../examples/chip-tool/templates/partials/test_cluster.zapt" }, { "name": "commandValue", diff --git a/examples/placeholder/templates/tests-commands.zapt b/examples/placeholder/templates/tests-commands.zapt index d2f60abee86a39..b126d4efb77e7b 100644 --- a/examples/placeholder/templates/tests-commands.zapt +++ b/examples/placeholder/templates/tests-commands.zapt @@ -5,7 +5,7 @@ #include "TestCommand.h" {{#if (getTests)}} -{{>test_cluster tests=(getTests)}} +{{>test_cluster tests=(getTests) credsIssuerConfigArg=false}} {{/if}} std::unique_ptrGetTestCommand(std::string testName) diff --git a/src/app/zap-templates/partials/helper.js b/src/app/zap-templates/partials/helper.js index f98c69e1e5c7c7..78f61cffccce43 100644 --- a/src/app/zap-templates/partials/helper.js +++ b/src/app/zap-templates/partials/helper.js @@ -23,10 +23,14 @@ function pad(label, len, ch = ' ') function concat() { let str = '' - for (let arg in arguments) + // Last argument is our hash argument. + for (let arg = 0; arg < arguments.length - 1; ++arg) { - if (typeof arguments[arg] != 'object') { + if (typeof arguments[arg] != 'object' || arguments[arg] instanceof String) { str += arguments[arg]; + } else { + throw new TypeError( + `Unexpected object in concat: ${arg}:${Object.prototype.toString.call(arguments[arg])}, ${JSON.stringify(arguments)}`); } } return str diff --git a/src/darwin/Framework/CHIP/templates/partials/check_test_value.zapt b/src/darwin/Framework/CHIP/templates/partials/check_test_value.zapt index 7ef670c1723cc4..2460f9404a5627 100644 --- a/src/darwin/Framework/CHIP/templates/partials/check_test_value.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/check_test_value.zapt @@ -6,8 +6,17 @@ {{#if (isLiteralNull expected)}} XCTAssertTrue({{actual}} == nil); {{else}} + {{#if (chip_tests_variables_has expected)}} + {{! Expected value is also a nullable. }} + if ({{expected}} == nil) { + XCTAssertTrue({{actual}} == nil); + } else { + {{/if}} XCTAssertFalse({{actual}} == nil); {{>check_test_value actual=actual expected=expected cluster=cluster isNullable=false}} + {{#if (chip_tests_variables_has expected)}} + } + {{/if}} {{/if}} {{else if isArray}} XCTAssertEqual([{{actual}} count], {{expected.length}}); @@ -28,11 +37,7 @@ than "global") that are not present in the struct ? }} {{else}} {{#if (chip_tests_variables_has expected)}} - {{#if (isString type)}} XCTAssertEqualObjects({{actual}}, {{expected}}); - {{else}} - XCTAssertEqual([{{actual}} {{asObjectiveCNumberType "" type true}}Value], {{expected}}); - {{/if}} {{else if (isOctetString type)}} XCTAssertTrue([{{actual}} isEqualToData:[[NSData alloc] initWithBytes:"{{octetStringEscapedForCLiteral expected}}" length:{{expected.length}}]]); {{else if (isCharString type)}} diff --git a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt index 1fc95ee9918de2..afbf2eb00b4c51 100644 --- a/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt @@ -5,7 +5,7 @@ bool testSendCluster{{parent.filename}}_{{asTestIndex index}}_{{asUpperCamelCase {{/if}} {{#chip_tests_item_response_parameters}} {{#if saveAs}} -{{asObjectiveCBasicType type is_mutable=true}} {{saveAs}}; +{{asObjectiveCType type ../cluster}} {{saveAs}}; {{/if}} {{/chip_tests_item_response_parameters}} @@ -173,13 +173,17 @@ ResponseHandler {{> subscribeDataCallback}} = nil; {{#if (isLiteralNull expectedConstraints.notValue)}} XCTAssertFalse(actualValue == nil); {{else}} - if (actualValue != nil) { - {{#if (isString type)}} + {{#if (chip_tests_variables_has expectedConstraints.notValue)}} XCTAssertNotEqualObjects(actualValue, {{expectedConstraints.notValue}}); - {{else}} - XCTAssertNotEqual([actualValue {{asObjectiveCNumberType "" type true}}Value], {{asTypedLiteral expectedConstraints.notValue type}}); - {{/if}} - } + {{else}} + if (actualValue != nil) { + {{#if (isString type)}} + XCTAssertNotEqualObjects(actualValue, {{expectedConstraints.notValue}}); + {{else}} + XCTAssertNotEqual([actualValue {{asObjectiveCNumberType "" type true}}Value], {{asTypedLiteral expectedConstraints.notValue type}}); + {{/if}} + } + {{/if}} {{/if}} } {{/if}} @@ -187,13 +191,7 @@ ResponseHandler {{> subscribeDataCallback}} = nil; {{#if saveAs}} { {{> actualValue}} - {{#if (isOctetString type)}} - {{saveAs}} = [NSMutableData dataWithData:actualValue]; - {{else if (isCharString type)}} - {{saveAs}} = [NSMutableString stringWithString:actualValue]; - {{else}} - {{saveAs}} = [actualValue {{asObjectiveCNumberType "" type true}}Value]; - {{/if}} + {{saveAs}} = actualValue; } {{/if}} {{/chip_tests_item_response_parameters}} diff --git a/src/darwin/Framework/CHIP/templates/partials/test_value.zapt b/src/darwin/Framework/CHIP/templates/partials/test_value.zapt index 2e022ced5e50f8..54bc6a62846de2 100644 --- a/src/darwin/Framework/CHIP/templates/partials/test_value.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/test_value.zapt @@ -28,11 +28,7 @@ {{/zcl_struct_items_by_struct_name}} {{else if (chip_tests_variables_has definedValue)}} - {{#if (isString type)}} {{target}} = [{{definedValue}} copy]; - {{else}} - {{target}} = [NSNumber numberWith{{asObjectiveCNumberType definedValue type false}}:{{definedValue}}]; - {{/if}} {{else if (isCharString type)}} {{target}} = @"{{definedValue}}"; {{else if (isOctetString type)}} diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index e9bbbb602a0542..1b16562ed2f6b4 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -13716,7 +13716,7 @@ - (void)testSendClusterTest_TC_MC_8_1_000000_WaitForCommissionee WaitForCommissionee(expectation, queue); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint8_t currentTarget; +NSNumber * _Nonnull currentTarget; - (void)testSendClusterTest_TC_MC_8_1_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentTarget attribute"]; @@ -13733,7 +13733,7 @@ - (void)testSendClusterTest_TC_MC_8_1_000001_ReadAttribute { id actualValue = value; - currentTarget = [actualValue unsignedCharValue]; + currentTarget = actualValue; } [expectation fulfill]; @@ -37458,7 +37458,7 @@ - (void)testSendClusterTestSaveAs_000000_WaitForCommissionee WaitForCommissionee(expectation, queue); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint8_t TestAddArgumentDefaultValue; +NSNumber * _Nonnull TestAddArgumentDefaultValue; - (void)testSendClusterTestSaveAs_000001_TestAddArguments { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Test Add Arguments Command"]; @@ -37484,7 +37484,7 @@ - (void)testSendClusterTestSaveAs_000001_TestAddArguments } { id actualValue = values.returnValue; - TestAddArgumentDefaultValue = [actualValue unsignedCharValue]; + TestAddArgumentDefaultValue = actualValue; } [expectation fulfill]; @@ -37513,7 +37513,7 @@ - (void)testSendClusterTestSaveAs_000002_TestAddArguments { id actualValue = values.returnValue; - XCTAssertEqual([actualValue unsignedCharValue], TestAddArgumentDefaultValue); + XCTAssertEqualObjects(actualValue, TestAddArgumentDefaultValue); } [expectation fulfill]; @@ -37532,7 +37532,7 @@ - (void)testSendClusterTestSaveAs_000003_TestAddArguments __auto_type * params = [[CHIPTestClusterClusterTestAddArgumentsParams alloc] init]; params.arg1 = [NSNumber numberWithUnsignedChar:3]; - params.arg2 = [NSNumber numberWithUnsignedChar:TestAddArgumentDefaultValue]; + params.arg2 = [TestAddArgumentDefaultValue copy]; [cluster testAddArgumentsWithParams:params completionHandler:^( CHIPTestClusterClusterTestAddArgumentsResponseParams * _Nullable values, NSError * _Nullable err) { @@ -37542,9 +37542,7 @@ - (void)testSendClusterTestSaveAs_000003_TestAddArguments { id actualValue = values.returnValue; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], TestAddArgumentDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, TestAddArgumentDefaultValue); } [expectation fulfill]; @@ -37552,7 +37550,7 @@ - (void)testSendClusterTestSaveAs_000003_TestAddArguments [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -bool readAttributeBooleanDefaultValue; +NSNumber * _Nonnull readAttributeBooleanDefaultValue; - (void)testSendClusterTestSaveAs_000004_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BOOLEAN Default Value"]; @@ -37573,7 +37571,7 @@ - (void)testSendClusterTestSaveAs_000004_ReadAttribute } { id actualValue = value; - readAttributeBooleanDefaultValue = [actualValue boolValue]; + readAttributeBooleanDefaultValue = actualValue; } [expectation fulfill]; @@ -37619,9 +37617,7 @@ - (void)testSendClusterTestSaveAs_000006_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue boolValue], readAttributeBooleanDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeBooleanDefaultValue); } [expectation fulfill]; @@ -37639,7 +37635,7 @@ - (void)testSendClusterTestSaveAs_000007_WriteAttribute XCTAssertNotNil(cluster); id booleanArgument; - booleanArgument = [NSNumber numberWithBool:readAttributeBooleanDefaultValue]; + booleanArgument = [readAttributeBooleanDefaultValue copy]; [cluster writeAttributeBooleanWithValue:booleanArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute BOOLEAN DefaultValue Error: %@", err); @@ -37667,7 +37663,7 @@ - (void)testSendClusterTestSaveAs_000008_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue boolValue], readAttributeBooleanDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeBooleanDefaultValue); } [expectation fulfill]; @@ -37675,7 +37671,7 @@ - (void)testSendClusterTestSaveAs_000008_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint8_t readAttributeBitmap8DefaultValue; +NSNumber * _Nonnull readAttributeBitmap8DefaultValue; - (void)testSendClusterTestSaveAs_000009_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP8 Default Value"]; @@ -37696,7 +37692,7 @@ - (void)testSendClusterTestSaveAs_000009_ReadAttribute } { id actualValue = value; - readAttributeBitmap8DefaultValue = [actualValue unsignedCharValue]; + readAttributeBitmap8DefaultValue = actualValue; } [expectation fulfill]; @@ -37742,9 +37738,7 @@ - (void)testSendClusterTestSaveAs_000011_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], readAttributeBitmap8DefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeBitmap8DefaultValue); } [expectation fulfill]; @@ -37762,7 +37756,7 @@ - (void)testSendClusterTestSaveAs_000012_WriteAttribute XCTAssertNotNil(cluster); id bitmap8Argument; - bitmap8Argument = [NSNumber numberWithUnsignedChar:readAttributeBitmap8DefaultValue]; + bitmap8Argument = [readAttributeBitmap8DefaultValue copy]; [cluster writeAttributeBitmap8WithValue:bitmap8Argument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute BITMAP8 Default Value Error: %@", err); @@ -37790,7 +37784,7 @@ - (void)testSendClusterTestSaveAs_000013_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], readAttributeBitmap8DefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeBitmap8DefaultValue); } [expectation fulfill]; @@ -37798,7 +37792,7 @@ - (void)testSendClusterTestSaveAs_000013_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint16_t readAttributeBitmap16DefaultValue; +NSNumber * _Nonnull readAttributeBitmap16DefaultValue; - (void)testSendClusterTestSaveAs_000014_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP16 Default Value"]; @@ -37819,7 +37813,7 @@ - (void)testSendClusterTestSaveAs_000014_ReadAttribute } { id actualValue = value; - readAttributeBitmap16DefaultValue = [actualValue unsignedShortValue]; + readAttributeBitmap16DefaultValue = actualValue; } [expectation fulfill]; @@ -37865,9 +37859,7 @@ - (void)testSendClusterTestSaveAs_000016_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], readAttributeBitmap16DefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeBitmap16DefaultValue); } [expectation fulfill]; @@ -37885,7 +37877,7 @@ - (void)testSendClusterTestSaveAs_000017_WriteAttribute XCTAssertNotNil(cluster); id bitmap16Argument; - bitmap16Argument = [NSNumber numberWithUnsignedShort:readAttributeBitmap16DefaultValue]; + bitmap16Argument = [readAttributeBitmap16DefaultValue copy]; [cluster writeAttributeBitmap16WithValue:bitmap16Argument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute BITMAP16 Default Value Error: %@", err); @@ -37913,7 +37905,7 @@ - (void)testSendClusterTestSaveAs_000018_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], readAttributeBitmap16DefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeBitmap16DefaultValue); } [expectation fulfill]; @@ -37921,7 +37913,7 @@ - (void)testSendClusterTestSaveAs_000018_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint32_t readAttributeBitmap32DefaultValue; +NSNumber * _Nonnull readAttributeBitmap32DefaultValue; - (void)testSendClusterTestSaveAs_000019_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP32 Default Value"]; @@ -37942,7 +37934,7 @@ - (void)testSendClusterTestSaveAs_000019_ReadAttribute } { id actualValue = value; - readAttributeBitmap32DefaultValue = [actualValue unsignedIntValue]; + readAttributeBitmap32DefaultValue = actualValue; } [expectation fulfill]; @@ -37988,9 +37980,7 @@ - (void)testSendClusterTestSaveAs_000021_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedIntValue], readAttributeBitmap32DefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeBitmap32DefaultValue); } [expectation fulfill]; @@ -38008,7 +37998,7 @@ - (void)testSendClusterTestSaveAs_000022_WriteAttribute XCTAssertNotNil(cluster); id bitmap32Argument; - bitmap32Argument = [NSNumber numberWithUnsignedInt:readAttributeBitmap32DefaultValue]; + bitmap32Argument = [readAttributeBitmap32DefaultValue copy]; [cluster writeAttributeBitmap32WithValue:bitmap32Argument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute BITMAP32 Default Value Error: %@", err); @@ -38036,7 +38026,7 @@ - (void)testSendClusterTestSaveAs_000023_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], readAttributeBitmap32DefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeBitmap32DefaultValue); } [expectation fulfill]; @@ -38044,7 +38034,7 @@ - (void)testSendClusterTestSaveAs_000023_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint64_t readAttributeBitmap64DefaultValue; +NSNumber * _Nonnull readAttributeBitmap64DefaultValue; - (void)testSendClusterTestSaveAs_000024_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute BITMAP64 Default Value"]; @@ -38065,7 +38055,7 @@ - (void)testSendClusterTestSaveAs_000024_ReadAttribute } { id actualValue = value; - readAttributeBitmap64DefaultValue = [actualValue unsignedLongLongValue]; + readAttributeBitmap64DefaultValue = actualValue; } [expectation fulfill]; @@ -38111,9 +38101,7 @@ - (void)testSendClusterTestSaveAs_000026_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedLongLongValue], readAttributeBitmap64DefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeBitmap64DefaultValue); } [expectation fulfill]; @@ -38131,7 +38119,7 @@ - (void)testSendClusterTestSaveAs_000027_WriteAttribute XCTAssertNotNil(cluster); id bitmap64Argument; - bitmap64Argument = [NSNumber numberWithUnsignedLongLong:readAttributeBitmap64DefaultValue]; + bitmap64Argument = [readAttributeBitmap64DefaultValue copy]; [cluster writeAttributeBitmap64WithValue:bitmap64Argument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute BITMAP64 Default Value Error: %@", err); @@ -38159,7 +38147,7 @@ - (void)testSendClusterTestSaveAs_000028_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], readAttributeBitmap64DefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeBitmap64DefaultValue); } [expectation fulfill]; @@ -38167,7 +38155,7 @@ - (void)testSendClusterTestSaveAs_000028_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint8_t readAttributeInt8uDefaultValue; +NSNumber * _Nonnull readAttributeInt8uDefaultValue; - (void)testSendClusterTestSaveAs_000029_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8U Default Value"]; @@ -38188,7 +38176,7 @@ - (void)testSendClusterTestSaveAs_000029_ReadAttribute } { id actualValue = value; - readAttributeInt8uDefaultValue = [actualValue unsignedCharValue]; + readAttributeInt8uDefaultValue = actualValue; } [expectation fulfill]; @@ -38234,9 +38222,7 @@ - (void)testSendClusterTestSaveAs_000031_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], readAttributeInt8uDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeInt8uDefaultValue); } [expectation fulfill]; @@ -38254,7 +38240,7 @@ - (void)testSendClusterTestSaveAs_000032_WriteAttribute XCTAssertNotNil(cluster); id int8uArgument; - int8uArgument = [NSNumber numberWithUnsignedChar:readAttributeInt8uDefaultValue]; + int8uArgument = [readAttributeInt8uDefaultValue copy]; [cluster writeAttributeInt8uWithValue:int8uArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute INT8U Default Value Error: %@", err); @@ -38282,7 +38268,7 @@ - (void)testSendClusterTestSaveAs_000033_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], readAttributeInt8uDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeInt8uDefaultValue); } [expectation fulfill]; @@ -38290,7 +38276,7 @@ - (void)testSendClusterTestSaveAs_000033_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint16_t readAttributeInt16uDefaultValue; +NSNumber * _Nonnull readAttributeInt16uDefaultValue; - (void)testSendClusterTestSaveAs_000034_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16U Default Value"]; @@ -38311,7 +38297,7 @@ - (void)testSendClusterTestSaveAs_000034_ReadAttribute } { id actualValue = value; - readAttributeInt16uDefaultValue = [actualValue unsignedShortValue]; + readAttributeInt16uDefaultValue = actualValue; } [expectation fulfill]; @@ -38357,9 +38343,7 @@ - (void)testSendClusterTestSaveAs_000036_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], readAttributeInt16uDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeInt16uDefaultValue); } [expectation fulfill]; @@ -38377,7 +38361,7 @@ - (void)testSendClusterTestSaveAs_000037_WriteAttribute XCTAssertNotNil(cluster); id int16uArgument; - int16uArgument = [NSNumber numberWithUnsignedShort:readAttributeInt16uDefaultValue]; + int16uArgument = [readAttributeInt16uDefaultValue copy]; [cluster writeAttributeInt16uWithValue:int16uArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute INT16U Default Value Error: %@", err); @@ -38405,7 +38389,7 @@ - (void)testSendClusterTestSaveAs_000038_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], readAttributeInt16uDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeInt16uDefaultValue); } [expectation fulfill]; @@ -38413,7 +38397,7 @@ - (void)testSendClusterTestSaveAs_000038_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint32_t readAttributeInt32uDefaultValue; +NSNumber * _Nonnull readAttributeInt32uDefaultValue; - (void)testSendClusterTestSaveAs_000039_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32U Default Value"]; @@ -38434,7 +38418,7 @@ - (void)testSendClusterTestSaveAs_000039_ReadAttribute } { id actualValue = value; - readAttributeInt32uDefaultValue = [actualValue unsignedIntValue]; + readAttributeInt32uDefaultValue = actualValue; } [expectation fulfill]; @@ -38480,9 +38464,7 @@ - (void)testSendClusterTestSaveAs_000041_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedIntValue], readAttributeInt32uDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeInt32uDefaultValue); } [expectation fulfill]; @@ -38500,7 +38482,7 @@ - (void)testSendClusterTestSaveAs_000042_WriteAttribute XCTAssertNotNil(cluster); id int32uArgument; - int32uArgument = [NSNumber numberWithUnsignedInt:readAttributeInt32uDefaultValue]; + int32uArgument = [readAttributeInt32uDefaultValue copy]; [cluster writeAttributeInt32uWithValue:int32uArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute INT32U Default Value Error: %@", err); @@ -38528,7 +38510,7 @@ - (void)testSendClusterTestSaveAs_000043_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], readAttributeInt32uDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeInt32uDefaultValue); } [expectation fulfill]; @@ -38536,7 +38518,7 @@ - (void)testSendClusterTestSaveAs_000043_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint64_t readAttributeInt64uDefaultValue; +NSNumber * _Nonnull readAttributeInt64uDefaultValue; - (void)testSendClusterTestSaveAs_000044_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64U Default Value"]; @@ -38557,7 +38539,7 @@ - (void)testSendClusterTestSaveAs_000044_ReadAttribute } { id actualValue = value; - readAttributeInt64uDefaultValue = [actualValue unsignedLongLongValue]; + readAttributeInt64uDefaultValue = actualValue; } [expectation fulfill]; @@ -38603,9 +38585,7 @@ - (void)testSendClusterTestSaveAs_000046_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedLongLongValue], readAttributeInt64uDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeInt64uDefaultValue); } [expectation fulfill]; @@ -38623,7 +38603,7 @@ - (void)testSendClusterTestSaveAs_000047_WriteAttribute XCTAssertNotNil(cluster); id int64uArgument; - int64uArgument = [NSNumber numberWithUnsignedLongLong:readAttributeInt64uDefaultValue]; + int64uArgument = [readAttributeInt64uDefaultValue copy]; [cluster writeAttributeInt64uWithValue:int64uArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute INT64U Default Value Error: %@", err); @@ -38651,7 +38631,7 @@ - (void)testSendClusterTestSaveAs_000048_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], readAttributeInt64uDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeInt64uDefaultValue); } [expectation fulfill]; @@ -38659,7 +38639,7 @@ - (void)testSendClusterTestSaveAs_000048_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -int8_t readAttributeInt8sDefaultValue; +NSNumber * _Nonnull readAttributeInt8sDefaultValue; - (void)testSendClusterTestSaveAs_000049_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT8S Default Value"]; @@ -38680,7 +38660,7 @@ - (void)testSendClusterTestSaveAs_000049_ReadAttribute } { id actualValue = value; - readAttributeInt8sDefaultValue = [actualValue charValue]; + readAttributeInt8sDefaultValue = actualValue; } [expectation fulfill]; @@ -38726,9 +38706,7 @@ - (void)testSendClusterTestSaveAs_000051_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue charValue], readAttributeInt8sDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeInt8sDefaultValue); } [expectation fulfill]; @@ -38746,7 +38724,7 @@ - (void)testSendClusterTestSaveAs_000052_WriteAttribute XCTAssertNotNil(cluster); id int8sArgument; - int8sArgument = [NSNumber numberWithChar:readAttributeInt8sDefaultValue]; + int8sArgument = [readAttributeInt8sDefaultValue copy]; [cluster writeAttributeInt8sWithValue:int8sArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute INT8S Default Value Error: %@", err); @@ -38774,7 +38752,7 @@ - (void)testSendClusterTestSaveAs_000053_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue charValue], readAttributeInt8sDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeInt8sDefaultValue); } [expectation fulfill]; @@ -38782,7 +38760,7 @@ - (void)testSendClusterTestSaveAs_000053_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -int16_t readAttributeInt16sDefaultValue; +NSNumber * _Nonnull readAttributeInt16sDefaultValue; - (void)testSendClusterTestSaveAs_000054_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT16S Default Value"]; @@ -38803,7 +38781,7 @@ - (void)testSendClusterTestSaveAs_000054_ReadAttribute } { id actualValue = value; - readAttributeInt16sDefaultValue = [actualValue shortValue]; + readAttributeInt16sDefaultValue = actualValue; } [expectation fulfill]; @@ -38849,9 +38827,7 @@ - (void)testSendClusterTestSaveAs_000056_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue shortValue], readAttributeInt16sDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeInt16sDefaultValue); } [expectation fulfill]; @@ -38869,7 +38845,7 @@ - (void)testSendClusterTestSaveAs_000057_WriteAttribute XCTAssertNotNil(cluster); id int16sArgument; - int16sArgument = [NSNumber numberWithShort:readAttributeInt16sDefaultValue]; + int16sArgument = [readAttributeInt16sDefaultValue copy]; [cluster writeAttributeInt16sWithValue:int16sArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute INT16S Default Value Error: %@", err); @@ -38897,7 +38873,7 @@ - (void)testSendClusterTestSaveAs_000058_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue shortValue], readAttributeInt16sDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeInt16sDefaultValue); } [expectation fulfill]; @@ -38905,7 +38881,7 @@ - (void)testSendClusterTestSaveAs_000058_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -int32_t readAttributeInt32sDefaultValue; +NSNumber * _Nonnull readAttributeInt32sDefaultValue; - (void)testSendClusterTestSaveAs_000059_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT32S Default Value"]; @@ -38926,7 +38902,7 @@ - (void)testSendClusterTestSaveAs_000059_ReadAttribute } { id actualValue = value; - readAttributeInt32sDefaultValue = [actualValue intValue]; + readAttributeInt32sDefaultValue = actualValue; } [expectation fulfill]; @@ -38972,9 +38948,7 @@ - (void)testSendClusterTestSaveAs_000061_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue intValue], readAttributeInt32sDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeInt32sDefaultValue); } [expectation fulfill]; @@ -38992,7 +38966,7 @@ - (void)testSendClusterTestSaveAs_000062_WriteAttribute XCTAssertNotNil(cluster); id int32sArgument; - int32sArgument = [NSNumber numberWithInt:readAttributeInt32sDefaultValue]; + int32sArgument = [readAttributeInt32sDefaultValue copy]; [cluster writeAttributeInt32sWithValue:int32sArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute INT32S Default Value Error: %@", err); @@ -39020,7 +38994,7 @@ - (void)testSendClusterTestSaveAs_000063_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue intValue], readAttributeInt32sDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeInt32sDefaultValue); } [expectation fulfill]; @@ -39028,7 +39002,7 @@ - (void)testSendClusterTestSaveAs_000063_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -int64_t readAttributeInt64sDefaultValue; +NSNumber * _Nonnull readAttributeInt64sDefaultValue; - (void)testSendClusterTestSaveAs_000064_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute INT64S Default Value"]; @@ -39049,7 +39023,7 @@ - (void)testSendClusterTestSaveAs_000064_ReadAttribute } { id actualValue = value; - readAttributeInt64sDefaultValue = [actualValue longLongValue]; + readAttributeInt64sDefaultValue = actualValue; } [expectation fulfill]; @@ -39095,9 +39069,7 @@ - (void)testSendClusterTestSaveAs_000066_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue longLongValue], readAttributeInt64sDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeInt64sDefaultValue); } [expectation fulfill]; @@ -39115,7 +39087,7 @@ - (void)testSendClusterTestSaveAs_000067_WriteAttribute XCTAssertNotNil(cluster); id int64sArgument; - int64sArgument = [NSNumber numberWithLongLong:readAttributeInt64sDefaultValue]; + int64sArgument = [readAttributeInt64sDefaultValue copy]; [cluster writeAttributeInt64sWithValue:int64sArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute INT64S Default Value Error: %@", err); @@ -39143,7 +39115,7 @@ - (void)testSendClusterTestSaveAs_000068_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue longLongValue], readAttributeInt64sDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeInt64sDefaultValue); } [expectation fulfill]; @@ -39151,7 +39123,7 @@ - (void)testSendClusterTestSaveAs_000068_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint8_t readAttributeEnum8DefaultValue; +NSNumber * _Nonnull readAttributeEnum8DefaultValue; - (void)testSendClusterTestSaveAs_000069_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM8 Default Value"]; @@ -39172,7 +39144,7 @@ - (void)testSendClusterTestSaveAs_000069_ReadAttribute } { id actualValue = value; - readAttributeEnum8DefaultValue = [actualValue unsignedCharValue]; + readAttributeEnum8DefaultValue = actualValue; } [expectation fulfill]; @@ -39218,9 +39190,7 @@ - (void)testSendClusterTestSaveAs_000071_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], readAttributeEnum8DefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeEnum8DefaultValue); } [expectation fulfill]; @@ -39238,7 +39208,7 @@ - (void)testSendClusterTestSaveAs_000072_WriteAttribute XCTAssertNotNil(cluster); id enum8Argument; - enum8Argument = [NSNumber numberWithUnsignedChar:readAttributeEnum8DefaultValue]; + enum8Argument = [readAttributeEnum8DefaultValue copy]; [cluster writeAttributeEnum8WithValue:enum8Argument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute ENUM8 Default Value Error: %@", err); @@ -39266,7 +39236,7 @@ - (void)testSendClusterTestSaveAs_000073_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], readAttributeEnum8DefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeEnum8DefaultValue); } [expectation fulfill]; @@ -39274,7 +39244,7 @@ - (void)testSendClusterTestSaveAs_000073_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint16_t readAttributeEnum16DefaultValue; +NSNumber * _Nonnull readAttributeEnum16DefaultValue; - (void)testSendClusterTestSaveAs_000074_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute ENUM16 Default Value"]; @@ -39295,7 +39265,7 @@ - (void)testSendClusterTestSaveAs_000074_ReadAttribute } { id actualValue = value; - readAttributeEnum16DefaultValue = [actualValue unsignedShortValue]; + readAttributeEnum16DefaultValue = actualValue; } [expectation fulfill]; @@ -39341,9 +39311,7 @@ - (void)testSendClusterTestSaveAs_000076_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], readAttributeEnum16DefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeEnum16DefaultValue); } [expectation fulfill]; @@ -39361,7 +39329,7 @@ - (void)testSendClusterTestSaveAs_000077_WriteAttribute XCTAssertNotNil(cluster); id enum16Argument; - enum16Argument = [NSNumber numberWithUnsignedShort:readAttributeEnum16DefaultValue]; + enum16Argument = [readAttributeEnum16DefaultValue copy]; [cluster writeAttributeEnum16WithValue:enum16Argument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute ENUM16 Default Value Error: %@", err); @@ -39389,7 +39357,7 @@ - (void)testSendClusterTestSaveAs_000078_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], readAttributeEnum16DefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeEnum16DefaultValue); } [expectation fulfill]; @@ -39397,7 +39365,7 @@ - (void)testSendClusterTestSaveAs_000078_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint64_t readAttributeEpochUSDefaultValue; +NSNumber * _Nonnull readAttributeEpochUSDefaultValue; - (void)testSendClusterTestSaveAs_000079_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_US Default Value"]; @@ -39418,7 +39386,7 @@ - (void)testSendClusterTestSaveAs_000079_ReadAttribute } { id actualValue = value; - readAttributeEpochUSDefaultValue = [actualValue unsignedLongLongValue]; + readAttributeEpochUSDefaultValue = actualValue; } [expectation fulfill]; @@ -39464,9 +39432,7 @@ - (void)testSendClusterTestSaveAs_000081_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedLongLongValue], readAttributeEpochUSDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeEpochUSDefaultValue); } [expectation fulfill]; @@ -39484,7 +39450,7 @@ - (void)testSendClusterTestSaveAs_000082_WriteAttribute XCTAssertNotNil(cluster); id epochUsArgument; - epochUsArgument = [NSNumber numberWithUnsignedLongLong:readAttributeEpochUSDefaultValue]; + epochUsArgument = [readAttributeEpochUSDefaultValue copy]; [cluster writeAttributeEpochUsWithValue:epochUsArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute EPOCH_US Default Value Error: %@", err); @@ -39512,7 +39478,7 @@ - (void)testSendClusterTestSaveAs_000083_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], readAttributeEpochUSDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeEpochUSDefaultValue); } [expectation fulfill]; @@ -39520,7 +39486,7 @@ - (void)testSendClusterTestSaveAs_000083_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint32_t readAttributeEpochSDefaultValue; +NSNumber * _Nonnull readAttributeEpochSDefaultValue; - (void)testSendClusterTestSaveAs_000084_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute EPOCH_S Default Value"]; @@ -39541,7 +39507,7 @@ - (void)testSendClusterTestSaveAs_000084_ReadAttribute } { id actualValue = value; - readAttributeEpochSDefaultValue = [actualValue unsignedIntValue]; + readAttributeEpochSDefaultValue = actualValue; } [expectation fulfill]; @@ -39587,9 +39553,7 @@ - (void)testSendClusterTestSaveAs_000086_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedIntValue], readAttributeEpochSDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeEpochSDefaultValue); } [expectation fulfill]; @@ -39607,7 +39571,7 @@ - (void)testSendClusterTestSaveAs_000087_WriteAttribute XCTAssertNotNil(cluster); id epochSArgument; - epochSArgument = [NSNumber numberWithUnsignedInt:readAttributeEpochSDefaultValue]; + epochSArgument = [readAttributeEpochSDefaultValue copy]; [cluster writeAttributeEpochSWithValue:epochSArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute EPOCH_S Default Value Error: %@", err); @@ -39635,7 +39599,7 @@ - (void)testSendClusterTestSaveAs_000088_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedIntValue], readAttributeEpochSDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeEpochSDefaultValue); } [expectation fulfill]; @@ -39643,7 +39607,7 @@ - (void)testSendClusterTestSaveAs_000088_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -uint16_t readAttributeVendorIdDefaultValue; +NSNumber * _Nonnull readAttributeVendorIdDefaultValue; - (void)testSendClusterTestSaveAs_000089_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute vendor_id Default Value"]; @@ -39664,7 +39628,7 @@ - (void)testSendClusterTestSaveAs_000089_ReadAttribute } { id actualValue = value; - readAttributeVendorIdDefaultValue = [actualValue unsignedShortValue]; + readAttributeVendorIdDefaultValue = actualValue; } [expectation fulfill]; @@ -39710,9 +39674,7 @@ - (void)testSendClusterTestSaveAs_000091_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedShortValue], readAttributeVendorIdDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeVendorIdDefaultValue); } [expectation fulfill]; @@ -39730,7 +39692,7 @@ - (void)testSendClusterTestSaveAs_000092_WriteAttribute XCTAssertNotNil(cluster); id vendorIdArgument; - vendorIdArgument = [NSNumber numberWithUnsignedShort:readAttributeVendorIdDefaultValue]; + vendorIdArgument = [readAttributeVendorIdDefaultValue copy]; [cluster writeAttributeVendorIdWithValue:vendorIdArgument completionHandler:^(NSError * _Nullable err) { NSLog(@"Write attribute vendor_id Default Value Error: %@", err); @@ -39758,7 +39720,7 @@ - (void)testSendClusterTestSaveAs_000093_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], readAttributeVendorIdDefaultValue); + XCTAssertEqualObjects(actualValue, readAttributeVendorIdDefaultValue); } [expectation fulfill]; @@ -39766,7 +39728,7 @@ - (void)testSendClusterTestSaveAs_000093_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -NSMutableString * readAttributeCharStringDefaultValue; +NSString * _Nonnull readAttributeCharStringDefaultValue; - (void)testSendClusterTestSaveAs_000094_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute char_string Default Value"]; @@ -39787,7 +39749,7 @@ - (void)testSendClusterTestSaveAs_000094_ReadAttribute } { id actualValue = value; - readAttributeCharStringDefaultValue = [NSMutableString stringWithString:actualValue]; + readAttributeCharStringDefaultValue = actualValue; } [expectation fulfill]; @@ -39842,7 +39804,7 @@ - (void)testSendClusterTestSaveAs_000096_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -NSMutableString * readAttributeCharStringNotDefaultValue; +NSString * _Nonnull readAttributeCharStringNotDefaultValue; - (void)testSendClusterTestSaveAs_000097_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute char_string Not Default Value"]; @@ -39863,13 +39825,11 @@ - (void)testSendClusterTestSaveAs_000097_ReadAttribute } { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqualObjects(actualValue, readAttributeCharStringDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeCharStringDefaultValue); } { id actualValue = value; - readAttributeCharStringNotDefaultValue = [NSMutableString stringWithString:actualValue]; + readAttributeCharStringNotDefaultValue = actualValue; } [expectation fulfill]; @@ -39898,9 +39858,7 @@ - (void)testSendClusterTestSaveAs_000098_ReadAttribute } { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqualObjects(actualValue, readAttributeCharStringDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeCharStringDefaultValue); } [expectation fulfill]; @@ -39978,7 +39936,7 @@ - (void)testSendClusterTestSaveAs_000101_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -NSMutableData * readAttributeOctetStringDefaultValue; +NSData * _Nonnull readAttributeOctetStringDefaultValue; - (void)testSendClusterTestSaveAs_000102_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute octet_string Default Value"]; @@ -39999,7 +39957,7 @@ - (void)testSendClusterTestSaveAs_000102_ReadAttribute } { id actualValue = value; - readAttributeOctetStringDefaultValue = [NSMutableData dataWithData:actualValue]; + readAttributeOctetStringDefaultValue = actualValue; } [expectation fulfill]; @@ -40054,7 +40012,7 @@ - (void)testSendClusterTestSaveAs_000104_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -NSMutableData * readAttributeOctetStringNotDefaultValue; +NSData * _Nonnull readAttributeOctetStringNotDefaultValue; - (void)testSendClusterTestSaveAs_000105_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read attribute octet_string Not Default Value"]; @@ -40075,13 +40033,11 @@ - (void)testSendClusterTestSaveAs_000105_ReadAttribute } { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqualObjects(actualValue, readAttributeOctetStringDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeOctetStringDefaultValue); } { id actualValue = value; - readAttributeOctetStringNotDefaultValue = [NSMutableData dataWithData:actualValue]; + readAttributeOctetStringNotDefaultValue = actualValue; } [expectation fulfill]; @@ -40110,9 +40066,7 @@ - (void)testSendClusterTestSaveAs_000106_ReadAttribute } { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqualObjects(actualValue, readAttributeOctetStringDefaultValue); - } + XCTAssertNotEqualObjects(actualValue, readAttributeOctetStringDefaultValue); } [expectation fulfill];