diff --git a/scripts/py_matter_yamltests/matter_yamltests/constraints.py b/scripts/py_matter_yamltests/matter_yamltests/constraints.py index 406287dd497c60..09b0514e46b675 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/constraints.py +++ b/scripts/py_matter_yamltests/matter_yamltests/constraints.py @@ -535,7 +535,8 @@ def _is_double(self, value): class _ConstraintMinLength(BaseConstraint): def __init__(self, context, min_length): - super().__init__(context, types=[str, bytes, list]) + super().__init__(context, types=[ + str, bytes, list], is_null_allowed=True) self._min_length = min_length def check_response(self, value, value_type_name) -> bool: @@ -547,7 +548,8 @@ def get_reason(self, value, value_type_name) -> str: class _ConstraintMaxLength(BaseConstraint): def __init__(self, context, max_length): - super().__init__(context, types=[str, bytes, list]) + super().__init__(context, types=[ + str, bytes, list], is_null_allowed=True) self._max_length = max_length def check_response(self, value, value_type_name) -> bool: diff --git a/src/app/tests/suites/TestConstraints.yaml b/src/app/tests/suites/TestConstraints.yaml index aa1896d7ebd94e..9336cda206d9de 100644 --- a/src/app/tests/suites/TestConstraints.yaml +++ b/src/app/tests/suites/TestConstraints.yaml @@ -359,6 +359,34 @@ tests: arguments: value: "" + # Tests for NULLABLE_CHAR_STRING attribute + + - label: "Write attribute NULLABLE_CHAR_STRING Value" + command: "writeAttribute" + attribute: "nullable_char_string" + arguments: + value: null + + - label: "Read attribute NULLABLE_CHAR_STRING Value MinLength Constraints" + command: "readAttribute" + attribute: "nullable_char_string" + response: + constraints: + minLength: 5 + + - label: "Read attribute NULLABLE_CHAR_STRING Value MaxLength Constraints" + command: "readAttribute" + attribute: "nullable_char_string" + response: + constraints: + maxLength: 20 + + - label: "Write attribute NULLABLE_CHAR_STRING Value Back to Default Value" + command: "writeAttribute" + attribute: "nullable_char_string" + arguments: + value: "" + # Tests for hasValue attribute - label: "Read attribute NULLABLE_INT8U Default Value" diff --git a/src/app/tests/suites/include/ConstraintsChecker.h b/src/app/tests/suites/include/ConstraintsChecker.h index eb52c3b6b6bba5..0811ca85923f83 100644 --- a/src/app/tests/suites/include/ConstraintsChecker.h +++ b/src/app/tests/suites/include/ConstraintsChecker.h @@ -79,12 +79,36 @@ class ConstraintsChecker return CheckConstraintMinLength(itemName, current.size(), expected); } + template + bool CheckConstraintMinLength(const char * itemName, const chip::app::DataModel::Nullable> & current, + uint64_t expected) + { + if (current.IsNull()) + { + return true; + } + + return CheckConstraintMinLength(itemName, current.Value(), expected); + } + template bool CheckConstraintMaxLength(const char * itemName, const chip::Span & current, uint64_t expected) { return CheckConstraintMaxLength(itemName, current.size(), expected); } + template + bool CheckConstraintMaxLength(const char * itemName, const chip::app::DataModel::Nullable> & current, + uint64_t expected) + { + if (current.IsNull()) + { + return true; + } + + return CheckConstraintMaxLength(itemName, current.Value(), expected); + } + template bool CheckConstraintMinLength(const char * itemName, const chip::app::DataModel::DecodableList & current, uint64_t expected) { diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index cb11f6427d4461..676f52894f4490 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -79946,7 +79946,7 @@ class TestClusterComplexTypesSuite : public TestCommand class TestConstraintsSuite : public TestCommand { public: - TestConstraintsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestConstraints", 57, credsIssuerConfig) + TestConstraintsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestConstraints", 61, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -80258,6 +80258,28 @@ class TestConstraintsSuite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value", value, 5)); + } + break; + case 47: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxLength("value", value, 20)); + } + break; + case 48: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 49: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -80266,30 +80288,30 @@ class TestConstraintsSuite : public TestCommand VerifyOrReturn(CheckValue("nullableInt8u.Value()", value.Value(), 0U)); } break; - case 46: + case 50: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 47: + case 51: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); } break; - case 48: + case 52: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 49: + case 53: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); } break; - case 50: + case 54: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 51: + case 55: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; @@ -80299,27 +80321,27 @@ class TestConstraintsSuite : public TestCommand chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); } break; - case 52: + case 56: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 53: + case 57: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); } break; - case 54: + case 58: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 55: + case 59: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); } break; - case 56: + case 60: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; default: @@ -80632,12 +80654,39 @@ class TestConstraintsSuite : public TestCommand chip::NullOptional, chip::NullOptional); } case 45: { - LogStep(45, "Read attribute NULLABLE_INT8U Default Value"); + LogStep(45, "Write attribute NULLABLE_CHAR_STRING Value"); + ListFreer listFreer; + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, + value, chip::NullOptional, chip::NullOptional); + } + case 46: { + LogStep(46, "Read attribute NULLABLE_CHAR_STRING Value MinLength Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, + true, chip::NullOptional); + } + case 47: { + LogStep(47, "Read attribute NULLABLE_CHAR_STRING Value MaxLength Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, + true, chip::NullOptional); + } + case 48: { + LogStep(48, "Write attribute NULLABLE_CHAR_STRING Value Back to Default Value"); + ListFreer listFreer; + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = chip::Span("garbage: not in length on purpose", 0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, + value, chip::NullOptional, chip::NullOptional); + } + case 49: { + LogStep(49, "Read attribute NULLABLE_INT8U Default Value"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, chip::NullOptional); } - case 46: { - LogStep(46, "Write attribute NULLABLE_INT8U with a value"); + case 50: { + LogStep(50, "Write attribute NULLABLE_INT8U with a value"); ListFreer listFreer; chip::app::DataModel::Nullable value; value.SetNonNull(); @@ -80645,26 +80694,26 @@ class TestConstraintsSuite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, value, chip::NullOptional, chip::NullOptional); } - case 47: { - LogStep(47, "Read attribute NULLABLE_INT8U with a value"); + case 51: { + LogStep(51, "Read attribute NULLABLE_INT8U with a value"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, chip::NullOptional); } - case 48: { - LogStep(48, "Write attribute NULLABLE_INT8U without a value"); + case 52: { + LogStep(52, "Write attribute NULLABLE_INT8U without a value"); ListFreer listFreer; chip::app::DataModel::Nullable value; value.SetNull(); return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, value, chip::NullOptional, chip::NullOptional); } - case 49: { - LogStep(49, "Read attribute NULLABLE_INT8U with a value"); + case 53: { + LogStep(53, "Read attribute NULLABLE_INT8U with a value"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, chip::NullOptional); } - case 50: { - LogStep(50, "Write attribute NULLABLE_INT8U back to Default Value"); + case 54: { + LogStep(54, "Write attribute NULLABLE_INT8U back to Default Value"); ListFreer listFreer; chip::app::DataModel::Nullable value; value.SetNonNull(); @@ -80672,13 +80721,13 @@ class TestConstraintsSuite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, value, chip::NullOptional, chip::NullOptional); } - case 51: { - LogStep(51, "Read attribute NULLABLE_OCTET_STRING Default Value"); + case 55: { + LogStep(55, "Read attribute NULLABLE_OCTET_STRING Default Value"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, true, chip::NullOptional); } - case 52: { - LogStep(52, "Write attribute NULLABLE_OCTET_STRING"); + case 56: { + LogStep(56, "Write attribute NULLABLE_OCTET_STRING"); ListFreer listFreer; chip::app::DataModel::Nullable value; value.SetNonNull(); @@ -80686,26 +80735,26 @@ class TestConstraintsSuite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, value, chip::NullOptional, chip::NullOptional); } - case 53: { - LogStep(53, "Read attribute NULLABLE_OCTET_STRING"); + case 57: { + LogStep(57, "Read attribute NULLABLE_OCTET_STRING"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, true, chip::NullOptional); } - case 54: { - LogStep(54, "Write attribute NULLABLE_OCTET_STRING"); + case 58: { + LogStep(58, "Write attribute NULLABLE_OCTET_STRING"); ListFreer listFreer; chip::app::DataModel::Nullable value; value.SetNull(); return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, value, chip::NullOptional, chip::NullOptional); } - case 55: { - LogStep(55, "Read attribute NULLABLE_OCTET_STRING"); + case 59: { + LogStep(59, "Read attribute NULLABLE_OCTET_STRING"); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, true, chip::NullOptional); } - case 56: { - LogStep(56, "Write attribute NULLABLE_OCTET_STRING back to Default Value"); + case 60: { + LogStep(60, "Write attribute NULLABLE_OCTET_STRING back to Default Value"); ListFreer listFreer; chip::app::DataModel::Nullable value; value.SetNonNull(); diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 908c734985d6c9..b5e5873650ad46 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -119418,52 +119418,68 @@ class TestConstraints : public TestCommandBridge { err = TestWriteAttributeCharStringValueBackToDefaultValue_44(); break; case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Read attribute NULLABLE_INT8U Default Value\n"); - err = TestReadAttributeNullableInt8uDefaultValue_45(); + ChipLogProgress(chipTool, " ***** Test Step 45 : Write attribute NULLABLE_CHAR_STRING Value\n"); + err = TestWriteAttributeNullableCharStringValue_45(); break; case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Write attribute NULLABLE_INT8U with a value\n"); - err = TestWriteAttributeNullableInt8uWithAValue_46(); + ChipLogProgress(chipTool, " ***** Test Step 46 : Read attribute NULLABLE_CHAR_STRING Value MinLength Constraints\n"); + err = TestReadAttributeNullableCharStringValueMinLengthConstraints_46(); break; case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : Read attribute NULLABLE_INT8U with a value\n"); - err = TestReadAttributeNullableInt8uWithAValue_47(); + ChipLogProgress(chipTool, " ***** Test Step 47 : Read attribute NULLABLE_CHAR_STRING Value MaxLength Constraints\n"); + err = TestReadAttributeNullableCharStringValueMaxLengthConstraints_47(); break; case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : Write attribute NULLABLE_INT8U without a value\n"); - err = TestWriteAttributeNullableInt8uWithoutAValue_48(); + ChipLogProgress(chipTool, " ***** Test Step 48 : Write attribute NULLABLE_CHAR_STRING Value Back to Default Value\n"); + err = TestWriteAttributeNullableCharStringValueBackToDefaultValue_48(); break; case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Read attribute NULLABLE_INT8U with a value\n"); - err = TestReadAttributeNullableInt8uWithAValue_49(); + ChipLogProgress(chipTool, " ***** Test Step 49 : Read attribute NULLABLE_INT8U Default Value\n"); + err = TestReadAttributeNullableInt8uDefaultValue_49(); break; case 50: - ChipLogProgress(chipTool, " ***** Test Step 50 : Write attribute NULLABLE_INT8U back to Default Value\n"); - err = TestWriteAttributeNullableInt8uBackToDefaultValue_50(); + ChipLogProgress(chipTool, " ***** Test Step 50 : Write attribute NULLABLE_INT8U with a value\n"); + err = TestWriteAttributeNullableInt8uWithAValue_50(); break; case 51: - ChipLogProgress(chipTool, " ***** Test Step 51 : Read attribute NULLABLE_OCTET_STRING Default Value\n"); - err = TestReadAttributeNullableOctetStringDefaultValue_51(); + ChipLogProgress(chipTool, " ***** Test Step 51 : Read attribute NULLABLE_INT8U with a value\n"); + err = TestReadAttributeNullableInt8uWithAValue_51(); break; case 52: - ChipLogProgress(chipTool, " ***** Test Step 52 : Write attribute NULLABLE_OCTET_STRING\n"); - err = TestWriteAttributeNullableOctetString_52(); + ChipLogProgress(chipTool, " ***** Test Step 52 : Write attribute NULLABLE_INT8U without a value\n"); + err = TestWriteAttributeNullableInt8uWithoutAValue_52(); break; case 53: - ChipLogProgress(chipTool, " ***** Test Step 53 : Read attribute NULLABLE_OCTET_STRING\n"); - err = TestReadAttributeNullableOctetString_53(); + ChipLogProgress(chipTool, " ***** Test Step 53 : Read attribute NULLABLE_INT8U with a value\n"); + err = TestReadAttributeNullableInt8uWithAValue_53(); break; case 54: - ChipLogProgress(chipTool, " ***** Test Step 54 : Write attribute NULLABLE_OCTET_STRING\n"); - err = TestWriteAttributeNullableOctetString_54(); + ChipLogProgress(chipTool, " ***** Test Step 54 : Write attribute NULLABLE_INT8U back to Default Value\n"); + err = TestWriteAttributeNullableInt8uBackToDefaultValue_54(); break; case 55: - ChipLogProgress(chipTool, " ***** Test Step 55 : Read attribute NULLABLE_OCTET_STRING\n"); - err = TestReadAttributeNullableOctetString_55(); + ChipLogProgress(chipTool, " ***** Test Step 55 : Read attribute NULLABLE_OCTET_STRING Default Value\n"); + err = TestReadAttributeNullableOctetStringDefaultValue_55(); break; case 56: - ChipLogProgress(chipTool, " ***** Test Step 56 : Write attribute NULLABLE_OCTET_STRING back to Default Value\n"); - err = TestWriteAttributeNullableOctetStringBackToDefaultValue_56(); + ChipLogProgress(chipTool, " ***** Test Step 56 : Write attribute NULLABLE_OCTET_STRING\n"); + err = TestWriteAttributeNullableOctetString_56(); + break; + case 57: + ChipLogProgress(chipTool, " ***** Test Step 57 : Read attribute NULLABLE_OCTET_STRING\n"); + err = TestReadAttributeNullableOctetString_57(); + break; + case 58: + ChipLogProgress(chipTool, " ***** Test Step 58 : Write attribute NULLABLE_OCTET_STRING\n"); + err = TestWriteAttributeNullableOctetString_58(); + break; + case 59: + ChipLogProgress(chipTool, " ***** Test Step 59 : Read attribute NULLABLE_OCTET_STRING\n"); + err = TestReadAttributeNullableOctetString_59(); + break; + case 60: + ChipLogProgress(chipTool, " ***** Test Step 60 : Write attribute NULLABLE_OCTET_STRING back to Default Value\n"); + err = TestWriteAttributeNullableOctetStringBackToDefaultValue_60(); break; } @@ -119647,6 +119663,18 @@ class TestConstraints : public TestCommandBridge { case 56: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 57: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 58: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 59: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 60: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -119660,7 +119688,7 @@ class TestConstraints : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 57; + const uint16_t mTestCount = 61; chip::Optional mNodeId; chip::Optional mCluster; @@ -120601,7 +120629,97 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadAttributeNullableInt8uDefaultValue_45() + CHIP_ERROR TestWriteAttributeNullableCharStringValue_45() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id nullableCharStringArgument; + nullableCharStringArgument = nil; + [cluster writeAttributeNullableCharStringWithValue:nullableCharStringArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Write attribute NULLABLE_CHAR_STRING Value Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadAttributeNullableCharStringValueMinLengthConstraints_46() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNullableCharStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read attribute NULLABLE_CHAR_STRING Value MinLength Constraints Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintMinLength("nullableCharString", value, 5)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadAttributeNullableCharStringValueMaxLengthConstraints_47() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNullableCharStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read attribute NULLABLE_CHAR_STRING Value MaxLength Constraints Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintMaxLength("nullableCharString", value, 20)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWriteAttributeNullableCharStringValueBackToDefaultValue_48() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id nullableCharStringArgument; + nullableCharStringArgument = @""; + [cluster + writeAttributeNullableCharStringWithValue:nullableCharStringArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Write attribute NULLABLE_CHAR_STRING Value Back to Default Value Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadAttributeNullableInt8uDefaultValue_49() { MTRBaseDevice * device = GetDevice("alpha"); @@ -120625,7 +120743,7 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteAttributeNullableInt8uWithAValue_46() + CHIP_ERROR TestWriteAttributeNullableInt8uWithAValue_50() { MTRBaseDevice * device = GetDevice("alpha"); @@ -120646,7 +120764,7 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadAttributeNullableInt8uWithAValue_47() + CHIP_ERROR TestReadAttributeNullableInt8uWithAValue_51() { MTRBaseDevice * device = GetDevice("alpha"); @@ -120667,7 +120785,7 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteAttributeNullableInt8uWithoutAValue_48() + CHIP_ERROR TestWriteAttributeNullableInt8uWithoutAValue_52() { MTRBaseDevice * device = GetDevice("alpha"); @@ -120688,7 +120806,7 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadAttributeNullableInt8uWithAValue_49() + CHIP_ERROR TestReadAttributeNullableInt8uWithAValue_53() { MTRBaseDevice * device = GetDevice("alpha"); @@ -120709,7 +120827,7 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteAttributeNullableInt8uBackToDefaultValue_50() + CHIP_ERROR TestWriteAttributeNullableInt8uBackToDefaultValue_54() { MTRBaseDevice * device = GetDevice("alpha"); @@ -120730,7 +120848,7 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadAttributeNullableOctetStringDefaultValue_51() + CHIP_ERROR TestReadAttributeNullableOctetStringDefaultValue_55() { MTRBaseDevice * device = GetDevice("alpha"); @@ -120755,7 +120873,7 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteAttributeNullableOctetString_52() + CHIP_ERROR TestWriteAttributeNullableOctetString_56() { MTRBaseDevice * device = GetDevice("alpha"); @@ -120776,7 +120894,7 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadAttributeNullableOctetString_53() + CHIP_ERROR TestReadAttributeNullableOctetString_57() { MTRBaseDevice * device = GetDevice("alpha"); @@ -120797,7 +120915,7 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteAttributeNullableOctetString_54() + CHIP_ERROR TestWriteAttributeNullableOctetString_58() { MTRBaseDevice * device = GetDevice("alpha"); @@ -120818,7 +120936,7 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadAttributeNullableOctetString_55() + CHIP_ERROR TestReadAttributeNullableOctetString_59() { MTRBaseDevice * device = GetDevice("alpha"); @@ -120839,7 +120957,7 @@ class TestConstraints : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteAttributeNullableOctetStringBackToDefaultValue_56() + CHIP_ERROR TestWriteAttributeNullableOctetStringBackToDefaultValue_60() { MTRBaseDevice * device = GetDevice("alpha");