@@ -102,6 +102,57 @@ class {{filename}}: public TestCommand
102
102
{{/chip_tests_item_response_parameters}}
103
103
{{/chip_tests_items}}
104
104
105
+ void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override
106
+ {
107
+ bool isExpectedDnssdResult = false;
108
+ {{#chip_tests_items}}
109
+ {{#if (isStrEqual cluster "DiscoveryCommands")}}
110
+ if ((mTestIndex - 1) == {{index}})
111
+ {
112
+ isExpectedDnssdResult = true;
113
+ {{#chip_tests_item_response_parameters}}
114
+ {{#*inline "itemValue"}}nodeData.{{name}}{{#if isOptional}}.Value(){{/if}}{{/inline}}
115
+ {{~#if hasExpectedValue}}
116
+ {{#if isOptional}}VerifyOrReturn(CheckValuePresent("{{name}}", nodeData.{{name}}));{{/if}}
117
+ VerifyOrReturn(CheckValue("{{name}}", {{>itemValue}},
118
+ {{#if (chip_tests_config_has expectedValue)}}
119
+ m{{asUpperCamelCase expectedValue}}.HasValue() ? m{{asUpperCamelCase expectedValue}}.Value() : {{asTypedLiteral (chip_tests_config_get_default_value expectedValue) (chip_tests_config_get_type expectedValue)}}
120
+ {{else}}
121
+ {{expectedValue}}
122
+ {{/if}}
123
+ ));
124
+ {{/if}}
125
+ {{#if hasExpectedConstraints}}
126
+ {{#if isOptional}}VerifyOrReturn(CheckValuePresent("{{name}}", nodeData.{{name}}));{{/if}}
127
+ {{#if (hasProperty expectedConstraints "minLength")}}VerifyOrReturn(CheckConstraintMinLength("{{name}}", {{>itemValue}}.size(), {{expectedConstraints.minLength}}));{{/if}}
128
+ {{#if (hasProperty expectedConstraints "maxLength")}}VerifyOrReturn(CheckConstraintMaxLength("{{name}}", {{>itemValue}}.size(), {{expectedConstraints.maxLength}}));{{/if}}
129
+ {{#if (hasProperty expectedConstraints "minValue")}}VerifyOrReturn(CheckConstraintMinValue<{{chipType}}>("{{name}}", {{>itemValue}}, {{asTypedLiteral expectedConstraints.minValue type}}));{{/if}}
130
+ {{#if (hasProperty expectedConstraints "maxValue")}}VerifyOrReturn(CheckConstraintMaxValue<{{chipType}}>("{{name}}", {{>itemValue}}, {{asTypedLiteral expectedConstraints.maxValue type}}));{{/if}}
131
+ {{#if (hasProperty expectedConstraints "notValue")}}VerifyOrReturn(CheckConstraintNotValue("{{name}}", {{>itemValue}}, {{asTypedLiteral expectedConstraints.notValue type}}));{{/if}}
132
+ {{/if}}
133
+
134
+ {{#if saveAs}}
135
+ {{#if (isString type)}}
136
+ if ({{saveAs}}Buffer != nullptr)
137
+ {
138
+ chip::Platform::MemoryFree({{saveAs}}Buffer);
139
+ }
140
+ {{saveAs}}Buffer = static_cast<{{#if (isOctetString type)}}uint8_t{{else}}char{{/if}} *>(chip::Platform::MemoryAlloc({{>itemValue}}.size()));
141
+ memcpy({{saveAs}}Buffer, {{>itemValue}}.data(), {{>itemValue}}.size());
142
+ {{saveAs}} = {{chipType}}({{saveAs}}Buffer, {{>itemValue}}.size());
143
+ {{else}}
144
+ {{saveAs}} = {{>itemValue}};
145
+ {{/if}}
146
+ {{/if}}
147
+ {{/chip_tests_item_response_parameters}}
148
+ }
149
+ {{/if}}
150
+ {{/chip_tests_items}}
151
+
152
+ VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received"));
153
+ NextTest();
154
+ }
155
+
105
156
{{! Helper around zapTypeToDecodableClusterObjectType that lets us set the
106
157
array/nullable/etc context appropriately.}}
107
158
{{~#*inline "subscribeResponseDataArgument"~}}
@@ -194,7 +245,13 @@ class {{filename}}: public TestCommand
194
245
CHIP_ERROR {{>testCommand}}()
195
246
{
196
247
SetIdentity(kIdentity{{asUpperCamelCase identity}});
197
- return {{command}}({{#chip_tests_item_parameters}}{{#not_first}}, {{/not_first}}{{#if (isString type)}}"{{/if}}{{definedValue}}{{#if (isString type)}}"{{/if}}{{/chip_tests_item_parameters}});
248
+ return {{command}}({{#chip_tests_item_parameters}}{{#not_first}}, {{/not_first}}{{#if (isString type)}}"{{/if~}}
249
+ {{~#if (chip_tests_config_has definedValue)~}}
250
+ m{{asUpperCamelCase definedValue}}.HasValue() ? m{{asUpperCamelCase definedValue}}.Value() : {{asTypedLiteral (chip_tests_config_get_default_value definedValue) (chip_tests_config_get_type definedValue)}}
251
+ {{else}}
252
+ {{definedValue}}
253
+ {{~/if~}}
254
+ {{~#if (isString type)}}"{{/if}}{{/chip_tests_item_parameters}});
198
255
}
199
256
{{else if isWait}}
200
257
CHIP_ERROR {{>testCommand}}()
0 commit comments