Change request #676

Improve irccdctl command tests

Added by David Demelier over 1 year ago. Updated 11 months ago.

Status:ClosedStart date:08/07/2017
Priority:NormalDue date:
Assignee:David Demelier% Done:


Category:testsEstimated time:3.00 h
Target version:3.0.0
MFD after: Branch:default
MFD revision: Bookmark:@


Tests are very repeatitive because:

  1. they are manually added in the constructor fixture test,
  2. there is always a poll call that actually wait for the response.

Use a template based command test

Since some tests use several commands to verify the result, allows variadic templates that instanciate and add all of these commands.

template <typename... Commands>
class command_test {
    template <typename Command>
    inline void add()
        auto x = std::make_unique<Command>();

    template <typename Command, typename Tail, typename... MoreTails>
    inline void add()
        add<Tail, MoreTails...>();


Add dedicated functions

Some of the commands will just wait for success/error responses. Add two functions:

  1. bool wait_success(const nlohmann::json& request), wait for a successful result command
  2. bool wait_error(const nlohmann::json& request, const std::string& reason), wait for an error response with the given reason


#1 Updated by David Demelier 11 months ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

Also available in: Atom PDF