1.1 --- a/test/least_color_group_test.cc Mon Mar 13 20:25:53 2017 +0100
1.2 +++ b/test/least_color_group_test.cc Mon Mar 13 20:31:02 2017 +0100
1.3 @@ -1,7 +1,6 @@
1.4 #include <iostream>
1.5 #include <iostream>
1.6 -#include <fstream>
1.7 -#include <string>
1.8 +#include <vector>
1.9 #include <cstring> // for strcmp()
1.10 #include <assert.h>
1.11 #include "blacklist.h"
1.12 @@ -17,15 +16,14 @@
1.13
1.14 const char* mailfile = "test_mails/color_test.eml";
1.15
1.16 - const char* keynames[] = {"test_keys/priv/pep.color.test.P-0x3EBE215C_priv.asc",
1.17 + const std::vector<const char*> keynames = {
1.18 + "test_keys/priv/pep.color.test.P-0x3EBE215C_priv.asc",
1.19 "test_keys/pub/pep.color.test.H-0xD17E598E_pub.asc",
1.20 "test_keys/pub/pep.color.test.L-0xE9CDB4CE_pub.asc",
1.21 "test_keys/pub/pep.color.test.P-0x3EBE215C_pub.asc",
1.22 "test_keys/pub/pep.color.test.V-0x71FC6D28_pub.asc"
1.23 };
1.24
1.25 - const int num_keyfiles = 5;
1.26 -
1.27 PEP_SESSION session;
1.28
1.29 cout << "calling init()\n";
1.30 @@ -34,11 +32,9 @@
1.31 assert(session);
1.32 cout << "init() completed.\n";
1.33
1.34 - int i = 0;
1.35 -
1.36 - for ( ; i < num_keyfiles; i++) {
1.37 - cout << "\t read keyfile #" << i << ": \"" << keynames[i] << "\"..." << std::endl;
1.38 - const string keytextkey = slurp(keynames[i]);
1.39 + for (auto name : keynames) {
1.40 + cout << "\t read keyfile \"" << name << "\"..." << std::endl;
1.41 + const string keytextkey = slurp(name);
1.42 PEP_STATUS statuskey = import_key(session, keytextkey.c_str(), keytextkey.length(), NULL);
1.43 assert(statuskey == PEP_STATUS_OK);
1.44 }
1.45 @@ -82,10 +78,11 @@
1.46 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
1.47 cout << "rating: " << rating << endl << endl;
1.48 cout << "keys used: " << endl;
1.49 - i = 0;
1.50 +
1.51 + int i = 0;
1.52 for (stringlist_t* k = keylist; k; k = k->next) {
1.53 if (i == 0)
1.54 - cout << "\t Signer (key 0):\t" << k->value << endl;
1.55 + cout << "\t Signer (key 0):\t" << k->value << endl;
1.56 else
1.57 cout << "\t #" << i << ":\t" << k->value << endl;
1.58 i++;