Loading isis/src/base/objs/TrackingTable/TrackingTable.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -55,10 +55,13 @@ namespace Isis { for (int i=0; i < table.Records(); i++) { TableRecord record = table[i]; QString nameField = QString(record["FileName"]); int found = nameField.lastIndexOf(".cub"); QString extension(FileName(nameField).extension()); // std::cout << nameField << std::endl; // std::cout << name.extension() << std::endl; int found = nameField.lastIndexOf(extension); if (found != -1) { // clear the packing characters - get only the file name nameField.remove(found + 4); nameField.remove(found + 3); } FileName fileName(nameField); QString serialNumber = QString(record["SerialNumber"]); Loading isis/src/base/objs/TrackingTable/TrackingTable.truth +10 −10 Original line number Diff line number Diff line Loading @@ -2,15 +2,15 @@ Unit test for TrackingTable Testing constructor with a Table object ... Constructing Table ... First table record: fileName1.cub, 1234567890 Second table record: fileName2.cub, 123 Third table record: fileName3.cub, 456789 First record : fileName1.cub, 1234567890 Second record: fileName2.cub, 123 Third record : fileName3.dat, 456789 TrackingTable object created Testing the indexToFileName method ... FileName at index 0: fileName1.cub FileName at index 1: fileName2.cub FileName at index 2: fileName3.cub FileName at index 2: fileName3.dat FileName at index 3 does not exist and an exception is thrown. **PROGRAMMER ERROR** Cannot convert index [3] to a filename, index is out of bounds. Loading @@ -23,8 +23,8 @@ Index of the non-existent FileName fileName4.cub (demonstrating its addition): 3 Testing the toTable method ... First record : fileName1.cub, 1234567890 Second record: fileName2.cub, 123 Third record: fileName3.cub, 456789 Fourth record: fileName4.cub, 2 Third record : fileName3.dat, 456789 Fourth record: fileName4.cub, 12345678901234567890 Creating a new TrackingTable object with the table returned from toTable method ... New TrackingTable object created Loading @@ -32,5 +32,5 @@ New TrackingTable object created Testing that the Table returned from toTable on new TrackingTable matches ... First record : fileName1.cub, 1234567890 Second record: fileName2.cub, 123 Third record: fileName3.cub, 456789 Fourth record: fileName4.cub, 2 Third record : fileName3.dat, 456789 Fourth record: fileName4.cub, 12345678901234567890 isis/src/base/objs/TrackingTable/unitTest.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -38,13 +38,13 @@ int main(int argc, char *argv[]) { record[1] = "123"; tableIn += record; record[0] = "fileName3.cub"; record[0] = "fileName3.dat"; record[1] = "456789"; tableIn += record; cout << "First table record: fileName1.cub, 1234567890" << endl; cout << "Second table record: fileName2.cub, 123" << endl; cout << "Third table record: fileName3.cub, 456789" << endl; cout << "First record : " << QString(tableIn[0][0]) << ", " << QString(tableIn[0][1]) << endl; cout << "Second record: " << QString(tableIn[1][0]) << ", " << QString(tableIn[1][1]) << endl; cout << "Third record : " << QString(tableIn[2][0]) << ", " << QString(tableIn[2][1]) << endl; TrackingTable trackingTable(tableIn); Loading Loading @@ -73,9 +73,9 @@ int main(int argc, char *argv[]) { cout << "Index of FileName fileName2.cub: " << trackingTable.fileNameToIndex("fileName2.cub", "123") << endl; cout << "Index of FileName fileName3.cub: " << trackingTable.fileNameToIndex("fileName3.cub", "456789") << endl; << trackingTable.fileNameToIndex("fileName3.dat", "456789") << endl; cout << "Index of the non-existent FileName fileName4.cub (demonstrating its addition): " << trackingTable.fileNameToIndex("fileName4.cub", "2") << endl; << trackingTable.fileNameToIndex("fileName4.cub", "12345678901234567890") << endl; cout << endl; Loading Loading
isis/src/base/objs/TrackingTable/TrackingTable.cpp +5 −2 Original line number Diff line number Diff line Loading @@ -55,10 +55,13 @@ namespace Isis { for (int i=0; i < table.Records(); i++) { TableRecord record = table[i]; QString nameField = QString(record["FileName"]); int found = nameField.lastIndexOf(".cub"); QString extension(FileName(nameField).extension()); // std::cout << nameField << std::endl; // std::cout << name.extension() << std::endl; int found = nameField.lastIndexOf(extension); if (found != -1) { // clear the packing characters - get only the file name nameField.remove(found + 4); nameField.remove(found + 3); } FileName fileName(nameField); QString serialNumber = QString(record["SerialNumber"]); Loading
isis/src/base/objs/TrackingTable/TrackingTable.truth +10 −10 Original line number Diff line number Diff line Loading @@ -2,15 +2,15 @@ Unit test for TrackingTable Testing constructor with a Table object ... Constructing Table ... First table record: fileName1.cub, 1234567890 Second table record: fileName2.cub, 123 Third table record: fileName3.cub, 456789 First record : fileName1.cub, 1234567890 Second record: fileName2.cub, 123 Third record : fileName3.dat, 456789 TrackingTable object created Testing the indexToFileName method ... FileName at index 0: fileName1.cub FileName at index 1: fileName2.cub FileName at index 2: fileName3.cub FileName at index 2: fileName3.dat FileName at index 3 does not exist and an exception is thrown. **PROGRAMMER ERROR** Cannot convert index [3] to a filename, index is out of bounds. Loading @@ -23,8 +23,8 @@ Index of the non-existent FileName fileName4.cub (demonstrating its addition): 3 Testing the toTable method ... First record : fileName1.cub, 1234567890 Second record: fileName2.cub, 123 Third record: fileName3.cub, 456789 Fourth record: fileName4.cub, 2 Third record : fileName3.dat, 456789 Fourth record: fileName4.cub, 12345678901234567890 Creating a new TrackingTable object with the table returned from toTable method ... New TrackingTable object created Loading @@ -32,5 +32,5 @@ New TrackingTable object created Testing that the Table returned from toTable on new TrackingTable matches ... First record : fileName1.cub, 1234567890 Second record: fileName2.cub, 123 Third record: fileName3.cub, 456789 Fourth record: fileName4.cub, 2 Third record : fileName3.dat, 456789 Fourth record: fileName4.cub, 12345678901234567890
isis/src/base/objs/TrackingTable/unitTest.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -38,13 +38,13 @@ int main(int argc, char *argv[]) { record[1] = "123"; tableIn += record; record[0] = "fileName3.cub"; record[0] = "fileName3.dat"; record[1] = "456789"; tableIn += record; cout << "First table record: fileName1.cub, 1234567890" << endl; cout << "Second table record: fileName2.cub, 123" << endl; cout << "Third table record: fileName3.cub, 456789" << endl; cout << "First record : " << QString(tableIn[0][0]) << ", " << QString(tableIn[0][1]) << endl; cout << "Second record: " << QString(tableIn[1][0]) << ", " << QString(tableIn[1][1]) << endl; cout << "Third record : " << QString(tableIn[2][0]) << ", " << QString(tableIn[2][1]) << endl; TrackingTable trackingTable(tableIn); Loading Loading @@ -73,9 +73,9 @@ int main(int argc, char *argv[]) { cout << "Index of FileName fileName2.cub: " << trackingTable.fileNameToIndex("fileName2.cub", "123") << endl; cout << "Index of FileName fileName3.cub: " << trackingTable.fileNameToIndex("fileName3.cub", "456789") << endl; << trackingTable.fileNameToIndex("fileName3.dat", "456789") << endl; cout << "Index of the non-existent FileName fileName4.cub (demonstrating its addition): " << trackingTable.fileNameToIndex("fileName4.cub", "2") << endl; << trackingTable.fileNameToIndex("fileName4.cub", "12345678901234567890") << endl; cout << endl; Loading