mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-07 18:52:30 +00:00
* Added missing command_new_slot.{cc,h} files.
* Converted more commands. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1150 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -7,6 +7,13 @@
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(CommandMapTest);
|
||||
|
||||
#undef CMD2_A_FUNCTION
|
||||
|
||||
#define CMD2_A_FUNCTION(key, function, func_type, slot, parm, doc) \
|
||||
commandNewSlotItr->set_function<rpc::func_type>(slot); \
|
||||
m_map.insert_type(key, commandNewSlotItr++, &rpc::function, \
|
||||
rpc::CommandMap::flag_dont_delete | rpc::CommandMap::flag_public_xmlrpc, NULL, NULL);
|
||||
|
||||
torrent::Object cmd_test_map_a(rpc::target_type t, const torrent::Object& obj) { return obj; }
|
||||
torrent::Object cmd_test_map_b(rpc::target_type t, const torrent::Object& obj, uint64_t c) { return torrent::Object(c); }
|
||||
|
||||
@@ -14,9 +21,9 @@ torrent::Object cmd_test_any_string(__UNUSED rpc::target_type target, const std:
|
||||
|
||||
void
|
||||
CommandMapTest::test_basics() {
|
||||
CMD2_A("test_a", &cmd_test_map_a);
|
||||
CMD2_A("test_b", std::tr1::bind(&cmd_test_map_b, std::tr1::placeholders::_1, std::tr1::placeholders::_2, (uint64_t)2));
|
||||
CMD2_A_STRING("any_string", &cmd_test_any_string);
|
||||
CMD2_ANY("test_a", &cmd_test_map_a);
|
||||
CMD2_ANY("test_b", std::tr1::bind(&cmd_test_map_b, std::tr1::placeholders::_1, std::tr1::placeholders::_2, (uint64_t)2));
|
||||
CMD2_ANY_STRING("any_string", &cmd_test_any_string);
|
||||
|
||||
CPPUNIT_ASSERT(m_map.call_command("test_a", (int64_t)1).as_value() == 1);
|
||||
CPPUNIT_ASSERT(m_map.call_command("test_b", (int64_t)1).as_value() == 2);
|
||||
|
||||
Reference in New Issue
Block a user