unified output
This commit is contained in:
@@ -53,7 +53,7 @@ int main()
|
|||||||
{"r;ehp;date;;;08;b509;0d2900;;;hda:3", "23.11.2014", "ff08b509030d290071", "03170b0e5a", "m"},
|
{"r;ehp;date;;;08;b509;0d2900;;;hda:3", "23.11.2014", "ff08b509030d290071", "03170b0e5a", "m"},
|
||||||
{"u;ehp;ActualEnvironmentPower;Energiebezug;;08;B509;29BA00;;s;IGN:2;;;;;s;power", "8", "1008b5090329ba00", "03ba0008", "pm"},
|
{"u;ehp;ActualEnvironmentPower;Energiebezug;;08;B509;29BA00;;s;IGN:2;;;;;s;power", "8", "1008b5090329ba00", "03ba0008", "pm"},
|
||||||
{"","55.50;ok","1025b50903290000","050000780300",""},
|
{"","55.50;ok","1025b50903290000","050000780300",""},
|
||||||
|
{"","no;25","10feb505042700190023","",""},
|
||||||
};
|
};
|
||||||
DataFieldTemplates* templates = new DataFieldTemplates();
|
DataFieldTemplates* templates = new DataFieldTemplates();
|
||||||
result_t result = templates->readFromFile("_types.csv");
|
result_t result = templates->readFromFile("_types.csv");
|
||||||
@@ -95,10 +95,10 @@ int main()
|
|||||||
if (entries.size() == 0) {
|
if (entries.size() == 0) {
|
||||||
message = messages->find(mstr);
|
message = messages->find(mstr);
|
||||||
if (message == NULL) {
|
if (message == NULL) {
|
||||||
cout << " find error: NULL" << endl;
|
cout << "\"" << check[2] << "\": find error: NULL" << endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cout << " find OK" << endl;
|
cout << "\"" << check[2] << "\": find OK" << endl;
|
||||||
} else {
|
} else {
|
||||||
vector<string>::iterator it = entries.begin();
|
vector<string>::iterator it = entries.begin();
|
||||||
result = Message::create(it, entries.end(), NULL, templates, deleteMessage);
|
result = Message::create(it, entries.end(), NULL, templates, deleteMessage);
|
||||||
@@ -134,10 +134,13 @@ int main()
|
|||||||
cout << " map OK" << endl;
|
cout << " map OK" << endl;
|
||||||
message = deleteMessage;
|
message = deleteMessage;
|
||||||
deleteMessage = NULL;
|
deleteMessage = NULL;
|
||||||
if (messages->find(mstr) == message)
|
Message* foundMessage = messages->find(mstr);
|
||||||
|
if (foundMessage == message)
|
||||||
cout << " find OK" << endl;
|
cout << " find OK" << endl;
|
||||||
else
|
else if (foundMessage == NULL)
|
||||||
cout << " find error: NULL" << endl;
|
cout << " find error: NULL" << endl;
|
||||||
|
else
|
||||||
|
cout << " find error: different" << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
message = deleteMessage;
|
message = deleteMessage;
|
||||||
|
|||||||
Regular → Executable
+8
-8
@@ -30,17 +30,17 @@ int main ()
|
|||||||
std::string gotStr = sstr.getDataStr(false), expectStr = "10feb5050427a90015a90177";
|
std::string gotStr = sstr.getDataStr(false), expectStr = "10feb5050427a90015a90177";
|
||||||
|
|
||||||
if (strcasecmp(gotStr.c_str(), expectStr.c_str()) == 0)
|
if (strcasecmp(gotStr.c_str(), expectStr.c_str()) == 0)
|
||||||
std::cout << "ctor escaped successful." << std::endl;
|
std::cout << "ctor escaped OK" << std::endl;
|
||||||
else
|
else
|
||||||
std::cout << "ctor escaped invalid: got " << gotStr << ", expected "
|
std::cout << "ctor escaped error: got " << gotStr << ", expected "
|
||||||
<< expectStr << std::endl;
|
<< expectStr << std::endl;
|
||||||
|
|
||||||
unsigned char gotCrc = sstr.getCRC(), expectCrc = 0x77;
|
unsigned char gotCrc = sstr.getCRC(), expectCrc = 0x77;
|
||||||
|
|
||||||
if (gotCrc == expectCrc)
|
if (gotCrc == expectCrc)
|
||||||
std::cout << "CRC successful." << std::endl;
|
std::cout << "CRC OK" << std::endl;
|
||||||
else
|
else
|
||||||
std::cout << "CRC invalid: got 0x" << std::nouppercase << std::setw(2)
|
std::cout << "CRC error: got 0x" << std::nouppercase << std::setw(2)
|
||||||
<< std::hex << std::setfill('0')
|
<< std::hex << std::setfill('0')
|
||||||
<< static_cast<unsigned>(gotCrc) << ", expected 0x"
|
<< static_cast<unsigned>(gotCrc) << ", expected 0x"
|
||||||
<< std::nouppercase << std::setw(2) << std::hex
|
<< std::nouppercase << std::setw(2) << std::hex
|
||||||
@@ -50,9 +50,9 @@ int main ()
|
|||||||
gotStr = sstr.getDataStr(), expectStr = "10feb5050427a915aa77";
|
gotStr = sstr.getDataStr(), expectStr = "10feb5050427a915aa77";
|
||||||
|
|
||||||
if (strcasecmp(gotStr.c_str(), expectStr.c_str()) == 0)
|
if (strcasecmp(gotStr.c_str(), expectStr.c_str()) == 0)
|
||||||
std::cout << "unescape successful." << std::endl;
|
std::cout << "unescape OK" << std::endl;
|
||||||
else
|
else
|
||||||
std::cout << "unescape invalid: got " << gotStr << ", expected "
|
std::cout << "unescape error: got " << gotStr << ", expected "
|
||||||
<< expectStr << std::endl;
|
<< expectStr << std::endl;
|
||||||
|
|
||||||
sstr = SymbolString("10feb5050427a90015a90177", true);
|
sstr = SymbolString("10feb5050427a90015a90177", true);
|
||||||
@@ -60,9 +60,9 @@ int main ()
|
|||||||
gotStr = sstr.getDataStr();
|
gotStr = sstr.getDataStr();
|
||||||
|
|
||||||
if (strcasecmp(gotStr.c_str(), expectStr.c_str()) == 0)
|
if (strcasecmp(gotStr.c_str(), expectStr.c_str()) == 0)
|
||||||
std::cout << "ctor unescaped successful." << std::endl;
|
std::cout << "ctor unescaped OK" << std::endl;
|
||||||
else
|
else
|
||||||
std::cout << "ctor unescaped invalid: got " << gotStr << ", expected "
|
std::cout << "ctor unescaped error: got " << gotStr << ", expected "
|
||||||
<< expectStr << std::endl;
|
<< expectStr << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user