changed code style

This commit is contained in:
john30
2015-02-21 13:18:36 +01:00
parent 0bfc63c13a
commit 41cd38ab75
20 changed files with 218 additions and 217 deletions
+8 -8
View File
@@ -26,14 +26,14 @@ using namespace std;
void verify(bool expectFailMatch, string type, string input,
bool match, string expectStr, string gotStr)
{
if (expectFailMatch == true) {
if (match == true)
if (expectFailMatch) {
if (match)
cout << " failed " << type << " match >" << input
<< "< error: unexpectedly succeeded" << endl;
else
cout << " failed " << type << " match >" << input << "< OK" << endl;
}
else if (match == true)
else if (match)
cout << " " << type << " match >" << input << "< OK" << endl;
else
cout << " " << type << " match >" << input << "< error: got >"
@@ -248,7 +248,7 @@ int main()
}
vector<string>::iterator it = entries.begin();
result = DataField::create(it, entries.end(), templates, fields, isSet, isTemplate ? SYN : mstr[1]);
if (failedCreate == true) {
if (failedCreate) {
if (result == RESULT_OK)
cout << "\"" << check[0] << "\": failed create error: unexpectedly succeeded" << endl;
else
@@ -294,9 +294,9 @@ int main()
}
result = fields->read(pt_masterData, mstr, 0, output, false, verbose);
if (result >= RESULT_OK) {
result = fields->read(pt_slaveData, sstr, 0, output, output.str().empty() == false, verbose);
result = fields->read(pt_slaveData, sstr, 0, output, !output.str().empty(), verbose);
}
if (failedRead == true)
if (failedRead)
if (result >= RESULT_OK)
cout << " failed read " << fields->getName() << " >"
<< check[2] << "< error: unexpectedly succeeded" << endl;
@@ -312,12 +312,12 @@ int main()
verify(failedReadMatch, "read", check[2], match, expectStr, output.str());
}
if (verbose == false) {
if (!verbose) {
istringstream input(expectStr);
result = fields->write(input, pt_masterData, writeMstr, 0);
if (result >= RESULT_OK)
result = fields->write(input, pt_slaveData, writeSstr, 0);
if (failedWrite == true) {
if (failedWrite) {
if (result >= RESULT_OK)
cout << " failed write " << fields->getName() << " >"
<< expectStr << "< error: unexpectedly succeeded" << endl;
+2 -2
View File
@@ -34,7 +34,7 @@ int main ()
if (result != RESULT_OK) {
cout << "open failed: " << getResultCode(result) << endl;
} else {
if (device->isValid() == false)
if (!device->isValid())
cout << "device not available." << endl;
int count = 0;
@@ -52,7 +52,7 @@ int main ()
device->close();
if(device->isValid() == false)
if (!device->isValid())
cout << "close successful." << endl;
}
+9 -9
View File
@@ -27,14 +27,14 @@ using namespace std;
void verify(bool expectFailMatch, string type, string input,
bool match, string expectStr, string gotStr)
{
if (expectFailMatch == true) {
if (match == true)
if (expectFailMatch) {
if (match)
cout << " failed " << type << " match >" << input
<< "< error: unexpectedly succeeded" << endl;
else
cout << " failed " << type << " match >" << input << "< OK" << endl;
}
else if (match == true)
else if (match)
cout << " " << type << " match >" << input << "< OK" << endl;
else
cout << " " << type << " match >" << input << "< error: got >"
@@ -104,7 +104,7 @@ int main()
delete deleteMessage;
deleteMessage = NULL;
}
if (isTemplate == true) {
if (isTemplate) {
// store new template
DataField* fields = NULL;
vector<string>::iterator it = entries.begin();
@@ -136,7 +136,7 @@ int main()
else {
vector<string>::iterator it = entries.begin();
result = Message::create(it, entries.end(), NULL, templates, deleteMessage);
if (failedCreate == true) {
if (failedCreate) {
if (result == RESULT_OK)
cout << "\"" << check[0] << "\": failed create error: unexpectedly succeeded" << endl;
else
@@ -158,7 +158,7 @@ int main()
continue;
}
cout << "\"" << check[0] << "\": create OK" << endl;
if (dontMap == false) {
if (!dontMap) {
result_t result = messages->add(deleteMessage);
if (result != RESULT_OK) {
cout << "\"" << check[0] << "\": add error: "
@@ -168,7 +168,7 @@ int main()
cout << " map OK" << endl;
message = deleteMessage;
deleteMessage = NULL;
if (onlyMap == true)
if (onlyMap)
continue;
Message* foundMessage = messages->find(mstr);
if (foundMessage == message)
@@ -182,7 +182,7 @@ int main()
message = deleteMessage;
}
if (message->isPassive() == true || decode == true) {
if (message->isPassive() || decode) {
ostringstream output;
result = message->decode(mstr, sstr, output);
if (result != RESULT_OK) {
@@ -199,7 +199,7 @@ int main()
istringstream input(inputStr);
SymbolString writeMstr;
result = message->prepareMaster(0xff, writeMstr, input);
if (failedPrepare == true) {
if (failedPrepare) {
if (result == RESULT_OK)
cout << " \"" << inputStr << "\": failed prepare error: unexpectedly succeeded" << endl;
else