TAB -> 4 spaces because most of the pEpEngine's src code does so.
1.1 --- a/test/pEpEngineTest.cc Tue Jun 21 17:18:10 2016 +0200
1.2 +++ b/test/pEpEngineTest.cc Tue Jun 21 17:27:45 2016 +0200
1.3 @@ -13,9 +13,9 @@
1.4 void ReadFileIntoMem(const char *fname, char* &buffer, size_t &length){
1.5 buffer = NULL;
1.6 length = 0;
1.7 - cout << "opening " << fname << " for reading\n";
1.8 - ifstream txtFile (fname, ifstream::binary);
1.9 - assert(txtFile.is_open());
1.10 + cout << "opening " << fname << " for reading\n";
1.11 + ifstream txtFile (fname, ifstream::binary);
1.12 + assert(txtFile.is_open());
1.13 if (txtFile) {
1.14 // get length of file:
1.15 txtFile.seekg (0, txtFile.end);
1.16 @@ -35,32 +35,32 @@
1.17 txtFile.close();
1.18 }
1.19
1.20 - txtFile.close();
1.21 assert(buffer);
1.22 assert(length);
1.23 }
1.24
1.25 +
1.26 int main(int argc, char* argv[])
1.27 {
1.28 - PEP_SESSION session;
1.29 + PEP_SESSION session;
1.30
1.31 - cout << "calling init()\n";
1.32 - PEP_STATUS init_result = init(&session);
1.33 -
1.34 + cout << "calling init()\n";
1.35 + PEP_STATUS init_result = init(&session);
1.36 +
1.37 cout << "returning from init() with result == " << init_result << "\n";
1.38 - assert(init_result == PEP_STATUS_OK);
1.39 + assert(init_result == PEP_STATUS_OK);
1.40
1.41 PEP_SESSION second_session;
1.42 cout << "second session test\n";
1.43 PEP_STATUS second_init_result = init(&second_session);
1.44 - cout << "returning from second init() with result == " << second_init_result << "\n";
1.45 + cout << "returning from second init() with result == " << second_init_result << "\n";
1.46 assert(second_init_result == PEP_STATUS_OK);
1.47 assert(second_session);
1.48 cout << "dropping second session\n";
1.49 - release(second_session);
1.50 + release(second_session);
1.51
1.52 - cout << "logging test\n";
1.53 - log_event(session, "log test", "pEp Enginge Test", "This is a logging test sample.", "please ignore this line");
1.54 + cout << "logging test\n";
1.55 + log_event(session, "log test", "pEp Enginge Test", "This is a logging test sample.", "please ignore this line");
1.56
1.57 // Our test user :
1.58 // pEp Test Alice (test key don't use) <pep.test.alice@pep-project.org>
1.59 @@ -82,6 +82,7 @@
1.60 "0x70DCF575.asc",
1.61 NULL
1.62 };
1.63 +
1.64 const char** kf = kflist;
1.65 while(*kf){
1.66 char * k_user_buffer = NULL;
1.67 @@ -99,11 +100,11 @@
1.68 size_t cipher_length = 0;
1.69 ReadFileIntoMem("msg.asc", cipher_buffer, cipher_length);
1.70
1.71 - cout << "\n" << cipher_buffer;
1.72 + cout << "\n" << cipher_buffer;
1.73
1.74 - char *buf_text = NULL;
1.75 - size_t buf_size = 0;
1.76 - stringlist_t *keylist;
1.77 + char *buf_text = NULL;
1.78 + size_t buf_size = 0;
1.79 + stringlist_t *keylist;
1.80
1.81 cout << "calling decrypt_and_verify()\n";
1.82 PEP_STATUS decrypt_result = decrypt_and_verify(session, cipher_buffer, cipher_length, &buf_text, &buf_size, &keylist);
1.83 @@ -153,8 +154,8 @@
1.84 stringlist_add(keylist, "59BFF488C9C2EE39");
1.85 stringlist_add(keylist, "135CD6D170DCF575");
1.86
1.87 - buf_text = NULL;
1.88 - buf_size = 0;
1.89 + buf_text = NULL;
1.90 + buf_size = 0;
1.91
1.92 cout << "\ncalling encrypt_and_sign()\n";
1.93 PEP_STATUS encrypt_result = encrypt_and_sign(session, keylist, plain.c_str(), plain.length(), &buf_text, &buf_size);
1.94 @@ -172,12 +173,12 @@
1.95 delete[] sig_buffer;
1.96 delete[] t2_buffer;
1.97
1.98 - cout << "\nfinding English trustword for 2342...\n";
1.99 - char * word;
1.100 - size_t wsize;
1.101 - trustword(session, 2342, "en", &word, &wsize);
1.102 - assert(word);
1.103 - cout << "the trustword for 2342 is " << word << "\n";
1.104 + cout << "\nfinding English trustword for 2342...\n";
1.105 + char * word;
1.106 + size_t wsize;
1.107 + trustword(session, 2342, "en", &word, &wsize);
1.108 + assert(word);
1.109 + cout << "the trustword for 2342 is " << word << "\n";
1.110 pEp_free(word);
1.111
1.112 string fingerprint = "4942 2235 FC99 585B 891C 6653 0C7B 109B FA72 61F7";
1.113 @@ -189,7 +190,7 @@
1.114 cout << words << "\n";
1.115 pEp_free(words);
1.116
1.117 - pEp_identity *identity;
1.118 + pEp_identity *identity;
1.119
1.120 identity = new_identity(
1.121 "leon.schumacher@digitalekho.com",
1.122 @@ -197,15 +198,15 @@
1.123 "23",
1.124 "Leon Schumacher"
1.125 );
1.126 - identity->comm_type = PEP_ct_pEp;
1.127 + identity->comm_type = PEP_ct_pEp;
1.128
1.129 - cout << "\nsetting identity...\n";
1.130 - PEP_STATUS pep_set_result = set_identity(session, identity);
1.131 - assert(pep_set_result == PEP_STATUS_OK);
1.132 + cout << "\nsetting identity...\n";
1.133 + PEP_STATUS pep_set_result = set_identity(session, identity);
1.134 + assert(pep_set_result == PEP_STATUS_OK);
1.135 free_identity(identity);
1.136 - get_identity(session, "leon.schumacher@digitalekho.com", "23", &identity);
1.137 - assert(identity);
1.138 - cout << "set: " << identity->address << ", " << identity->fpr << ", " << identity->user_id << ", " << identity->username << "\n";
1.139 + get_identity(session, "leon.schumacher@digitalekho.com", "23", &identity);
1.140 + assert(identity);
1.141 + cout << "set: " << identity->address << ", " << identity->fpr << ", " << identity->user_id << ", " << identity->username << "\n";
1.142
1.143 PEP_STATUS get_trust_result = get_trust(session, identity);
1.144 assert(get_trust_result == PEP_STATUS_OK);
1.145 @@ -220,6 +221,7 @@
1.146 "423",
1.147 "Alfred E. Neuman"
1.148 );
1.149 +
1.150 assert(identity);
1.151 PEP_STATUS generate_status = generate_keypair(session, identity);
1.152 cout << "generate_keypair() exits with " << generate_status << "\n";
1.153 @@ -280,7 +282,7 @@
1.154 assert(tstatus == PEP_STATUS_OK);
1.155 assert(tcomm_type == PEP_ct_OpenPGP_unconfirmed);
1.156
1.157 - cout << "\ncalling release()\n";
1.158 - release(session);
1.159 - return 0;
1.160 + cout << "\ncalling release()\n";
1.161 + release(session);
1.162 + return 0;
1.163 }