Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test] Add Test_TC_DM_3_1 #8067

Merged
merged 2 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion examples/chip-tool/commands/tests/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -11786,13 +11786,53 @@ class Test_10_1_1 : public TestCommand
}
};

class Test_TC_DM_3_1 : public TestCommand
{
public:
Test_TC_DM_3_1() : TestCommand("Test_TC_DM_3_1"), mTestIndex(0) {}

/////////// TestCommand Interface /////////
void NextTest() override
{
CHIP_ERROR err = CHIP_NO_ERROR;

if (mTestCount == mTestIndex)
{
ChipLogProgress(chipTool, "Test_TC_DM_3_1: Test complete");
SetCommandExitStatus(CHIP_NO_ERROR);
}

// Ensure we increment mTestIndex before we start running the relevant
// command. That way if we lose the timeslice after we send the message
// but before our function call returns, we won't end up with an
// incorrect mTestIndex value observed when we get the response.
switch (mTestIndex++)
{
}

if (CHIP_NO_ERROR != err)
{
ChipLogProgress(chipTool, "Test_TC_DM_3_1: %s", chip::ErrorStr(err));
SetCommandExitStatus(err);
}
}

private:
std::atomic_uint16_t mTestIndex;
const uint16_t mTestCount = 0;

//
// Tests methods
//
};

void registerCommandsTests(Commands & commands)
{
const char * clusterName = "Tests";

commands_list clusterCommands = {
make_unique<TestCluster>(), make_unique<Test_3_1_1>(), make_unique<Test_3_2_1>(),
make_unique<Test_3_2_2>(), make_unique<Test_10_1_1>(),
make_unique<Test_3_2_2>(), make_unique<Test_10_1_1>(), make_unique<Test_TC_DM_3_1>(),
};

commands.Register(clusterName, clusterCommands);
Expand Down
3 changes: 2 additions & 1 deletion examples/chip-tool/templates/tests-commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "TestCommand.h"

{{>test_cluster tests="TestCluster, Test_3_1_1, Test_3_2_1, Test_3_2_2, Test_10_1_1"}}
{{>test_cluster tests="TestCluster, Test_3_1_1, Test_3_2_1, Test_3_2_2, Test_10_1_1, Test_TC_DM_3_1"}}

void registerCommandsTests(Commands & commands)
{
Expand All @@ -16,6 +16,7 @@ void registerCommandsTests(Commands & commands)
make_unique<Test_3_2_1>(),
make_unique<Test_3_2_2>(),
make_unique<Test_10_1_1>(),
make_unique<Test_TC_DM_3_1>(),
};

commands.Register(clusterName, clusterCommands);
Expand Down
38 changes: 38 additions & 0 deletions src/app/tests/suites/Test_TC_DM_3_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: 10.3.1. [TC-DM-3.1] Network Commissioning Attributes

config:
cluster: "Network Commissioning"
endpoint: 0

tests:
- label: "Query MaxNetworks"
command: "readAttribute"
attribute: "MaxNetworks"
disabled: true
optional: true
response:
constraints:
type: uint8

- label: "Query Networks"
command: "readAttribute"
attribute: "Networks"
disabled: true
optional: true
response:
constraints:
type: list
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/templates/clusters-tests.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ CHIPDevice * GetPairedDevice(uint64_t deviceId)
[self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil];
}

{{>test_cluster tests="TestCluster, Test_3_1_1, Test_3_2_1, Test_3_2_2, Test_10_1_1"}}
{{>test_cluster tests="TestCluster, Test_3_1_1, Test_3_2_1, Test_3_2_2, Test_10_1_1, Test_TC_DM_3_1"}}

{{#chip_client_clusters}}
{{#unless (isStrEqual "Test Cluster" name)}}
Expand Down