← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3143: start a test file for ADC commands

 

------------------------------------------------------------
revno: 3143
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2012-11-23 21:10:50 +0100
message:
  start a test file for ADC commands
added:
  test/testadc.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== added file 'test/testadc.cpp'
--- test/testadc.cpp	1970-01-01 00:00:00 +0000
+++ test/testadc.cpp	2012-11-23 20:10:50 +0000
@@ -0,0 +1,19 @@
+#include "testbase.h"
+
+#include <dcpp/AdcCommand.h>
+
+using namespace dcpp;
+
+TEST(testadc, test_adccommand)
+{
+	string sidStr = "ABCD";
+	auto sid = AdcCommand::toSID(sidStr);
+
+	string sidStr2 = "1234";
+	auto sid2 = AdcCommand::toSID(sidStr2);
+
+	ASSERT_EQ("CSTA 151 lol\n",
+		AdcCommand(AdcCommand::SEV_RECOVERABLE, AdcCommand::ERROR_FILE_NOT_AVAILABLE, "lol").toString(sid));
+	ASSERT_EQ("DCTM " + sidStr + " " + sidStr2 + " param1 param2\n",
+		AdcCommand(AdcCommand::CMD_CTM, sid2, AdcCommand::TYPE_DIRECT).addParam("param1").addParam("param2").toString(sid));
+}