| {{#if isOptional}} |
| {{! This just means we expect a non-nil value. Go ahead and check the value, |
| stripping the optionality off. }} |
| {{>check_test_value actual=actual expected=expected cluster=cluster isOptional=false}} |
| {{else if isNullable}} |
| {{#if (isLiteralNull expected)}} |
| VerifyOrReturn(CheckValueNull("{{label}}", {{actual}})); |
| {{else}} |
| {{#if (chip_tests_variables_has expected)}} |
| {{! Expected value is also a nullable. }} |
| if ({{expected}} == nil) { |
| VerifyOrReturn(CheckValueNull("{{label}}", {{actual}})); |
| } else { |
| {{/if}} |
| VerifyOrReturn(CheckValueNonNull("{{label}}", {{actual}})); |
| {{>check_test_value actual=actual expected=expected cluster=cluster isNullable=false}} |
| {{#if (chip_tests_variables_has expected)}} |
| } |
| {{/if}} |
| {{/if}} |
| {{else if isArray}} |
| VerifyOrReturn(CheckValue("{{label}}", [{{actual}} count], static_cast<uint32_t>({{expected.length}}))); |
| {{#each expected}} |
| {{>check_test_value actual=(concat ../actual "[" @index "]") expected=this cluster=../cluster isArray=false type=../type parent=../parent}} |
| {{/each}} |
| {{else}} |
| {{#if_is_struct type}} |
| {{! Iterate over the actual types in the struct, so we pick up the right |
| type/optionality/nullability information for them for our recursive |
| call. }} |
| {{#zcl_struct_items_by_struct_name type}} |
| {{#if (hasProperty ../expected label)}} |
| {{>check_test_value actual=(concat "((MTR" (asUpperCamelCase ../cluster) "Cluster" (asUpperCamelCase ../type) " *)" ../actual ")." (asStructPropertyName label)) expected=(lookup ../expected label) cluster=../cluster}} |
| {{/if}} |
| {{/zcl_struct_items_by_struct_name}} |
| {{! Maybe we should add a check for properties in the expected object (other |
| than "global") that are not present in the struct ? }} |
| {{else}} |
| VerifyOrReturn(CheckValue{{#if (isString type)}}AsString{{/if}}("{{label}}", {{actual}}, |
| {{~#if (chip_tests_variables_has expected)}}{{expected}} |
| {{~else if (chip_tests_config_has expected)}} |
| m{{asUpperCamelCase expected}}.HasValue() ? |
| {{#if (isCharString type)}} |
| [[NSString alloc] initWithBytes:m{{asUpperCamelCase expected}}.Value().data() length:m{{asUpperCamelCase expected}}.Value().size() encoding:NSUTF8StringEncoding] : @"{{chip_tests_config_get_default_value expected}}" |
| {{else if (isOctetString type)}} |
| [NSData dataWithBytes:m{{asUpperCamelCase expected}}.Value().data() length:m{{asUpperCamelCase expected}}.Value().size()] : {{> octetStringValue value=(chip_tests_config_get_default_value expected)}} |
| {{else}} |
| m{{asUpperCamelCase expected}}.Value() : {{asTypedExpressionFromObjectiveC (chip_tests_config_get_default_value expected) type}} |
| {{/if}} |
| {{~else if (isOctetString type)}} |
| {{> octetStringValue value=expected}} |
| {{~else if (isCharString type)}}@"{{expected}}" |
| {{~else}}{{asTypedExpressionFromObjectiveC expected type}} |
| {{~/if}})); |
| {{/if_is_struct}} |
| {{/if}} |