-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented a command in DummyUDPProcessPlugin and tests to verify th…
…e functionality. Fixed runtime error in Dummy plugin and throw an exception if the supported command is not requested when execution is called. Added tests that use the Dummy plugin to test execute and requestCommands methods. Update cpp/frameProcessor/test/DummyUDPProcessPluginTest.cpp Co-authored-by: Gary Yendell <gary.yendell@diamond.ac.uk> Added clarification comments. Simplified boost test calls. Updated to use string commands with no parameters. Removed unused test code. Removed unused execution parameter constant.
- Loading branch information
Showing
4 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* DummyUDPProcessPluginTest.cpp | ||
* | ||
* Created on: 25 Sep 2024 | ||
* Author: Alan Greer | ||
*/ | ||
|
||
#include <boost/test/unit_test.hpp> | ||
#include <DebugLevelLogger.h> | ||
#include "FrameProcessorDefinitions.h" | ||
#include "DummyUDPProcessPlugin.h" | ||
#include "IpcMessage.h" | ||
|
||
class DummyUDPProcessPluginTestFixture { | ||
public: | ||
DummyUDPProcessPluginTestFixture() { | ||
set_debug_level(3); | ||
|
||
dummy_plugin.set_name("dummy"); | ||
} | ||
|
||
~DummyUDPProcessPluginTestFixture() {} | ||
|
||
FrameProcessor::DummyUDPProcessPlugin dummy_plugin; | ||
}; | ||
|
||
BOOST_FIXTURE_TEST_SUITE(DummyUDPProcessPluginUnitTest, DummyUDPProcessPluginTestFixture); | ||
|
||
BOOST_AUTO_TEST_CASE( DummyUDPProcessPlugin_commands ) | ||
{ | ||
std::vector<std::string> commands_reply; | ||
OdinData::IpcMessage command_reply; | ||
|
||
// Request the command set of the DummyUDPProcessPlugin | ||
BOOST_REQUIRE_NO_THROW(commands_reply = dummy_plugin.requestCommands()); | ||
|
||
// Verify the returned command set is as expected | ||
BOOST_CHECK_EQUAL(commands_reply[0], std::string("print")); | ||
|
||
// Verify that an incorrect commmand request is rejected | ||
BOOST_CHECK_THROW(dummy_plugin.execute("bad_command", command_reply), std::runtime_error); | ||
|
||
// Verify that a supported commmand request is accepted | ||
BOOST_REQUIRE_NO_THROW(dummy_plugin.execute("print", command_reply)); | ||
}; | ||
|
||
BOOST_AUTO_TEST_SUITE_END(); //DummyUDPProcessPluginUnitTest |