From 84eccbaf15092343b400294134d63d40c365e4db Mon Sep 17 00:00:00 2001 From: Jonathan Megevand Date: Mon, 13 Dec 2021 21:54:32 +0100 Subject: [PATCH 1/2] Fix: Constraintswith nullable type fixed for Min Max NotValue --- .../chip-tool/commands/tests/TestCommand.h | 24 +++++ .../templates/partials/test_cluster.zapt | 4 +- .../chip-tool/zap-generated/test/Commands.h | 102 +++++++++--------- 3 files changed, 77 insertions(+), 53 deletions(-) diff --git a/examples/chip-tool/commands/tests/TestCommand.h b/examples/chip-tool/commands/tests/TestCommand.h index c314699e0e7a59..5785cf25c71138 100644 --- a/examples/chip-tool/commands/tests/TestCommand.h +++ b/examples/chip-tool/commands/tests/TestCommand.h @@ -92,6 +92,14 @@ class TestCommand : public CHIPCommand return true; } + template + bool CheckConstraintMinValue(const char * itemName, const chip::app::DataModel::Nullable & current, U expected) + { + if (current.IsNull()) { + return true; + } + return CheckConstraintMinValue(itemName, current.Value(), static_cast(expected)); + } template bool CheckConstraintMaxValue(const char * itemName, T current, T expected) { @@ -104,6 +112,14 @@ class TestCommand : public CHIPCommand return true; } template + bool CheckConstraintMaxValue(const char * itemName, const chip::app::DataModel::Nullable & current, U expected) + { + if (current.IsNull()) { + return true; + } + return CheckConstraintMaxValue(itemName, current.Value(), static_cast(expected)); + } + template bool CheckConstraintNotValue(const char * itemName, T current, U expected) { if (current == expected) @@ -114,6 +130,14 @@ class TestCommand : public CHIPCommand return true; } + template + bool CheckConstraintNotValue(const char * itemName, const chip::app::DataModel::Nullable & current, U expected) + { + if (current.IsNull()) { + return true; + } + return CheckConstraintNotValue(itemName, current.Value(), expected); + } bool CheckConstraintNotValue(const char * itemName, chip::CharSpan current, chip::CharSpan expected) { diff --git a/examples/chip-tool/templates/partials/test_cluster.zapt b/examples/chip-tool/templates/partials/test_cluster.zapt index 8581f50eca6bba..7038b5402d44e5 100644 --- a/examples/chip-tool/templates/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/partials/test_cluster.zapt @@ -309,8 +309,8 @@ class {{filename}}: public TestCommand {{~#if expectedConstraints.endsWith}}VerifyOrReturn(CheckConstraintEndsWith("{{>item}}", {{>item}}, "{{expectedConstraints.endsWith}}"));{{/if}} {{~#if expectedConstraints.minLength}}VerifyOrReturn(CheckConstraintMinLength("{{>item}}", {{>item}}.size(), {{expectedConstraints.minLength}}));{{/if}} {{~#if expectedConstraints.maxLength}}VerifyOrReturn(CheckConstraintMaxLength("{{>item}}", {{>item}}.size(), {{expectedConstraints.maxLength}}));{{/if}} - {{~#if expectedConstraints.minValue}}VerifyOrReturn(CheckConstraintMinValue<{{chipType}}>("{{>item}}", {{>item}}, {{expectedConstraints.minValue}}));{{/if}} - {{~#if expectedConstraints.maxValue}}VerifyOrReturn(CheckConstraintMaxValue<{{chipType}}>("{{>item}}", {{>item}}, {{expectedConstraints.maxValue}}));{{/if}} + {{~#if expectedConstraints.minValue}}VerifyOrReturn(CheckConstraintMinValue<{{chipType}}>("{{>item}}", {{>item}}, {{asTypedLiteral expectedConstraints.minValue type}}));{{/if}} + {{~#if expectedConstraints.maxValue}}VerifyOrReturn(CheckConstraintMaxValue<{{chipType}}>("{{>item}}", {{>item}}, {{asTypedLiteral expectedConstraints.maxValue type}}));{{/if}} {{~#if expectedConstraints.notValue}}VerifyOrReturn(CheckConstraintNotValue("{{>item}}", {{>item}}, {{asTypedLiteral expectedConstraints.notValue type}}));{{/if}} {{/if}} diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 497a812f64e5f5..0ba5a421b4094a 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -3797,7 +3797,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_10(uint16_t currentX) { VerifyOrReturn(CheckConstraintType("currentX", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("currentX", currentX, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("currentX", currentX, 65279U)); NextTest(); } @@ -3880,7 +3880,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_14(uint16_t currentY) { VerifyOrReturn(CheckConstraintType("currentY", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("currentY", currentY, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("currentY", currentY, 65279U)); NextTest(); } @@ -3943,7 +3943,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_17(uint16_t colorTemperature) { VerifyOrReturn(CheckConstraintType("colorTemperature", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("colorTemperature", colorTemperature, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("colorTemperature", colorTemperature, 65279U)); NextTest(); } @@ -4603,7 +4603,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_49(uint16_t colorCapabilities) { VerifyOrReturn(CheckConstraintType("colorCapabilities", "", "map16")); - VerifyOrReturn(CheckConstraintMaxValue("colorCapabilities", colorCapabilities, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("colorCapabilities", colorCapabilities, 65279U)); NextTest(); } @@ -4686,7 +4686,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_53(uint16_t colorTempPhysicalMin) { VerifyOrReturn(CheckConstraintType("colorTempPhysicalMin", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMin", colorTempPhysicalMin, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMin", colorTempPhysicalMin, 65279U)); NextTest(); } @@ -4769,7 +4769,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_57(uint16_t colorTempPhysicalMax) { VerifyOrReturn(CheckConstraintType("colorTempPhysicalMax", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMax", colorTempPhysicalMax, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMax", colorTempPhysicalMax, 65279U)); NextTest(); } @@ -4898,7 +4898,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_63(uint16_t startUpColorTemperatureMireds) { VerifyOrReturn(CheckConstraintType("startUpColorTemperatureMireds", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("startUpColorTemperatureMireds", startUpColorTemperatureMireds, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("startUpColorTemperatureMireds", startUpColorTemperatureMireds, 65279U)); NextTest(); } @@ -4979,7 +4979,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_67(uint16_t remainingTime) { VerifyOrReturn(CheckConstraintType("remainingTime", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("remainingTime", remainingTime, 254)); + VerifyOrReturn(CheckConstraintMaxValue("remainingTime", remainingTime, 254U)); NextTest(); } @@ -5189,7 +5189,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_77(uint16_t primary1X) { VerifyOrReturn(CheckConstraintType("primary1X", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary1X", primary1X, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary1X", primary1X, 65279U)); NextTest(); } @@ -5252,7 +5252,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_80(uint16_t primary1Y) { VerifyOrReturn(CheckConstraintType("primary1Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary1Y", primary1Y, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary1Y", primary1Y, 65279U)); NextTest(); } @@ -5335,7 +5335,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_84(uint16_t primary2X) { VerifyOrReturn(CheckConstraintType("primary2X", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary2X", primary2X, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary2X", primary2X, 65279U)); NextTest(); } @@ -5398,7 +5398,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_87(uint16_t primary2Y) { VerifyOrReturn(CheckConstraintType("primary2Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary2Y", primary2Y, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary2Y", primary2Y, 65279U)); NextTest(); } @@ -5481,7 +5481,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_91(uint16_t primary3X) { VerifyOrReturn(CheckConstraintType("primary3X", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary3X", primary3X, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary3X", primary3X, 65279U)); NextTest(); } @@ -5544,7 +5544,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_94(uint16_t primary3Y) { VerifyOrReturn(CheckConstraintType("primary3Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary3Y", primary3Y, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary3Y", primary3Y, 65279U)); NextTest(); } @@ -5627,7 +5627,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_98(uint16_t primary4X) { VerifyOrReturn(CheckConstraintType("primary4X", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary4X", primary4X, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary4X", primary4X, 65279U)); NextTest(); } @@ -5690,7 +5690,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_101(uint16_t primary4Y) { VerifyOrReturn(CheckConstraintType("primary4Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary4Y", primary4Y, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary4Y", primary4Y, 65279U)); NextTest(); } @@ -5773,7 +5773,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_105(uint16_t primary5X) { VerifyOrReturn(CheckConstraintType("primary5X", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary5X", primary5X, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary5X", primary5X, 65279U)); NextTest(); } @@ -5836,7 +5836,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_108(uint16_t primary5Y) { VerifyOrReturn(CheckConstraintType("primary5Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary5Y", primary5Y, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary5Y", primary5Y, 65279U)); NextTest(); } @@ -5919,7 +5919,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_112(uint16_t primary6X) { VerifyOrReturn(CheckConstraintType("primary6X", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary6X", primary6X, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary6X", primary6X, 65279U)); NextTest(); } @@ -5982,7 +5982,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_115(uint16_t primary6Y) { VerifyOrReturn(CheckConstraintType("primary6Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("primary6Y", primary6Y, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("primary6Y", primary6Y, 65279U)); NextTest(); } @@ -6065,7 +6065,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_119(uint16_t whitePointX) { VerifyOrReturn(CheckConstraintType("whitePointX", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("whitePointX", whitePointX, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("whitePointX", whitePointX, 65279U)); NextTest(); } @@ -6124,7 +6124,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_122(uint16_t whitePointY) { VerifyOrReturn(CheckConstraintType("whitePointY", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("whitePointY", whitePointY, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("whitePointY", whitePointY, 65279U)); NextTest(); } @@ -6183,7 +6183,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_125(uint16_t colorPointRX) { VerifyOrReturn(CheckConstraintType("colorPointRX", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("colorPointRX", colorPointRX, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("colorPointRX", colorPointRX, 65279U)); NextTest(); } @@ -6242,7 +6242,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_128(uint16_t colorPointRY) { VerifyOrReturn(CheckConstraintType("colorPointRY", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("colorPointRY", colorPointRY, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("colorPointRY", colorPointRY, 65279U)); NextTest(); } @@ -6321,7 +6321,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_132(uint16_t colorPointGX) { VerifyOrReturn(CheckConstraintType("colorPointGX", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("colorPointGX", colorPointGX, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("colorPointGX", colorPointGX, 65279U)); NextTest(); } @@ -6380,7 +6380,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_135(uint16_t colorPointGY) { VerifyOrReturn(CheckConstraintType("colorPointGY", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("colorPointGY", colorPointGY, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("colorPointGY", colorPointGY, 65279U)); NextTest(); } @@ -6459,7 +6459,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_139(uint16_t colorPointBX) { VerifyOrReturn(CheckConstraintType("colorPointBX", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("colorPointBX", colorPointBX, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("colorPointBX", colorPointBX, 65279U)); NextTest(); } @@ -6518,7 +6518,7 @@ class Test_TC_CC_2_1 : public TestCommand void OnSuccessResponse_142(uint16_t colorPointBY) { VerifyOrReturn(CheckConstraintType("colorPointBY", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("colorPointBY", colorPointBY, 65279)); + VerifyOrReturn(CheckConstraintMaxValue("colorPointBY", colorPointBY, 65279U)); NextTest(); } @@ -23053,7 +23053,7 @@ class Test_TC_RH_2_1 : public TestCommand void OnSuccessResponse_2(uint16_t minMeasuredValue) { VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 9999)); + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 9999U)); NextTest(); } @@ -29016,8 +29016,8 @@ class Test_TC_WNCV_1_1 : public TestCommand void OnSuccessResponse_1(uint16_t clusterRevision) { VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("clusterRevision", clusterRevision, 5)); - VerifyOrReturn(CheckConstraintMaxValue("clusterRevision", clusterRevision, 200)); + VerifyOrReturn(CheckConstraintMinValue("clusterRevision", clusterRevision, 5U)); + VerifyOrReturn(CheckConstraintMaxValue("clusterRevision", clusterRevision, 200U)); NextTest(); } @@ -29081,7 +29081,7 @@ class Test_TC_WNCV_1_1 : public TestCommand void OnSuccessResponse_4(uint32_t featureMap) { VerifyOrReturn(CheckConstraintType("featureMap", "", "uint32")); - VerifyOrReturn(CheckConstraintMaxValue("featureMap", featureMap, 32768)); + VerifyOrReturn(CheckConstraintMaxValue("featureMap", featureMap, 32768UL)); NextTest(); } @@ -30255,7 +30255,7 @@ class Test_TC_WNCV_2_1 : public TestCommand { VerifyOrReturn(CheckConstraintType("targetPositionLiftPercent100ths", "", "uint16")); VerifyOrReturn( - CheckConstraintMaxValue("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths, 10000)); + CheckConstraintMaxValue("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths, 10000U)); NextTest(); } @@ -30323,7 +30323,7 @@ class Test_TC_WNCV_2_1 : public TestCommand { VerifyOrReturn(CheckConstraintType("targetPositionTiltPercent100ths", "", "uint16")); VerifyOrReturn( - CheckConstraintMaxValue("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths, 10000)); + CheckConstraintMaxValue("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths, 10000U)); NextTest(); } @@ -30391,7 +30391,7 @@ class Test_TC_WNCV_2_1 : public TestCommand { VerifyOrReturn(CheckConstraintType("currentPositionLiftPercent100ths", "", "uint16")); VerifyOrReturn( - CheckConstraintMaxValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 10000)); + CheckConstraintMaxValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 10000U)); NextTest(); } @@ -30459,7 +30459,7 @@ class Test_TC_WNCV_2_1 : public TestCommand { VerifyOrReturn(CheckConstraintType("currentPositionTiltPercent100ths", "", "uint16")); VerifyOrReturn( - CheckConstraintMaxValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 10000)); + CheckConstraintMaxValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 10000U)); NextTest(); } @@ -30526,7 +30526,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_28(uint16_t installedOpenLimitLift) { VerifyOrReturn(CheckConstraintType("installedOpenLimitLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitLift", installedOpenLimitLift, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitLift", installedOpenLimitLift, 65535U)); NextTest(); } @@ -30571,7 +30571,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_30(uint16_t installedOpenLimitLift) { VerifyOrReturn(CheckConstraintType("installedOpenLimitLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitLift", installedOpenLimitLift, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitLift", installedOpenLimitLift, 65535U)); NextTest(); } @@ -30593,7 +30593,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_31(uint16_t installedClosedLimitLift) { VerifyOrReturn(CheckConstraintType("installedClosedLimitLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitLift", installedClosedLimitLift, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitLift", installedClosedLimitLift, 65535U)); NextTest(); } @@ -30638,7 +30638,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_33(uint16_t installedClosedLimitLift) { VerifyOrReturn(CheckConstraintType("installedClosedLimitLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitLift", installedClosedLimitLift, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitLift", installedClosedLimitLift, 65535U)); NextTest(); } @@ -30660,7 +30660,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_34(uint16_t installedOpenLimitTilt) { VerifyOrReturn(CheckConstraintType("installedOpenLimitTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitTilt", installedOpenLimitTilt, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitTilt", installedOpenLimitTilt, 65535U)); NextTest(); } @@ -30705,7 +30705,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_36(uint16_t installedOpenLimitTilt) { VerifyOrReturn(CheckConstraintType("installedOpenLimitTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitTilt", installedOpenLimitTilt, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitTilt", installedOpenLimitTilt, 65535U)); NextTest(); } @@ -30727,7 +30727,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_37(uint16_t installedClosedLimitTilt) { VerifyOrReturn(CheckConstraintType("installedClosedLimitTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitTilt", installedClosedLimitTilt, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitTilt", installedClosedLimitTilt, 65535U)); NextTest(); } @@ -30772,7 +30772,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_39(uint16_t installedClosedLimitTilt) { VerifyOrReturn(CheckConstraintType("installedClosedLimitTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitTilt", installedClosedLimitTilt, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitTilt", installedClosedLimitTilt, 65535U)); NextTest(); } @@ -30793,7 +30793,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_40(uint16_t safetyStatus) { VerifyOrReturn(CheckConstraintType("safetyStatus", "", "map16")); - VerifyOrReturn(CheckConstraintMaxValue("safetyStatus", safetyStatus, 2047)); + VerifyOrReturn(CheckConstraintMaxValue("safetyStatus", safetyStatus, 2047U)); NextTest(); } @@ -30857,7 +30857,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_43(uint16_t currentPositionLift) { VerifyOrReturn(CheckConstraintType("currentPositionLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLift", currentPositionLift, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("currentPositionLift", currentPositionLift, 65535U)); NextTest(); } @@ -30900,7 +30900,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_45(uint16_t currentPositionLift) { VerifyOrReturn(CheckConstraintType("currentPositionLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLift", currentPositionLift, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("currentPositionLift", currentPositionLift, 65535U)); NextTest(); } @@ -30921,7 +30921,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_46(uint16_t currentPositionTilt) { VerifyOrReturn(CheckConstraintType("currentPositionTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTilt", currentPositionTilt, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("currentPositionTilt", currentPositionTilt, 65535U)); NextTest(); } @@ -30964,7 +30964,7 @@ class Test_TC_WNCV_2_1 : public TestCommand void OnSuccessResponse_48(uint16_t currentPositionTilt) { VerifyOrReturn(CheckConstraintType("currentPositionTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTilt", currentPositionTilt, 65535)); + VerifyOrReturn(CheckConstraintMaxValue("currentPositionTilt", currentPositionTilt, 65535U)); NextTest(); } @@ -45344,7 +45344,7 @@ class TestConstraints : public TestCommand void OnSuccessResponse_2(uint32_t int32u) { - VerifyOrReturn(CheckConstraintMinValue("int32u", int32u, 5)); + VerifyOrReturn(CheckConstraintMinValue("int32u", int32u, 5UL)); NextTest(); } @@ -45364,7 +45364,7 @@ class TestConstraints : public TestCommand void OnSuccessResponse_3(uint32_t int32u) { - VerifyOrReturn(CheckConstraintMaxValue("int32u", int32u, 5)); + VerifyOrReturn(CheckConstraintMaxValue("int32u", int32u, 5UL)); NextTest(); } From 384dc3f1af78d03737073390c04e7c935621234f Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Mon, 13 Dec 2021 21:19:24 +0000 Subject: [PATCH 2/2] Restyled by clang-format --- examples/chip-tool/commands/tests/TestCommand.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/chip-tool/commands/tests/TestCommand.h b/examples/chip-tool/commands/tests/TestCommand.h index 5785cf25c71138..81fbe3a0159d4a 100644 --- a/examples/chip-tool/commands/tests/TestCommand.h +++ b/examples/chip-tool/commands/tests/TestCommand.h @@ -95,7 +95,8 @@ class TestCommand : public CHIPCommand template bool CheckConstraintMinValue(const char * itemName, const chip::app::DataModel::Nullable & current, U expected) { - if (current.IsNull()) { + if (current.IsNull()) + { return true; } return CheckConstraintMinValue(itemName, current.Value(), static_cast(expected)); @@ -114,7 +115,8 @@ class TestCommand : public CHIPCommand template bool CheckConstraintMaxValue(const char * itemName, const chip::app::DataModel::Nullable & current, U expected) { - if (current.IsNull()) { + if (current.IsNull()) + { return true; } return CheckConstraintMaxValue(itemName, current.Value(), static_cast(expected)); @@ -133,7 +135,8 @@ class TestCommand : public CHIPCommand template bool CheckConstraintNotValue(const char * itemName, const chip::app::DataModel::Nullable & current, U expected) { - if (current.IsNull()) { + if (current.IsNull()) + { return true; } return CheckConstraintNotValue(itemName, current.Value(), expected);