Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make attribute-write yaml tests play nicer with complex types. #11457

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions examples/chip-tool/templates/partials/test_cluster.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,8 @@ class {{filename}}: public TestCommand
{{#if async}}ReturnErrorOnFailure({{else}}return {{/if}}cluster.InvokeCommand<requestType, responseType>(request, this, success, failure){{#if async}}){{/if}};
{{else}}
{{#chip_tests_item_parameters}}
{{chipType}} {{asLowerCamelCase name}}Argument =
{{#if (isOctetString type)}}
chip::ByteSpan(chip::Uint8::from_const_char("{{definedValue}}"), strlen("{{definedValue}}"))
{{else if (isCharString type)}}
chip::CharSpan("{{definedValue}}", strlen("{{definedValue}}"))
{{else}}
{{#if_chip_enum type}}
static_cast<{{chipType}}>({{definedValue}}{{asTypeLiteralSuffix type}})
{{else}}
{{definedValue}}{{asTypeLiteralSuffix type}}
{{/if_chip_enum}}
{{/if}};
{{zapTypeToEncodableClusterObjectType type ns=parent.cluster}} {{asLowerCamelCase name}}Argument;
{{>commandValue ns=parent.cluster ignore=true container=(concat (asLowerCamelCase name) "Argument") definedValue=definedValue}}
bzbarsky-apple marked this conversation as resolved.
Show resolved Hide resolved
{{/chip_tests_item_parameters}}

{{~#*inline "commandName"}}{{asUpperCamelCase commandName}}{{#if isAttribute}}Attribute{{asUpperCamelCase attribute}}{{/if}}{{/inline}}
Expand Down
4 changes: 2 additions & 2 deletions src/app/zap-templates/common/ClusterTestGeneration.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ function chip_tests_item_parameters(options)
const promise = assertCommandOrAttribute(this).then(item => {
if (this.isAttribute && !this.isWriteAttribute) {
if (this.isSubscribeAttribute) {
const minInterval = { name : 'minInterval', type : 'in16u', chipType : 'uint16_t', definedValue : this.minInterval };
const maxInterval = { name : 'maxInterval', type : 'in16u', chipType : 'uint16_t', definedValue : this.maxInterval };
const minInterval = { name : 'minInterval', type : 'int16u', chipType : 'uint16_t', definedValue : this.minInterval };
const maxInterval = { name : 'maxInterval', type : 'int16u', chipType : 'uint16_t', definedValue : this.maxInterval };
return [ minInterval, maxInterval ];
}
return [];
Expand Down
5 changes: 4 additions & 1 deletion src/app/zap-templates/common/ClustersHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,11 @@ function enhancedAttributes(attributes, globalAttributes, types)
type : attribute.type,
size : attribute.size,
isList : attribute.isList,
isArray : attribute.isList,
isNullable : attribute.isNullable,
chipType : attribute.chipType,
chipCallback : attribute.chipCallback
chipCallback : attribute.chipCallback,
label : attribute.name,
};
attribute.arguments = [ argument ];
attribute.response = { arguments : [ argument ] };
Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIPTests/CHIPClustersTests.m

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading