using namespace std;

This commit is contained in:
john30
2014-11-22 20:56:53 +01:00
parent d97bc1bc34
commit 3a34267bee
10 changed files with 294 additions and 277 deletions
+14 -13
View File
@@ -21,6 +21,8 @@
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
SymbolString sstr = SymbolString("10feb5050427a915aa");
@@ -30,29 +32,28 @@ int main ()
if (strcasecmp(gotStr.c_str(), expectStr.c_str()) == 0)
std::cout << "ctor escaped successful." << std::endl;
else
std::cout << "ctor escaped invalid: got " << gotStr
<< ", expected " << expectStr << std::endl;
std::cout << "ctor escaped invalid: got " << gotStr << ", expected "
<< expectStr << std::endl;
unsigned char gotCrc = sstr.getCRC(), expectCrc = 0x77;
if (gotCrc == expectCrc)
std::cout << "CRC successful." << std::endl;
else
std::cout << "CRC invalid: got 0x"
<< std::nouppercase << std::setw(2) << std::hex
<< std::setfill('0') << static_cast<unsigned>(gotCrc)
<< ", expected 0x"
<< std::nouppercase << std::setw(2) << std::hex
<< std::setfill('0') << static_cast<unsigned>(expectCrc)
<< std::endl;
std::cout << "CRC invalid: got 0x" << std::nouppercase << std::setw(2)
<< std::hex << std::setfill('0')
<< static_cast<unsigned>(gotCrc) << ", expected 0x"
<< std::nouppercase << std::setw(2) << std::hex
<< std::setfill('0') << static_cast<unsigned>(expectCrc)
<< std::endl;
gotStr = sstr.getDataStr(), expectStr = "10feb5050427a915aa77";
if (strcasecmp(gotStr.c_str(), expectStr.c_str()) == 0)
std::cout << "unescape successful." << std::endl;
else
std::cout << "unescape invalid: got " << gotStr
<< ", expected " << expectStr << std::endl;
std::cout << "unescape invalid: got " << gotStr << ", expected "
<< expectStr << std::endl;
sstr = SymbolString("10feb5050427a90015a90177", true);
@@ -61,8 +62,8 @@ int main ()
if (strcasecmp(gotStr.c_str(), expectStr.c_str()) == 0)
std::cout << "ctor unescaped successful." << std::endl;
else
std::cout << "ctor unescaped invalid: got " << gotStr
<< ", expected " << expectStr << std::endl;
std::cout << "ctor unescaped invalid: got " << gotStr << ", expected "
<< expectStr << std::endl;
return 0;