Browse Source

- testcase fixed

master
art1pirat 1 month ago
parent
commit
90fe0837cd
1 changed files with 13 additions and 10 deletions
  1. +13
    -10
      test/test_tagmanifest.cpp

+ 13
- 10
test/test_tagmanifest.cpp View File

@@ -30,20 +30,23 @@ bool check_get_checksum_file_pairs() {
multimap<checksum_string_t,filename_t> results = p.get_checksum_file_pairs( md5 );
multimap<checksum_string_t,filename_t> expected = {
{"939f3a18385ca2975ed6a02f4a180758", "manifest-md5.txt"},
{"9e5ad981e0d29adc278f6a294b8c2aca", "bagit.txt"}
{"eaa2c609ff6371712f623f5531945b44", "bagit.txt"},
};

multimap<string,string>::iterator i;
multimap<string,string>::iterator j;
bool is_valid = true;
for (i=expected.begin(), j=results.begin(); i!=expected.end() && j!=results.end(); i++,j++) {
if (
( i->first != j-> first) ||
( i->second != j->second)
) {
cout << "Expected: (" << (i->first) << "," << (i->second) << ") Result: ("<< j->first << "," << j->second << ")" << endl;
is_valid=false; break;
}
for (i=expected.begin(); i!=expected.end() ; i++) {
cout << "Expected: (" << (i->first) << "," << (i->second) << ")" << endl;
auto j = results.find( i->first );
if (j != results.end()) { // file found
if (j->first != i->first) {
cout << "Results: (" << (j->first) << "," << (j->second) << ")" << endl;
is_valid=false; break;
}
} else {
cout << "Results: not found" << endl;
is_valid=false; break;
}
}
return is_valid;
}

Loading…
Cancel
Save