Exemplo n.º 1
0
TEST(MessageTest, PrivCTCP) {
	CCTCPMessage msg;
	msg.Parse(":sender PRIVMSG receiver :\001text\001");
	EXPECT_EQ("sender", msg.GetNick().GetNick());
	EXPECT_EQ("PRIVMSG", msg.GetCommand());
	EXPECT_EQ("receiver", msg.GetTarget());
	EXPECT_EQ("text", msg.GetText());
	EXPECT_FALSE(msg.IsReply());
	EXPECT_EQ(CMessage::Type::CTCP, msg.GetType());

	msg.SetText("foo bar");
	EXPECT_EQ("foo bar", msg.GetText());
	EXPECT_EQ(":sender PRIVMSG receiver :\001foo bar\001", msg.ToString());
}
Exemplo n.º 2
0
TEST(MessageTest, CTCPReply) {
	CCTCPMessage msg;
	msg.Parse(":sender NOTICE nick :\001FOO bar\001");
	EXPECT_EQ("sender", msg.GetNick().GetNick());
	EXPECT_EQ("NOTICE", msg.GetCommand());
	EXPECT_EQ("nick", msg.GetTarget());
	EXPECT_EQ("FOO bar", msg.GetText());
	EXPECT_TRUE(msg.IsReply());
	EXPECT_EQ(CMessage::Type::CTCP, msg.GetType());

	msg.SetText("BAR foo");
	EXPECT_EQ("BAR foo", msg.GetText());
	EXPECT_EQ(":sender NOTICE nick :\001BAR foo\001", msg.ToString());
}