Skip to content

Commit

Permalink
unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Kuzin authored and aleksandr-kuzin committed Nov 19, 2024
1 parent 7283a3e commit a115c62
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
14 changes: 14 additions & 0 deletions asam_cmp_data_sink/tests/test_capture_fb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ TEST_F(CaptureFbTest, FunctionBlockType)
ASSERT_EQ(type.getDescription(), "ASAM CMP Capture");
}

TEST_F(CaptureFbTest, AvailableFunctionBlockTypes)
{
auto availableTypes = captureFb.getAvailableFunctionBlockTypes();
ASSERT_EQ(availableTypes.getCount(), 1);
ASSERT_TRUE(availableTypes.hasKey("AsamCmpInterface"));
ASSERT_EQ(availableTypes.get("AsamCmpInterface"), asam_cmp_common_lib::InterfaceCommonFb::CreateType());
}

TEST_F(CaptureFbTest, OnAddFunctionBlocks)
{
EXPECT_NO_THROW(captureFb.addFunctionBlock("AsamCmpInterface"));
EXPECT_THROW(captureFb.addFunctionBlock("AsamCmpStream"), daq::NotFoundException);
}

TEST_F(CaptureFbTest, CaptureModuleProperties)
{
ASSERT_TRUE(captureFb.hasProperty("DeviceId"));
Expand Down
15 changes: 15 additions & 0 deletions asam_cmp_data_sink/tests/test_data_sink_fb.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <asam_cmp_data_sink/data_sink_fb.h>
#include <asam_cmp_data_sink/status_fb_impl.h>
#include <asam_cmp_data_sink/status_handler.h>
#include <asam_cmp_data_sink/capture_fb.h>

#include <asam_cmp/capture_module_payload.h>
#include <asam_cmp/interface_payload.h>
Expand Down Expand Up @@ -81,6 +82,20 @@ TEST_F(DataSinkFbTest, FunctionBlockType)
ASSERT_EQ(type.getDescription(), "ASAM CMP Data Sink");
}

TEST_F(DataSinkFbTest, AvailableFunctionBlockTypes)
{
auto availableTypes = funcBlock.getAvailableFunctionBlockTypes();
ASSERT_EQ(availableTypes.getCount(), 1);
ASSERT_TRUE(availableTypes.hasKey("AsamCmpCapture"));
ASSERT_EQ(availableTypes.get("AsamCmpCapture"), CaptureFb::CreateType());
}

TEST_F(DataSinkFbTest, OnAddFunctionBlocks)
{
EXPECT_NO_THROW(funcBlock.addFunctionBlock("AsamCmpCapture"));
EXPECT_THROW(funcBlock.addFunctionBlock("AsamCmpStream"), daq::NotFoundException);
}

TEST_F(DataSinkFbTest, AddCaptureModuleFromStatusReadOnly)
{
auto proc = daq::Procedure([]() {});
Expand Down
15 changes: 15 additions & 0 deletions asam_cmp_data_sink/tests/test_interface_fb.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <asam_cmp_data_sink/capture_fb.h>
#include <asam_cmp_data_sink/stream_fb.h>
#include <asam_cmp_data_sink/common.h>

#include <gtest/gtest.h>
Expand Down Expand Up @@ -45,6 +46,20 @@ TEST_F(InterfaceFbTest, FunctionBlockType)
ASSERT_EQ(type.getDescription(), "ASAM CMP Interface");
}

TEST_F(InterfaceFbTest, AvailableFunctionBlockTypes)
{
auto availableTypes = interfaceFb.getAvailableFunctionBlockTypes();
ASSERT_EQ(availableTypes.getCount(), 1);
ASSERT_TRUE(availableTypes.hasKey("AsamCmpStream"));
ASSERT_EQ(availableTypes.get("AsamCmpStream"), modules::asam_cmp_data_sink_module::StreamFb::CreateType());
}

TEST_F(InterfaceFbTest, OnAddFunctionBlocks)
{
EXPECT_NO_THROW(interfaceFb.addFunctionBlock("AsamCmpStream"));
EXPECT_THROW(interfaceFb.addFunctionBlock("AsamCmpCapture"), daq::NotFoundException);
}

TEST_F(InterfaceFbTest, CaptureModuleProperties)
{
ASSERT_TRUE(interfaceFb.hasProperty("InterfaceId"));
Expand Down

0 comments on commit a115c62

Please sign in to comment.