diff --git a/src/app/tests/suites/TestDiscovery.yaml b/src/app/tests/suites/TestDiscovery.yaml index 2c5c3af0bbb2c6..b91785007f7c30 100644 --- a/src/app/tests/suites/TestDiscovery.yaml +++ b/src/app/tests/suites/TestDiscovery.yaml @@ -269,7 +269,8 @@ tests: response: values: - name: "pairingHint" - notValue: 0 + constraints: + notValue: 0 - label: "Optional TXT key for pairing instructions (PI)" PICS: PI_KEY diff --git a/src/app/tests/suites/certification/Test_TC_SC_4_2.yaml b/src/app/tests/suites/certification/Test_TC_SC_4_2.yaml index b8042c5b7aace6..9993999fa5db75 100644 --- a/src/app/tests/suites/certification/Test_TC_SC_4_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_SC_4_2.yaml @@ -233,7 +233,8 @@ tests: response: values: - name: "pairingHint" - notValue: 0 + constraints: + notValue: 0 - label: "Optional TXT key for pairing instructions (PI)" PICS: PI_KEY @@ -457,7 +458,8 @@ tests: response: values: - name: "pairingHint" - notValue: 0 + constraints: + notValue: 0 - label: "Optional TXT key for pairing instructions (PI)" disabled: true diff --git a/src/app/zap-templates/common/ClusterTestGeneration.js b/src/app/zap-templates/common/ClusterTestGeneration.js index 4ada516a5cf9cb..fafebd0a2f8a5f 100644 --- a/src/app/zap-templates/common/ClusterTestGeneration.js +++ b/src/app/zap-templates/common/ClusterTestGeneration.js @@ -249,6 +249,19 @@ function setDefaultResponse(test) const defaultResponseValues = []; setDefault(test[kResponseName], kValuesName, defaultResponseValues); + // Ensure only valid keywords are used for response values. + const values = test[kResponseName][kValuesName]; + for (let i = 0; i < values.length; i++) { + for (let key in values[i]) { + if (key == "name" || key == "value" || key == kConstraintsName || key == kSaveAsName) { + continue; + } + + const errorStr = `Unknown key "${key}"`; + throwError(test, errorStr); + } + } + const defaultResponseConstraints = {}; setDefault(test[kResponseName], kConstraintsName, defaultResponseConstraints); diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 581f8d762767ba..637c7177088709 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -47179,6 +47179,8 @@ class Test_TC_SC_4_2Suite : public TestCommand { chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); } shouldContinue = true; break; @@ -92215,6 +92217,8 @@ class TestDiscoverySuite : public TestCommand { chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); } shouldContinue = true; break;