aligned tests to latest changes
This commit is contained in:
@@ -512,7 +512,7 @@ int main() {
|
||||
istringstream dummystr("#");
|
||||
string errorDescription;
|
||||
vector<string> row;
|
||||
templates->readLineFromStream(__FILE__, false, &dummystr, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
templates->readLineFromStream(&dummystr, __FILE__, false, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
const DataField* fields = NULL;
|
||||
for (unsigned int i = 0; i < sizeof(checks) / sizeof(checks[0]); i++) {
|
||||
string check[5] = checks[i];
|
||||
@@ -567,7 +567,7 @@ int main() {
|
||||
}
|
||||
if (isTemplate) {
|
||||
lineNo = baseLine + i;
|
||||
result = templates->readLineFromStream(__FILE__, false, &isstr, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
result = templates->readLineFromStream(&isstr, __FILE__, false, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
if (result != RESULT_OK) {
|
||||
cout << "\"" << check[0] << "\": template read error: " << getResultCode(result) << ", "
|
||||
<< errorDescription << endl;
|
||||
@@ -579,7 +579,7 @@ int main() {
|
||||
lineNo = 0;
|
||||
dummystr.clear();
|
||||
dummystr.str("#");
|
||||
result = reader.readLineFromStream(__FILE__, false, &dummystr, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
result = reader.readLineFromStream(&dummystr, __FILE__, false, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
if (result != RESULT_OK) {
|
||||
cout << "\"" << check[0] << "\": read header error: " << getResultCode(result) << ", " << errorDescription
|
||||
<< endl;
|
||||
@@ -587,7 +587,7 @@ int main() {
|
||||
continue;
|
||||
}
|
||||
lineNo = baseLine + i;
|
||||
result = reader.readLineFromStream("", false, &isstr, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
result = reader.readLineFromStream(&isstr, "", false, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
fields = reader.m_fields;
|
||||
if (failedCreate) {
|
||||
if (result == RESULT_OK) {
|
||||
|
||||
@@ -196,7 +196,13 @@ int main(int argc, char** argv) {
|
||||
size_t hash = 0, size = 0;
|
||||
time_t time = 0;
|
||||
string errorDescription;
|
||||
result_t result = reader.readFromFile(argv[argpos], false, NULL, &errorDescription, &hash, &size, &time);
|
||||
istream* stream = FileReader::openFile(argv[argpos], &errorDescription, &time);
|
||||
result_t result;
|
||||
if (!stream) {
|
||||
result = RESULT_ERR_NOTFOUND;
|
||||
} else {
|
||||
result = reader.readFromStream(stream, argv[argpos], time, false, NULL, &errorDescription, &hash, &size);
|
||||
}
|
||||
cout << argv[argpos] << " ";
|
||||
if (result != RESULT_OK) {
|
||||
cout << getResultCode(result) << ", " << errorDescription << endl;
|
||||
@@ -225,8 +231,7 @@ int main(int argc, char** argv) {
|
||||
vector<string> row;
|
||||
string errorDescription;
|
||||
while (ifs.peek() != EOF) {
|
||||
istringstream str;
|
||||
result_t result = reader.readLineFromStream("", true, &ifs, &lineNo, &row, &errorDescription, &hash, &size);
|
||||
result_t result = reader.readLineFromStream(&ifs, "", true, &lineNo, &row, &errorDescription, &hash, &size);
|
||||
if (result != RESULT_OK) {
|
||||
cout << " error " << getResultCode(result) << endl;
|
||||
error = true;
|
||||
@@ -266,8 +271,7 @@ int main(int argc, char** argv) {
|
||||
subDefaults.resize(1);
|
||||
subDefaults[0]["subcol 2"] = ";default of sub 0 subcol 2";
|
||||
while (ifs.peek() != EOF) {
|
||||
istringstream str;
|
||||
result_t result = reader2.readLineFromStream("", true, &ifs, &lineNo, &row, &errorDescription, &hash, &size);
|
||||
result_t result = reader2.readLineFromStream(&ifs, "", true, &lineNo, &row, &errorDescription, &hash, &size);
|
||||
if (result != RESULT_OK) {
|
||||
cout << " error " << getResultCode(result) << endl;
|
||||
error = true;
|
||||
|
||||
@@ -60,8 +60,24 @@ DataFieldTemplates* getTemplates(const string& filename) {
|
||||
}
|
||||
return templates;
|
||||
}
|
||||
|
||||
result_t loadDefinitionsFromConfigPath(FileReader* reader, const string& filename, bool verbose,
|
||||
map<string, string>* defaults, string* errorDescription) {
|
||||
time_t mtime = 0;
|
||||
istream* stream = FileReader::openFile(filename, errorDescription, &mtime);
|
||||
result_t result;
|
||||
if (stream) {
|
||||
result = reader->readFromStream(stream, filename, mtime, verbose, defaults, errorDescription);
|
||||
delete(stream);
|
||||
} else {
|
||||
result = RESULT_ERR_NOTFOUND;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
} // namespace ebusd
|
||||
|
||||
int main() {
|
||||
// message: [type],[circuit],name,[comment],[QQ[;QQ]*],[ZZ],[PBSB],[ID],fields...
|
||||
// field: name,part,type[:len][,[divisor|values][,[unit][,[comment]]]]
|
||||
@@ -170,12 +186,12 @@ int main() {
|
||||
istringstream dummystr("#");
|
||||
string errorDescription;
|
||||
vector<string> row;
|
||||
templates->readLineFromStream(__FILE__, false, &dummystr, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
templates->readLineFromStream(&dummystr, __FILE__, false, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
lineNo = 0;
|
||||
MessageMap* messages = new MessageMap("");
|
||||
dummystr.clear();
|
||||
dummystr.str("#");
|
||||
messages->readLineFromStream(__FILE__, false, &dummystr, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
messages->readLineFromStream(&dummystr, __FILE__, false, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
vector< vector<string> > defaultsRows;
|
||||
Message* message = NULL;
|
||||
vector<MasterSymbolString*> mstrs;
|
||||
@@ -206,7 +222,7 @@ int main() {
|
||||
lineNo = baseLine + i;
|
||||
cout << "line " << (lineNo+1) << " ";
|
||||
if (isTemplate) {
|
||||
result = templates->readLineFromStream(__FILE__, false, &isstr, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
result = templates->readLineFromStream(&isstr, __FILE__, false, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
if (result != RESULT_OK) {
|
||||
cout << "\"" << check[0] << "\": template read error: " << getResultCode(result) << ", " << errorDescription
|
||||
<< endl;
|
||||
@@ -220,7 +236,7 @@ int main() {
|
||||
}
|
||||
if (isstr.peek() == '*') {
|
||||
// store defaults or condition
|
||||
result = messages->readLineFromStream(__FILE__, false, &isstr, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
result = messages->readLineFromStream(&isstr, __FILE__, false, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
if (result != RESULT_OK) {
|
||||
cout << "\"" << check[0] << "\": default read error: " << getResultCode(result) << ", " << errorDescription << endl;
|
||||
error = true;
|
||||
@@ -302,7 +318,7 @@ int main() {
|
||||
}
|
||||
cout << "\"" << check[2] << "\": find OK" << endl;
|
||||
} else {
|
||||
result = messages->readLineFromStream(__FILE__, false, &isstr, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
result = messages->readLineFromStream(&isstr, __FILE__, false, &lineNo, &row, &errorDescription, NULL, NULL);
|
||||
if (failedCreate) {
|
||||
if (result == RESULT_OK) {
|
||||
cout << "\"" << check[0] << "\": failed create error: unexpectedly succeeded" << endl;
|
||||
|
||||
Reference in New Issue
Block a user