From 2c0468b9e5e5b41a97959baa8f53983cee23f390 Mon Sep 17 00:00:00 2001 From: Vikram Date: Wed, 3 Nov 2021 10:35:39 +0530 Subject: [PATCH] Updating generated test script artifacts after rebase. --- .../Framework/CHIPTests/CHIPClustersTests.m | 144 ++++++- .../chip-tool/zap-generated/test/Commands.h | 386 +++++++++++++----- 2 files changed, 406 insertions(+), 124 deletions(-) diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index eab06b24a33449..4e51743387cd31 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -6607,6 +6607,25 @@ - (void)testSendClusterTest_TC_CC_9_2_000012_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_CC_9_2_000013_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Turn off light that we turned on Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - (void)testSendClusterTest_TC_CC_9_3_000000_On { @@ -6928,6 +6947,25 @@ - (void)testSendClusterTest_TC_CC_9_3_000012_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_CC_9_3_000013_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light that we turned on"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Turn off light that we turned on Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - (void)testSendClusterTest_TC_DM_1_1_000000_ReadAttribute { @@ -8159,7 +8197,26 @@ - (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000000_Step +- (void)testSendClusterTest_TC_LVL_4_1_000000_On +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending Off command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending Off command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000001_Step { XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; @@ -8188,7 +8245,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000000_Step [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000001_WaitForMs +- (void)testSendClusterTest_TC_LVL_4_1_000002_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; @@ -8196,7 +8253,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000001_WaitForMs WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_LVL_4_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; @@ -8217,7 +8274,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000003_Step +- (void)testSendClusterTest_TC_LVL_4_1_000004_Step { XCTestExpectation * expectation = [self expectationWithDescription:@"Sends step down command to DUT"]; @@ -8246,7 +8303,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000003_Step [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000004_WaitForMs +- (void)testSendClusterTest_TC_LVL_4_1_000005_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; @@ -8254,7 +8311,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000004_WaitForMs WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_LVL_4_1_000006_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; @@ -8275,7 +8332,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000005_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000006_Step +- (void)testSendClusterTest_TC_LVL_4_1_000007_Step { XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a Step up command"]; @@ -8304,7 +8361,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000006_Step [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000007_WaitForMs +- (void)testSendClusterTest_TC_LVL_4_1_000008_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; @@ -8312,7 +8369,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000007_WaitForMs WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000008_ReadAttribute +- (void)testSendClusterTest_TC_LVL_4_1_000009_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; @@ -8333,8 +8390,46 @@ - (void)testSendClusterTest_TC_LVL_4_1_000008_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_LVL_4_1_000010_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending Off command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending Off command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_5_1_000000_On +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending Off command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); -- (void)testSendClusterTest_TC_LVL_5_1_000000_Step + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending Off command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000001_Step { XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; @@ -8363,7 +8458,7 @@ - (void)testSendClusterTest_TC_LVL_5_1_000000_Step [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000001_WaitForMs +- (void)testSendClusterTest_TC_LVL_5_1_000002_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; @@ -8371,7 +8466,7 @@ - (void)testSendClusterTest_TC_LVL_5_1_000001_WaitForMs WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_LVL_5_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; @@ -8392,7 +8487,7 @@ - (void)testSendClusterTest_TC_LVL_5_1_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000003_Move +- (void)testSendClusterTest_TC_LVL_5_1_000004_Move { XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a move up command to DUT"]; @@ -8419,7 +8514,7 @@ - (void)testSendClusterTest_TC_LVL_5_1_000003_Move [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000004_WaitForMs +- (void)testSendClusterTest_TC_LVL_5_1_000005_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; @@ -8427,7 +8522,7 @@ - (void)testSendClusterTest_TC_LVL_5_1_000004_WaitForMs WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000005_Stop +- (void)testSendClusterTest_TC_LVL_5_1_000006_Stop { XCTestExpectation * expectation = [self expectationWithDescription:@"Sends stop command to DUT"]; @@ -8450,6 +8545,25 @@ - (void)testSendClusterTest_TC_LVL_5_1_000005_Stop [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_LVL_5_1_000007_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending Off command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending Off command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - (void)testSendClusterTest_TC_MC_1_1_000000_WriteAttribute { diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 4bf3945eb87b62..4f9499e6909eac 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -10067,6 +10067,10 @@ class Test_TC_CC_9_2 : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopActive attribute from DUT\n"); err = TestReadColorLoopActiveAttributeFromDut_12(); break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Turn off light that we turned on\n"); + err = TestTurnOffLightThatWeTurnedOn_13(); + break; } if (CHIP_NO_ERROR != err) @@ -10078,7 +10082,7 @@ class Test_TC_CC_9_2 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 13; + const uint16_t mTestCount = 14; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; @@ -10460,6 +10464,30 @@ class Test_TC_CC_9_2 : public TestCommand VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } + + CHIP_ERROR TestTurnOffLightThatWeTurnedOn_13() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_13(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_13() { NextTest(); } }; class Test_TC_CC_9_3 : public TestCommand @@ -10544,6 +10572,10 @@ class Test_TC_CC_9_3 : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopActive attribute from DUT\n"); err = TestReadColorLoopActiveAttributeFromDut_12(); break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Turn off light that we turned on\n"); + err = TestTurnOffLightThatWeTurnedOn_13(); + break; } if (CHIP_NO_ERROR != err) @@ -10555,7 +10587,7 @@ class Test_TC_CC_9_3 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 13; + const uint16_t mTestCount = 14; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; @@ -10936,6 +10968,30 @@ class Test_TC_CC_9_3 : public TestCommand VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } + + CHIP_ERROR TestTurnOffLightThatWeTurnedOn_13() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_13(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_13() { NextTest(); } }; class Test_TC_DM_1_1 : public TestCommand @@ -13197,40 +13253,48 @@ class Test_TC_LVL_4_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition: DUT level is set to 0x80\n"); - err = TestPreconditionDutLevelIsSetTo0x80_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Sending Off command\n"); + err = TestSendingOffCommand_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Wait 3000ms\n"); - err = TestWait3000ms_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: DUT level is set to 0x80\n"); + err = TestPreconditionDutLevelIsSetTo0x80_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 3000ms\n"); + err = TestWait3000ms_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Sends step down command to DUT\n"); - err = TestSendsStepDownCommandToDut_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); - err = TestWait3000ms_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Sends step down command to DUT\n"); + err = TestSendsStepDownCommandToDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 3000ms\n"); + err = TestWait3000ms_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Sends a Step up command\n"); - err = TestSendsAStepUpCommand_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 3000ms\n"); - err = TestWait3000ms_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Sends a Step up command\n"); + err = TestSendsAStepUpCommand_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 3000ms\n"); + err = TestWait3000ms_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Sending Off command\n"); + err = TestSendingOffCommand_10(); break; } @@ -13243,50 +13307,74 @@ class Test_TC_LVL_4_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + const uint16_t mTestCount = 11; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; - chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_2(void * context, uint8_t currentLevel) + static void OnSuccessCallback_3(void * context, uint8_t currentLevel) { - (static_cast(context))->OnSuccessResponse_2(currentLevel); + (static_cast(context))->OnSuccessResponse_3(currentLevel); } - static void OnFailureCallback_5(void * context, uint8_t status) + static void OnFailureCallback_6(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_6(status); } - static void OnSuccessCallback_5(void * context, uint8_t currentLevel) + static void OnSuccessCallback_6(void * context, uint8_t currentLevel) { - (static_cast(context))->OnSuccessResponse_5(currentLevel); + (static_cast(context))->OnSuccessResponse_6(currentLevel); } - static void OnFailureCallback_8(void * context, uint8_t status) + static void OnFailureCallback_9(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_8(status); + (static_cast(context))->OnFailureResponse_9(status); } - static void OnSuccessCallback_8(void * context, uint8_t currentLevel) + static void OnSuccessCallback_9(void * context, uint8_t currentLevel) { - (static_cast(context))->OnSuccessResponse_8(currentLevel); + (static_cast(context))->OnSuccessResponse_9(currentLevel); } // // Tests methods // - CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_0() + CHIP_ERROR TestSendingOffCommand_0() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0() { NextTest(); } + + CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_1() { chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -13302,38 +13390,38 @@ class Test_TC_LVL_4_1 : public TestCommand request.optionOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); + (static_cast(context))->OnSuccessResponse_1(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_1(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0() { NextTest(); } + void OnSuccessResponse_1() { NextTest(); } - CHIP_ERROR TestWait3000ms_1() { return WaitForMs(3000); } + CHIP_ERROR TestWait3000ms_2() { return WaitForMs(3000); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_2() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_3() { chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t currentLevel) + void OnSuccessResponse_3(uint8_t currentLevel) { VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); NextTest(); } - CHIP_ERROR TestSendsStepDownCommandToDut_3() + CHIP_ERROR TestSendsStepDownCommandToDut_4() { chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -13349,38 +13437,38 @@ class Test_TC_LVL_4_1 : public TestCommand request.optionOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_3(); + (static_cast(context))->OnSuccessResponse_4(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_4(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3() { NextTest(); } + void OnSuccessResponse_4() { NextTest(); } - CHIP_ERROR TestWait3000ms_4() { return WaitForMs(3000); } + CHIP_ERROR TestWait3000ms_5() { return WaitForMs(3000); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_5() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() { chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint8_t currentLevel) + void OnSuccessResponse_6(uint8_t currentLevel) { VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); NextTest(); } - CHIP_ERROR TestSendsAStepUpCommand_6() + CHIP_ERROR TestSendsAStepUpCommand_7() { chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -13396,36 +13484,60 @@ class Test_TC_LVL_4_1 : public TestCommand request.optionOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_6(); + (static_cast(context))->OnSuccessResponse_7(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_7(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6() { NextTest(); } + void OnSuccessResponse_7() { NextTest(); } - CHIP_ERROR TestWait3000ms_7() { return WaitForMs(3000); } + CHIP_ERROR TestWait3000ms_8() { return WaitForMs(3000); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_8() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() { chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(uint8_t currentLevel) + void OnSuccessResponse_9(uint8_t currentLevel) { VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); NextTest(); } + + CHIP_ERROR TestSendingOffCommand_10() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_10(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_10(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10() { NextTest(); } }; class Test_TC_LVL_5_1 : public TestCommand @@ -13459,28 +13571,36 @@ class Test_TC_LVL_5_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition: DUT level is set to 0x80\n"); - err = TestPreconditionDutLevelIsSetTo0x80_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Sending Off command\n"); + err = TestSendingOffCommand_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Wait 3000ms\n"); - err = TestWait3000ms_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: DUT level is set to 0x80\n"); + err = TestPreconditionDutLevelIsSetTo0x80_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 3000ms\n"); + err = TestWait3000ms_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Sends a move up command to DUT\n"); - err = TestSendsAMoveUpCommandToDut_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); - err = TestWait3000ms_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Sends a move up command to DUT\n"); + err = TestSendsAMoveUpCommandToDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Sends stop command to DUT\n"); - err = TestSendsStopCommandToDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 3000ms\n"); + err = TestWait3000ms_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Sends stop command to DUT\n"); + err = TestSendsStopCommandToDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Sending Off command\n"); + err = TestSendingOffCommand_7(); break; } @@ -13493,26 +13613,50 @@ class Test_TC_LVL_5_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 8; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_2(void * context, uint8_t currentLevel) + static void OnSuccessCallback_3(void * context, uint8_t currentLevel) { - (static_cast(context))->OnSuccessResponse_2(currentLevel); + (static_cast(context))->OnSuccessResponse_3(currentLevel); } // // Tests methods // - CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_0() + CHIP_ERROR TestSendingOffCommand_0() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0() { NextTest(); } + + CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_1() { chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -13528,38 +13672,38 @@ class Test_TC_LVL_5_1 : public TestCommand request.optionOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); + (static_cast(context))->OnSuccessResponse_1(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_1(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0() { NextTest(); } + void OnSuccessResponse_1() { NextTest(); } - CHIP_ERROR TestWait3000ms_1() { return WaitForMs(3000); } + CHIP_ERROR TestWait3000ms_2() { return WaitForMs(3000); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_2() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_3() { chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t currentLevel) + void OnSuccessResponse_3(uint8_t currentLevel) { VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); NextTest(); } - CHIP_ERROR TestSendsAMoveUpCommandToDut_3() + CHIP_ERROR TestSendsAMoveUpCommandToDut_4() { chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -13574,22 +13718,22 @@ class Test_TC_LVL_5_1 : public TestCommand request.optionOverride = 1; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_3(); + (static_cast(context))->OnSuccessResponse_4(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_4(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3() { NextTest(); } + void OnSuccessResponse_4() { NextTest(); } - CHIP_ERROR TestWait3000ms_4() { return WaitForMs(3000); } + CHIP_ERROR TestWait3000ms_5() { return WaitForMs(3000); } - CHIP_ERROR TestSendsStopCommandToDut_5() + CHIP_ERROR TestSendsStopCommandToDut_6() { chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -13602,18 +13746,42 @@ class Test_TC_LVL_5_1 : public TestCommand request.optionOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_5(); + (static_cast(context))->OnSuccessResponse_6(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_6(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5() { NextTest(); } + void OnSuccessResponse_6() { NextTest(); } + + CHIP_ERROR TestSendingOffCommand_7() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_7(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7() { NextTest(); } }; class Test_TC_MC_1_1 : public TestCommand