ifw-fcf 8.0.2
 
Loading...
Searching...
No Matches
mockHelpers.hpp File Reference

Small helpers for unit tests that exercise MockICommAdapter. More...

#include <ifw/fnd/defs/iCommAdapter.hpp>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Namespaces

namespace  ifw
 
namespace  ifw::fcf
 ActionsEnable class source file.
 
namespace  ifw::fcf::devmgr
 actuatorLcsIf class header file.
 
namespace  ifw::fcf::devmgr::test
 

Functions

ifw::fnd::defs::CallResult ifw::fcf::devmgr::test::MakeRpcReply (short code, ifw::fnd::defs::Status batch_status=ifw::fnd::defs::Status::Ok)
 Build a CallResult that carries a single short reply code, matching the convention every FCF RPC uses (RPC reply in output_arguments[0].data.value as short).
 
ifw::fnd::defs::ReadResult ifw::fcf::devmgr::test::MakeReadReply (std::vector< std::pair< std::string, ifw::fnd::defs::Value > > items)
 Build a ReadResult from a list of (address, value) pairs. Every item is marked Ok. Suitable for stubbing the node-status reads done by DeviceLcsIf.
 
ifw::fnd::defs::Result ifw::fcf::devmgr::test::MakeOk ()
 Build a generic "Ok" Result.
 
ifw::fnd::defs::WriteResult ifw::fcf::devmgr::test::MakeWriteOk (const ifw::fnd::defs::WriteRequest &req)
 Build a WriteResult that succeeds for every item address in the request. Reflects the typical Write success path.
 
ifw::fnd::defs::SubscribeResult ifw::fcf::devmgr::test::MakeSubscribeOk (const std::vector< ifw::fnd::defs::Address > &nodes)
 Build a SubscribeResult acknowledging every requested node.
 

Detailed Description

Small helpers for unit tests that exercise MockICommAdapter.

The new ICommAdapter API has structured results (CallResult, ReadResult, ...) instead of out-parameters. Constructing those inline in every test would be noisy, so collect the recipes here.