Skip to content

Commit

Permalink
Fixed up the tests to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjerryjohns committed Nov 15, 2021
1 parent cde94a9 commit 348d960
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 19 additions & 3 deletions src/controller/tests/data_model/TestCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*
*/

#include "app/data-model/NullObject.h"
#include <app-common/zap-generated/cluster-objects.h>
#include <app/AppBuildConfig.h>
#include <app/InteractionModelEngine.h>
Expand Down Expand Up @@ -223,8 +224,13 @@ void TestCommandInteraction::TestDataResponse(nlTestSuite * apSuite, void * apCo

void TestCommandInteraction::TestSuccessNoDataResponse(nlTestSuite * apSuite, void * apContext)
{
struct FakeRequest : public TestCluster::Commands::TestSimpleArgumentRequest::Type
{
using ResponseType = DataModel::NullObjectType;
};

TestContext & ctx = *static_cast<TestContext *>(apContext);
TestCluster::Commands::TestSimpleArgumentRequest::Type request;
FakeRequest request;
auto sessionHandle = ctx.GetSessionBobToAlice();

bool onSuccessWasCalled = false;
Expand Down Expand Up @@ -257,8 +263,13 @@ void TestCommandInteraction::TestSuccessNoDataResponse(nlTestSuite * apSuite, vo

void TestCommandInteraction::TestAsyncResponse(nlTestSuite * apSuite, void * apContext)
{
struct FakeRequest : public TestCluster::Commands::TestSimpleArgumentRequest::Type
{
using ResponseType = DataModel::NullObjectType;
};

TestContext & ctx = *static_cast<TestContext *>(apContext);
TestCluster::Commands::TestSimpleArgumentRequest::Type request;
FakeRequest request;
auto sessionHandle = ctx.GetSessionBobToAlice();

bool onSuccessWasCalled = false;
Expand Down Expand Up @@ -342,8 +353,13 @@ void TestCommandInteraction::TestFailure(nlTestSuite * apSuite, void * apContext

void TestCommandInteraction::TestSuccessNoDataResponseWithClusterStatus(nlTestSuite * apSuite, void * apContext)
{
struct FakeRequest : public TestCluster::Commands::TestSimpleArgumentRequest::Type
{
using ResponseType = DataModel::NullObjectType;
};

TestContext & ctx = *static_cast<TestContext *>(apContext);
TestCluster::Commands::TestSimpleArgumentRequest::Type request;
FakeRequest request;
auto sessionHandle = ctx.GetSessionBobToAlice();

bool onSuccessWasCalled = false;
Expand Down
2 changes: 1 addition & 1 deletion src/controller/tests/data_model/TestRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ CHIP_ERROR ReadSingleClusterData(FabricIndex aAccessingFabricIndex, const Concre

ReturnErrorOnFailure(DataModel::Encode(*(attributeData.GetWriter()),
chip::TLV::ContextTag(chip::to_underlying(AttributeDataIB::Tag::kData)), value));
attributeData.DataVersion(0);
attributeData.DataVersion(0).EndOfAttributeDataIB();
return CHIP_NO_ERROR;
}
else
Expand Down

0 comments on commit 348d960

Please sign in to comment.