3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "modchannels.h"
25 class TestModChannels : public TestBase
28 TestModChannels() { TestManager::registerTestModule(this); }
29 const char *getName() { return "TestModChannels"; }
31 void runTests(IGameDef *gamedef);
33 void testJoinChannel(IGameDef *gamedef);
34 void testLeaveChannel(IGameDef *gamedef);
35 void testSendMessageToChannel(IGameDef *gamedef);
38 static TestModChannels g_test_instance;
40 void TestModChannels::runTests(IGameDef *gamedef)
42 TEST(testJoinChannel, gamedef);
43 TEST(testLeaveChannel, gamedef);
44 TEST(testSendMessageToChannel, gamedef);
47 void TestModChannels::testJoinChannel(IGameDef *gamedef)
50 UASSERT(gamedef->joinModChannel("test_join_channel"));
51 // Test join (fail, already join)
52 UASSERT(!gamedef->joinModChannel("test_join_channel"));
55 void TestModChannels::testLeaveChannel(IGameDef *gamedef)
57 // Test leave (not joined)
58 UASSERT(!gamedef->leaveModChannel("test_leave_channel"));
60 UASSERT(gamedef->joinModChannel("test_leave_channel"));
62 // Test leave (joined)
63 UASSERT(gamedef->leaveModChannel("test_leave_channel"));
66 void TestModChannels::testSendMessageToChannel(IGameDef *gamedef)
68 // Test sendmsg (not joined)
69 UASSERT(!gamedef->sendModChannelMessage(
70 "test_sendmsg_channel", "testmsgchannel"));
72 UASSERT(gamedef->joinModChannel("test_sendmsg_channel"));
74 // Test sendmsg (joined)
75 UASSERT(gamedef->sendModChannelMessage("test_sendmsg_channel", "testmsgchannel"));