From cecbc77501e497a55206e2bb22aa84e3ba2398dd Mon Sep 17 00:00:00 2001 From: manjunathambiger23 Date: Mon, 10 Jan 2022 21:33:39 +0530 Subject: [PATCH] Adding auto generated files of modified testcases --- .../Framework/CHIPTests/CHIPClustersTests.m | 239 +++++++-- .../chip-tool/zap-generated/test/Commands.h | 497 ++++++++++++------ 2 files changed, 528 insertions(+), 208 deletions(-) diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 9717b574e5805d..d99f9a8b777c87 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -11008,12 +11008,36 @@ - (void)testSendClusterTest_TC_LVL_2_1_000001_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 254); + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_LVL_2_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentLevel attribute"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentLevel attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the RemainingTime attribute"]; @@ -11037,7 +11061,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000004_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MinLevel attribute"]; @@ -11061,7 +11085,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000005_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MaxLevel attribute"]; @@ -11080,7 +11104,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000006_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentFrequency attribute"]; @@ -11104,7 +11128,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000005_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000006_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000007_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MinFrequency attribute"]; @@ -11128,7 +11152,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000006_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000007_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000008_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MaxFrequency attribute"]; @@ -11152,7 +11176,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000007_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000008_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000009_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnOffTransitionTime attribute"]; @@ -11176,7 +11200,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000008_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000009_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000010_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnLevel attribute "]; @@ -11195,7 +11219,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000009_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000011_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnTransitionTime attribute "]; @@ -11214,7 +11238,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000010_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000011_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000012_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OffTransitionTime attribute "]; @@ -11233,7 +11257,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000011_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000012_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000013_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the DefaultMoveRate attribute "]; @@ -11252,7 +11276,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000012_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000013_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000014_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the Options attribute "]; @@ -11276,7 +11300,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000013_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000014_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000015_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the StartUpCurrentLevel attribute "]; @@ -11695,7 +11719,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000000_WaitForCommissionee } - (void)testSendClusterTest_TC_LVL_3_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -11703,7 +11727,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000001_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -11800,7 +11824,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000005_WaitForMs } - (void)testSendClusterTest_TC_LVL_3_1_000006_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -11808,7 +11832,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000006_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -11857,7 +11881,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000008_WaitForMs } - (void)testSendClusterTest_TC_LVL_3_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -11865,7 +11889,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000009_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -11938,7 +11962,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000012_WaitForMs } - (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -11946,7 +11970,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -12004,7 +12028,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000000_WaitForCommissionee } - (void)testSendClusterTest_TC_LVL_4_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -12012,7 +12036,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000001_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -12085,7 +12109,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000004_WaitForMs } - (void)testSendClusterTest_TC_LVL_4_1_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -12093,7 +12117,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000005_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -12166,7 +12190,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000008_WaitForMs } - (void)testSendClusterTest_TC_LVL_4_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -12174,7 +12198,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000009_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -12270,7 +12294,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000013_WaitForMs } - (void)testSendClusterTest_TC_LVL_4_1_000014_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -12278,7 +12302,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000014_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -12529,7 +12553,40 @@ - (void)testSendClusterTest_TC_LVL_5_1_000010_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000011_Off +- (void)testSendClusterTest_TC_LVL_5_1_000011_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:254]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Reset level to 254 Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000012_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000013_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; @@ -12576,41 +12633,64 @@ - (void)testSendClusterTest_TC_LVL_6_1_000001_On [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_6_1_000002_Step +- (void)testSendClusterTest_TC_LVL_6_1_000002_MoveToLevel { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: set DUT to lowest point"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:0]; - params.stepSize = [NSNumber numberWithUnsignedChar:128]; - params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; - params.optionMask = [NSNumber numberWithUnsignedChar:0]; - params.optionOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:0]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Precondition: set DUT to lowest point Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_LVL_6_1_000003_WaitForMs { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); + WaitForMs(expectation, queue, 100); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_6_1_000004_Move +- (void)testSendClusterTest_TC_LVL_6_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentLevel attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000005_Move { XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a move up command to DUT"]; @@ -12635,15 +12715,15 @@ - (void)testSendClusterTest_TC_LVL_6_1_000004_Move [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_6_1_000005_WaitForMs +- (void)testSendClusterTest_TC_LVL_6_1_000006_WaitForMs { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 2000ms"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); + WaitForMs(expectation, queue, 2000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_6_1_000006_Stop +- (void)testSendClusterTest_TC_LVL_6_1_000007_Stop { XCTestExpectation * expectation = [self expectationWithDescription:@"Sends stop command to DUT"]; @@ -12666,7 +12746,64 @@ - (void)testSendClusterTest_TC_LVL_6_1_000006_Stop [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_6_1_000007_Off +- (void)testSendClusterTest_TC_LVL_6_1_000008_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentLevel attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 2); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000009_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:254]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Reset level to 254 Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000010_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000011_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 0d9f4b013f075d..66b8492984f950 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -17413,56 +17413,60 @@ class Test_TC_LVL_2_1 : public TestCommand err = TestReadsTheCurrentLevelAttribute_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the RemainingTime attribute\n"); - err = TestReadsTheRemainingTimeAttribute_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the CurrentLevel attribute\n"); + err = TestReadsTheCurrentLevelAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the MinLevel attribute\n"); - err = TestReadsTheMinLevelAttribute_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the RemainingTime attribute\n"); + err = TestReadsTheRemainingTimeAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the MaxLevel attribute\n"); - err = TestReadsTheMaxLevelAttribute_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the MinLevel attribute\n"); + err = TestReadsTheMinLevelAttribute_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the CurrentFrequency attribute\n"); - err = TestReadsTheCurrentFrequencyAttribute_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the MaxLevel attribute\n"); + err = TestReadsTheMaxLevelAttribute_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the MinFrequency attribute\n"); - err = TestReadsTheMinFrequencyAttribute_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the CurrentFrequency attribute\n"); + err = TestReadsTheCurrentFrequencyAttribute_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the MaxFrequency attribute\n"); - err = TestReadsTheMaxFrequencyAttribute_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the MinFrequency attribute\n"); + err = TestReadsTheMinFrequencyAttribute_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the OnOffTransitionTime attribute\n"); - err = TestReadsTheOnOffTransitionTimeAttribute_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the MaxFrequency attribute\n"); + err = TestReadsTheMaxFrequencyAttribute_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reads the OnLevel attribute \n"); - err = TestReadsTheOnLevelAttribute_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Reads the OnOffTransitionTime attribute\n"); + err = TestReadsTheOnOffTransitionTimeAttribute_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the OnTransitionTime attribute \n"); - err = TestReadsTheOnTransitionTimeAttribute_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the OnLevel attribute \n"); + err = TestReadsTheOnLevelAttribute_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reads the OffTransitionTime attribute \n"); - err = TestReadsTheOffTransitionTimeAttribute_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Reads the OnTransitionTime attribute \n"); + err = TestReadsTheOnTransitionTimeAttribute_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Reads the DefaultMoveRate attribute \n"); - err = TestReadsTheDefaultMoveRateAttribute_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Reads the OffTransitionTime attribute \n"); + err = TestReadsTheOffTransitionTimeAttribute_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Reads the Options attribute \n"); - err = TestReadsTheOptionsAttribute_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Reads the DefaultMoveRate attribute \n"); + err = TestReadsTheDefaultMoveRateAttribute_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Reads the StartUpCurrentLevel attribute \n"); - err = TestReadsTheStartUpCurrentLevelAttribute_14(); + ChipLogProgress(chipTool, " ***** Test Step 14 : Reads the Options attribute \n"); + err = TestReadsTheOptionsAttribute_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Reads the StartUpCurrentLevel attribute \n"); + err = TestReadsTheStartUpCurrentLevelAttribute_15(); break; } @@ -17475,7 +17479,7 @@ class Test_TC_LVL_2_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 15; + const uint16_t mTestCount = 16; chip::Optional mCluster; chip::Optional mEndpoint; @@ -17495,9 +17499,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_2(void * context, uint16_t remainingTime) + static void OnSuccessCallback_2(void * context, uint8_t currentLevel) { - (static_cast(context))->OnSuccessResponse_2(remainingTime); + (static_cast(context))->OnSuccessResponse_2(currentLevel); } static void OnFailureCallback_3(void * context, EmberAfStatus status) @@ -17505,9 +17509,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_3(void * context, uint8_t minLevel) + static void OnSuccessCallback_3(void * context, uint16_t remainingTime) { - (static_cast(context))->OnSuccessResponse_3(minLevel); + (static_cast(context))->OnSuccessResponse_3(remainingTime); } static void OnFailureCallback_4(void * context, EmberAfStatus status) @@ -17515,9 +17519,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_4(status); } - static void OnSuccessCallback_4(void * context, uint8_t maxLevel) + static void OnSuccessCallback_4(void * context, uint8_t minLevel) { - (static_cast(context))->OnSuccessResponse_4(maxLevel); + (static_cast(context))->OnSuccessResponse_4(minLevel); } static void OnFailureCallback_5(void * context, EmberAfStatus status) @@ -17525,9 +17529,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_5(status); } - static void OnSuccessCallback_5(void * context, uint16_t currentFrequency) + static void OnSuccessCallback_5(void * context, uint8_t maxLevel) { - (static_cast(context))->OnSuccessResponse_5(currentFrequency); + (static_cast(context))->OnSuccessResponse_5(maxLevel); } static void OnFailureCallback_6(void * context, EmberAfStatus status) @@ -17535,9 +17539,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_6(status); } - static void OnSuccessCallback_6(void * context, uint16_t minFrequency) + static void OnSuccessCallback_6(void * context, uint16_t currentFrequency) { - (static_cast(context))->OnSuccessResponse_6(minFrequency); + (static_cast(context))->OnSuccessResponse_6(currentFrequency); } static void OnFailureCallback_7(void * context, EmberAfStatus status) @@ -17545,9 +17549,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_7(status); } - static void OnSuccessCallback_7(void * context, uint16_t maxFrequency) + static void OnSuccessCallback_7(void * context, uint16_t minFrequency) { - (static_cast(context))->OnSuccessResponse_7(maxFrequency); + (static_cast(context))->OnSuccessResponse_7(minFrequency); } static void OnFailureCallback_8(void * context, EmberAfStatus status) @@ -17555,9 +17559,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_8(status); } - static void OnSuccessCallback_8(void * context, uint16_t onOffTransitionTime) + static void OnSuccessCallback_8(void * context, uint16_t maxFrequency) { - (static_cast(context))->OnSuccessResponse_8(onOffTransitionTime); + (static_cast(context))->OnSuccessResponse_8(maxFrequency); } static void OnFailureCallback_9(void * context, EmberAfStatus status) @@ -17565,9 +17569,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_9(status); } - static void OnSuccessCallback_9(void * context, const chip::app::DataModel::Nullable & onLevel) + static void OnSuccessCallback_9(void * context, uint16_t onOffTransitionTime) { - (static_cast(context))->OnSuccessResponse_9(onLevel); + (static_cast(context))->OnSuccessResponse_9(onOffTransitionTime); } static void OnFailureCallback_10(void * context, EmberAfStatus status) @@ -17575,9 +17579,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_10(status); } - static void OnSuccessCallback_10(void * context, const chip::app::DataModel::Nullable & onTransitionTime) + static void OnSuccessCallback_10(void * context, const chip::app::DataModel::Nullable & onLevel) { - (static_cast(context))->OnSuccessResponse_10(onTransitionTime); + (static_cast(context))->OnSuccessResponse_10(onLevel); } static void OnFailureCallback_11(void * context, EmberAfStatus status) @@ -17585,9 +17589,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_11(status); } - static void OnSuccessCallback_11(void * context, const chip::app::DataModel::Nullable & offTransitionTime) + static void OnSuccessCallback_11(void * context, const chip::app::DataModel::Nullable & onTransitionTime) { - (static_cast(context))->OnSuccessResponse_11(offTransitionTime); + (static_cast(context))->OnSuccessResponse_11(onTransitionTime); } static void OnFailureCallback_12(void * context, EmberAfStatus status) @@ -17595,9 +17599,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_12(status); } - static void OnSuccessCallback_12(void * context, const chip::app::DataModel::Nullable & defaultMoveRate) + static void OnSuccessCallback_12(void * context, const chip::app::DataModel::Nullable & offTransitionTime) { - (static_cast(context))->OnSuccessResponse_12(defaultMoveRate); + (static_cast(context))->OnSuccessResponse_12(offTransitionTime); } static void OnFailureCallback_13(void * context, EmberAfStatus status) @@ -17605,9 +17609,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_13(status); } - static void OnSuccessCallback_13(void * context, uint8_t options) + static void OnSuccessCallback_13(void * context, const chip::app::DataModel::Nullable & defaultMoveRate) { - (static_cast(context))->OnSuccessResponse_13(options); + (static_cast(context))->OnSuccessResponse_13(defaultMoveRate); } static void OnFailureCallback_14(void * context, EmberAfStatus status) @@ -17615,9 +17619,19 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_14(status); } - static void OnSuccessCallback_14(void * context, uint8_t startUpCurrentLevel) + static void OnSuccessCallback_14(void * context, uint8_t options) + { + (static_cast(context))->OnSuccessResponse_14(options); + } + + static void OnFailureCallback_15(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_15(status); + } + + static void OnSuccessCallback_15(void * context, uint8_t startUpCurrentLevel) { - (static_cast(context))->OnSuccessResponse_14(startUpCurrentLevel); + (static_cast(context))->OnSuccessResponse_15(startUpCurrentLevel); } // @@ -17645,259 +17659,279 @@ class Test_TC_LVL_2_1 : public TestCommand void OnSuccessResponse_1(uint8_t currentLevel) { - VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); + NextTest(); } - CHIP_ERROR TestReadsTheRemainingTimeAttribute_2() + CHIP_ERROR TestReadsTheCurrentLevelAttribute_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_2, OnFailureCallback_2)); return CHIP_NO_ERROR; } void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint16_t remainingTime) + void OnSuccessResponse_2(uint8_t currentLevel) + { + VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); + NextTest(); + } + + CHIP_ERROR TestReadsTheRemainingTimeAttribute_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint16_t remainingTime) { VerifyOrReturn(CheckValue("remainingTime", remainingTime, 0U)); NextTest(); } - CHIP_ERROR TestReadsTheMinLevelAttribute_3() + CHIP_ERROR TestReadsTheMinLevelAttribute_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3)); + this, OnSuccessCallback_4, OnFailureCallback_4)); return CHIP_NO_ERROR; } - void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(uint8_t minLevel) + void OnSuccessResponse_4(uint8_t minLevel) { VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); NextTest(); } - CHIP_ERROR TestReadsTheMaxLevelAttribute_4() + CHIP_ERROR TestReadsTheMaxLevelAttribute_5() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4)); + this, OnSuccessCallback_5, OnFailureCallback_5)); return CHIP_NO_ERROR; } - void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(uint8_t maxLevel) + void OnSuccessResponse_5(uint8_t maxLevel) { VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); NextTest(); } - CHIP_ERROR TestReadsTheCurrentFrequencyAttribute_5() + CHIP_ERROR TestReadsTheCurrentFrequencyAttribute_6() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5)); + this, OnSuccessCallback_6, OnFailureCallback_6)); return CHIP_NO_ERROR; } - void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_6(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint16_t currentFrequency) + void OnSuccessResponse_6(uint16_t currentFrequency) { VerifyOrReturn(CheckValue("currentFrequency", currentFrequency, 0U)); NextTest(); } - CHIP_ERROR TestReadsTheMinFrequencyAttribute_6() + CHIP_ERROR TestReadsTheMinFrequencyAttribute_7() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6)); + this, OnSuccessCallback_7, OnFailureCallback_7)); return CHIP_NO_ERROR; } - void OnFailureResponse_6(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(uint16_t minFrequency) + void OnSuccessResponse_7(uint16_t minFrequency) { VerifyOrReturn(CheckValue("minFrequency", minFrequency, 0U)); NextTest(); } - CHIP_ERROR TestReadsTheMaxFrequencyAttribute_7() + CHIP_ERROR TestReadsTheMaxFrequencyAttribute_8() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7)); + this, OnSuccessCallback_8, OnFailureCallback_8)); return CHIP_NO_ERROR; } - void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_8(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(uint16_t maxFrequency) + void OnSuccessResponse_8(uint16_t maxFrequency) { VerifyOrReturn(CheckValue("maxFrequency", maxFrequency, 0U)); NextTest(); } - CHIP_ERROR TestReadsTheOnOffTransitionTimeAttribute_8() + CHIP_ERROR TestReadsTheOnOffTransitionTimeAttribute_9() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8)); + this, OnSuccessCallback_9, OnFailureCallback_9)); return CHIP_NO_ERROR; } - void OnFailureResponse_8(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_9(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(uint16_t onOffTransitionTime) + void OnSuccessResponse_9(uint16_t onOffTransitionTime) { VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); NextTest(); } - CHIP_ERROR TestReadsTheOnLevelAttribute_9() + CHIP_ERROR TestReadsTheOnLevelAttribute_10() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9)); + this, OnSuccessCallback_10, OnFailureCallback_10)); return CHIP_NO_ERROR; } - void OnFailureResponse_9(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_10(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(const chip::app::DataModel::Nullable & onLevel) + void OnSuccessResponse_10(const chip::app::DataModel::Nullable & onLevel) { VerifyOrReturn(CheckConstraintType("onLevel", "", "uint8")); NextTest(); } - CHIP_ERROR TestReadsTheOnTransitionTimeAttribute_10() + CHIP_ERROR TestReadsTheOnTransitionTimeAttribute_11() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10)); + this, OnSuccessCallback_11, OnFailureCallback_11)); return CHIP_NO_ERROR; } - void OnFailureResponse_10(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_11(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(const chip::app::DataModel::Nullable & onTransitionTime) + void OnSuccessResponse_11(const chip::app::DataModel::Nullable & onTransitionTime) { VerifyOrReturn(CheckConstraintType("onTransitionTime", "", "uint16")); NextTest(); } - CHIP_ERROR TestReadsTheOffTransitionTimeAttribute_11() + CHIP_ERROR TestReadsTheOffTransitionTimeAttribute_12() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11)); + this, OnSuccessCallback_12, OnFailureCallback_12)); return CHIP_NO_ERROR; } - void OnFailureResponse_11(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_12(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_11(const chip::app::DataModel::Nullable & offTransitionTime) + void OnSuccessResponse_12(const chip::app::DataModel::Nullable & offTransitionTime) { VerifyOrReturn(CheckConstraintType("offTransitionTime", "", "uint16")); NextTest(); } - CHIP_ERROR TestReadsTheDefaultMoveRateAttribute_12() + CHIP_ERROR TestReadsTheDefaultMoveRateAttribute_13() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12)); + this, OnSuccessCallback_13, OnFailureCallback_13)); return CHIP_NO_ERROR; } - void OnFailureResponse_12(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_13(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_12(const chip::app::DataModel::Nullable & defaultMoveRate) + void OnSuccessResponse_13(const chip::app::DataModel::Nullable & defaultMoveRate) { VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); NextTest(); } - CHIP_ERROR TestReadsTheOptionsAttribute_13() + CHIP_ERROR TestReadsTheOptionsAttribute_14() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13)); + this, OnSuccessCallback_14, OnFailureCallback_14)); return CHIP_NO_ERROR; } - void OnFailureResponse_13(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_14(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_13(uint8_t options) + void OnSuccessResponse_14(uint8_t options) { VerifyOrReturn(CheckValue("options", options, 0)); NextTest(); } - CHIP_ERROR TestReadsTheStartUpCurrentLevelAttribute_14() + CHIP_ERROR TestReadsTheStartUpCurrentLevelAttribute_15() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14)); + this, OnSuccessCallback_15, OnFailureCallback_15)); return CHIP_NO_ERROR; } - void OnFailureResponse_14(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_15(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_14(uint8_t startUpCurrentLevel) + void OnSuccessResponse_15(uint8_t startUpCurrentLevel) { VerifyOrReturn(CheckValue("startUpCurrentLevel", startUpCurrentLevel, 0)); @@ -18527,7 +18561,7 @@ class Test_TC_LVL_3_1 : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads current Level attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 1 : reads CurrentLevel attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_1(); break; case 2: @@ -18547,7 +18581,7 @@ class Test_TC_LVL_3_1 : public TestCommand err = TestWait100ms_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : reads current Level attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 6 : reads CurrentLevel attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_6(); break; case 7: @@ -18559,7 +18593,7 @@ class Test_TC_LVL_3_1 : public TestCommand err = TestWait200ms_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads current Level attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 9 : reads CurrentLevel attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_9(); break; case 10: @@ -18575,7 +18609,7 @@ class Test_TC_LVL_3_1 : public TestCommand err = TestWait10ms_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : reads current Level attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 13 : reads CurrentLevel attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_13(); break; case 14: @@ -18994,7 +19028,7 @@ class Test_TC_LVL_4_1 : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads current level attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 1 : reads CurrentLevel attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_1(); break; case 2: @@ -19010,7 +19044,7 @@ class Test_TC_LVL_4_1 : public TestCommand err = TestWait3000ms_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : reads current level attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 5 : reads CurrentLevel attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_5(); break; case 6: @@ -19026,7 +19060,7 @@ class Test_TC_LVL_4_1 : public TestCommand err = TestWait3000ms_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads current level attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 9 : reads CurrentLevel attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_9(); break; case 10: @@ -19046,7 +19080,7 @@ class Test_TC_LVL_4_1 : public TestCommand err = TestWait100ms_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : reads current level attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 14 : reads CurrentLevel attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_14(); break; case 15: @@ -19532,8 +19566,16 @@ class Test_TC_LVL_5_1 : public TestCommand err = TestReadsCurrentLevelAttributeFromDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Sending off command\n"); - err = TestSendingOffCommand_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Reset level to 254\n"); + err = TestResetLevelTo254_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); + err = TestWait100ms_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Sending off command\n"); + err = TestSendingOffCommand_13(); break; } @@ -19546,7 +19588,7 @@ class Test_TC_LVL_5_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; + const uint16_t mTestCount = 14; chip::Optional mCluster; chip::Optional mEndpoint; @@ -19776,12 +19818,16 @@ class Test_TC_LVL_5_1 : public TestCommand NextTest(); } - CHIP_ERROR TestSendingOffCommand_11() + CHIP_ERROR TestResetLevelTo254_11() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; RequestType request; + request.level = 254; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_11(); @@ -19798,6 +19844,35 @@ class Test_TC_LVL_5_1 : public TestCommand void OnFailureResponse_11(EmberAfStatus status) { ThrowFailureResponse(); } void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestWait100ms_12() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + + CHIP_ERROR TestSendingOffCommand_13() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_13(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_13(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_13() { NextTest(); } }; class Test_TC_LVL_6_1 : public TestCommand @@ -19843,28 +19918,44 @@ class Test_TC_LVL_6_1 : public TestCommand err = TestSendingOnCommand_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: DUT level is set to 0x80\n"); - err = TestPreconditionDutLevelIsSetTo0x80_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: set DUT to lowest point\n"); + err = TestPreconditionSetDutToLowestPoint_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); - err = TestWait3000ms_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 100ms\n"); + err = TestWait100ms_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Sends a move up command to DUT\n"); - err = TestSendsAMoveUpCommandToDut_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 3000ms\n"); - err = TestWait3000ms_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Sends a move up command to DUT\n"); + err = TestSendsAMoveUpCommandToDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Sends stop command to DUT\n"); - err = TestSendsStopCommandToDut_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 2000ms\n"); + err = TestWait2000ms_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Sending off command\n"); - err = TestSendingOffCommand_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Sends stop command to DUT\n"); + err = TestSendsStopCommandToDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Reset level to 254\n"); + err = TestResetLevelTo254_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Wait 100ms\n"); + err = TestWait100ms_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Sending off command\n"); + err = TestSendingOffCommand_11(); break; } @@ -19877,11 +19968,31 @@ class Test_TC_LVL_6_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + const uint16_t mTestCount = 12; chip::Optional mCluster; chip::Optional mEndpoint; + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_4(currentLevel); + } + + static void OnFailureCallback_8(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_8(status); + } + + static void OnSuccessCallback_8(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_8(currentLevel); + } + // // Tests methods // @@ -19915,17 +20026,16 @@ class Test_TC_LVL_6_1 : public TestCommand void OnSuccessResponse_1() { NextTest(); } - CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_2() + CHIP_ERROR TestPreconditionSetDutToLowestPoint_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; RequestType request; - request.stepMode = static_cast(0); - request.stepSize = 128; - request.transitionTime = 20U; - request.optionMask = 0; - request.optionOverride = 0; + request.level = 0; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; auto success = [](void * context, const typename RequestType::ResponseType & data) { (static_cast(context))->OnSuccessResponse_2(); @@ -19943,13 +20053,33 @@ class Test_TC_LVL_6_1 : public TestCommand void OnSuccessResponse_2() { NextTest(); } - CHIP_ERROR TestWait3000ms_3() + CHIP_ERROR TestWait100ms_3() { SetIdentity(kIdentityAlpha); - return WaitForMs(3000); + return WaitForMs(100); + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + + NextTest(); } - CHIP_ERROR TestSendsAMoveUpCommandToDut_4() + CHIP_ERROR TestSendsAMoveUpCommandToDut_5() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; @@ -19961,28 +20091,28 @@ class Test_TC_LVL_6_1 : public TestCommand request.optionOverride = 1; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); + (static_cast(context))->OnSuccessResponse_5(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_5(status); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_4() { NextTest(); } + void OnSuccessResponse_5() { NextTest(); } - CHIP_ERROR TestWait3000ms_5() + CHIP_ERROR TestWait2000ms_6() { SetIdentity(kIdentityAlpha); - return WaitForMs(3000); + return WaitForMs(2000); } - CHIP_ERROR TestSendsStopCommandToDut_6() + CHIP_ERROR TestSendsStopCommandToDut_7() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; using RequestType = chip::app::Clusters::LevelControl::Commands::Stop::Type; @@ -19992,22 +20122,75 @@ class Test_TC_LVL_6_1 : public TestCommand request.optionOverride = 0; auto success = [](void * context, const typename RequestType::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); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_6(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_6() { NextTest(); } + void OnSuccessResponse_7() { NextTest(); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 2)); - CHIP_ERROR TestSendingOffCommand_7() + NextTest(); + } + + CHIP_ERROR TestResetLevelTo254_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + + RequestType request; + request.level = 254; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_9(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_9(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9() { NextTest(); } + + CHIP_ERROR TestWait100ms_10() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + + CHIP_ERROR TestSendingOffCommand_11() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; @@ -20015,20 +20198,20 @@ class Test_TC_LVL_6_1 : public TestCommand RequestType request; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); + (static_cast(context))->OnSuccessResponse_11(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_11(status); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_11(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_7() { NextTest(); } + void OnSuccessResponse_11() { NextTest(); } }; class Test_TC_MC_1_1 : public TestCommand