diff --git a/src/BUILD.gn b/src/BUILD.gn index 79e18e0afc490a..648b70a9f2028c 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -101,7 +101,10 @@ if (chip_build_tests) { if (chip_device_platform != "nrfconnect" && chip_device_platform != "efr32") { # TODO(#10447): Controller test has HF on EFR32. - deps += [ "${chip_root}/src/controller/tests" ] + deps += [ + "${chip_root}/src/controller/tests", + "${chip_root}/src/controller/tests/data_model", + ] } if (current_os != "zephyr" && current_os != "mbed" && diff --git a/src/controller/tests/BUILD.gn b/src/controller/tests/BUILD.gn index f944124b504fcd..f274c53eb96862 100644 --- a/src/controller/tests/BUILD.gn +++ b/src/controller/tests/BUILD.gn @@ -33,7 +33,6 @@ chip_test_suite("tests") { "${chip_root}/src/app/common:cluster-objects", "${chip_root}/src/app/tests:helpers", "${chip_root}/src/controller", - "${chip_root}/src/controller/tests/data_model:interaction-tests", "${chip_root}/src/messaging/tests:helpers", "${chip_root}/src/transport/raw/tests:helpers", "${nlunit_test_root}:nlunit-test", diff --git a/src/controller/tests/data_model/BUILD.gn b/src/controller/tests/data_model/BUILD.gn index 7912f6c724422c..ca5c751390f0f9 100644 --- a/src/controller/tests/data_model/BUILD.gn +++ b/src/controller/tests/data_model/BUILD.gn @@ -19,8 +19,8 @@ import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") import("${chip_root}/src/platform/device.gni") -chip_test_suite("interaction-tests") { - output_name = "libInteractionTests" +chip_test_suite("data_model") { + output_name = "libDataModelTests" if (chip_device_platform != "mbed" && chip_device_platform != "efr32") { test_sources = [ "TestCommands.cpp" ] diff --git a/src/controller/tests/data_model/TestCommands.cpp b/src/controller/tests/data_model/TestCommands.cpp index faec93baf52364..9eb0523bdb4133 100644 --- a/src/controller/tests/data_model/TestCommands.cpp +++ b/src/controller/tests/data_model/TestCommands.cpp @@ -22,6 +22,7 @@ * */ +#include "app/data-model/NullObject.h" #include #include #include @@ -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(apContext); - TestCluster::Commands::TestSimpleArgumentRequest::Type request; + FakeRequest request; auto sessionHandle = ctx.GetSessionBobToAlice(); bool onSuccessWasCalled = false; @@ -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(apContext); - TestCluster::Commands::TestSimpleArgumentRequest::Type request; + FakeRequest request; auto sessionHandle = ctx.GetSessionBobToAlice(); bool onSuccessWasCalled = false; @@ -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(apContext); - TestCluster::Commands::TestSimpleArgumentRequest::Type request; + FakeRequest request; auto sessionHandle = ctx.GetSessionBobToAlice(); bool onSuccessWasCalled = false; diff --git a/src/controller/tests/data_model/TestRead.cpp b/src/controller/tests/data_model/TestRead.cpp index ea6519cc78ca8e..763d6a787ea309 100644 --- a/src/controller/tests/data_model/TestRead.cpp +++ b/src/controller/tests/data_model/TestRead.cpp @@ -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