use slurp() in least_color_group_test.cc ENGINE-189
authorRoker <roker@pep-project.org>
Mon, 13 Mar 2017 20:25:53 +0100
branchENGINE-189
changeset 16578b06f5627683
parent 1656 ea7d229bed3f
child 1658 047100aa9f43
use slurp() in least_color_group_test.cc
test/least_color_group_test.cc
     1.1 --- a/test/least_color_group_test.cc	Mon Mar 13 20:20:10 2017 +0100
     1.2 +++ b/test/least_color_group_test.cc	Mon Mar 13 20:25:53 2017 +0100
     1.3 @@ -8,6 +8,7 @@
     1.4  #include "keymanagement.h"
     1.5  #include "message_api.h"
     1.6  #include "mime.h"
     1.7 +#include "test_util.h"
     1.8  
     1.9  using namespace std;
    1.10  
    1.11 @@ -37,32 +38,18 @@
    1.12      
    1.13      for ( ; i < num_keyfiles; i++) {
    1.14          cout << "\t read keyfile #" << i << ": \"" << keynames[i] << "\"..." << std::endl;
    1.15 -        ifstream infilekey(keynames[i]);
    1.16 -        string keytextkey;
    1.17 -        while (!infilekey.eof()) {
    1.18 -            static string line;
    1.19 -            getline(infilekey, line);
    1.20 -            keytextkey += line + "\n";
    1.21 -        }
    1.22 -        infilekey.close(); 
    1.23 +        const string keytextkey = slurp(keynames[i]);
    1.24          PEP_STATUS statuskey = import_key(session, keytextkey.c_str(), keytextkey.length(), NULL);
    1.25          assert(statuskey == PEP_STATUS_OK);
    1.26      }
    1.27      
    1.28      cout << "\t read keyfile mailfile \"" << mailfile << "\"..." << std::endl;
    1.29 -    ifstream infile(mailfile);
    1.30 -    string mailtext;
    1.31 -    while (!infile.eof()) {
    1.32 -        static string line;
    1.33 -        getline(infile, line);
    1.34 -        mailtext += line + "\n";
    1.35 -    }
    1.36 -    infile.close(); 
    1.37 +    const string mailtext = slurp(mailfile);
    1.38      cout << "\t All files read successfully." << std::endl;
    1.39  
    1.40      pEp_identity * me1 = new_identity("pep.color.test.P@kgrothoff.org", NULL, 
    1.41                                        PEP_OWN_USERID, "Pep Color Test P (recip)");
    1.42 -    me1->me = true;    
    1.43 +    me1->me = true;
    1.44      PEP_STATUS status = update_identity(session, me1);
    1.45      trust_personal_key(session, me1);
    1.46      status = update_identity(session, me1);
    1.47 @@ -74,7 +61,7 @@
    1.48      sender1->me = false;
    1.49      status = update_identity(session, sender1);
    1.50      trust_personal_key(session, sender1);
    1.51 -    status = update_identity(session, sender1);    
    1.52 +    status = update_identity(session, sender1);
    1.53      
    1.54      message* msg_ptr = nullptr;
    1.55      message* dest_msg = nullptr;