comparison tests/cmd-rule-move/main.cpp @ 488:7e273b7f4f92

Irccd: new coding style, closes #576
author David Demelier <markand@malikania.fr>
date Tue, 26 Sep 2017 17:18:47 +0200
parents 1fdedd2977d2
children c729f06c6f27
comparison
equal deleted inserted replaced
487:beb6c638b841 488:7e273b7f4f92
19 #include <command.hpp> 19 #include <command.hpp>
20 #include <command-tester.hpp> 20 #include <command-tester.hpp>
21 #include <service.hpp> 21 #include <service.hpp>
22 22
23 using namespace irccd; 23 using namespace irccd;
24 using namespace irccd::command;
25 24
26 class RuleMoveCommandTest : public CommandTester { 25 class RuleMoveCommandTest : public CommandTester {
27 protected: 26 protected:
28 nlohmann::json m_result; 27 nlohmann::json m_result;
29 28
40 return false; 39 return false;
41 } 40 }
42 41
43 public: 42 public:
44 RuleMoveCommandTest() 43 RuleMoveCommandTest()
45 : CommandTester(std::make_unique<RuleMoveCommand>()) 44 : CommandTester(std::make_unique<rule_move_command>())
46 { 45 {
47 m_irccd.commands().add(std::make_unique<RuleListCommand>()); 46 m_irccd.commands().add(std::make_unique<rule_list_command>());
48 m_irccd.rules().add(Rule( 47 m_irccd.rules().add(rule(
49 { "s0" }, 48 { "s0" },
50 { "c0" }, 49 { "c0" },
51 { "o0" }, 50 { "o0" },
52 { "p0" }, 51 { "p0" },
53 { "onMessage" }, 52 { "onMessage" },
54 RuleAction::Drop 53 rule::action_type::drop
55 )); 54 ));
56 m_irccd.rules().add(Rule( 55 m_irccd.rules().add(rule(
57 { "s1", }, 56 { "s1", },
58 { "c1", }, 57 { "c1", },
59 { "o1", }, 58 { "o1", },
60 { "p1", }, 59 { "p1", },
61 { "onMessage", }, 60 { "onMessage", },
62 RuleAction::Accept 61 rule::action_type::accept
63 )); 62 ));
64 m_irccd.rules().add(Rule( 63 m_irccd.rules().add(rule(
65 { "s2", }, 64 { "s2", },
66 { "c2", }, 65 { "c2", },
67 { "o2", }, 66 { "o2", },
68 { "p2", }, 67 { "p2", },
69 { "onMessage", }, 68 { "onMessage", },
70 RuleAction::Accept 69 rule::action_type::accept
71 )); 70 ));
72 m_irccdctl.client().onMessage.connect([&] (auto result) { 71 m_irccdctl.client().onMessage.connect([&] (auto result) {
73 m_result = result; 72 m_result = result;
74 }); 73 });
75 } 74 }