test/src/engine_tests/MessageTwoPointOhTests.cc
branchlocal_cpptest
changeset 2669 1b103e8a95f7
parent 2661 2b0b15a718bc
child 2670 b8fd84950de1
     1.1 --- a/test/src/engine_tests/MessageTwoPointOhTests.cc	Wed May 09 10:22:22 2018 +0200
     1.2 +++ b/test/src/engine_tests/MessageTwoPointOhTests.cc	Wed May 09 11:39:10 2018 +0200
     1.3 @@ -39,12 +39,12 @@
     1.4  
     1.5      PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
     1.6      PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
     1.7 -    TEST_ASSERT(statuspub == PEP_STATUS_OK);
     1.8 -    TEST_ASSERT(statuspriv == PEP_STATUS_OK);
     1.9 +    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
    1.10 +    TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
    1.11      statuspub = import_key(session, carol_pub_key.c_str(), carol_pub_key.length(), NULL);
    1.12      statuspriv = import_key(session, carol_priv_key.c_str(), carol_priv_key.length(), NULL);
    1.13 -    TEST_ASSERT(statuspub == PEP_STATUS_OK);
    1.14 -    TEST_ASSERT(statuspriv == PEP_STATUS_OK);
    1.15 +    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
    1.16 +    TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
    1.17  
    1.18      cout << "creating message…\n";
    1.19      pEp_identity* alice = new_identity("pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", PEP_OWN_USERID, "Alice Test");
    1.20 @@ -57,15 +57,15 @@
    1.21      status = update_trust_for_fpr(session, carol->fpr, carol_comm_type);
    1.22      
    1.23      PEP_STATUS mystatus = myself(session, alice);
    1.24 -    TEST_ASSERT(mystatus == PEP_STATUS_OK);
    1.25 +    TEST_ASSERT_MSG((mystatus == PEP_STATUS_OK), "mystatus == PEP_STATUS_OK");
    1.26      alice_status = update_identity(session, alice);
    1.27      alice_status = update_identity(session, carol);
    1.28 -    TEST_ASSERT(alice->comm_type == PEP_ct_pEp);
    1.29 -    TEST_ASSERT(carol->comm_type == carol_comm_type);
    1.30 +    TEST_ASSERT_MSG((alice->comm_type == PEP_ct_pEp), "alice->comm_type == PEP_ct_pEp");
    1.31 +    TEST_ASSERT_MSG((carol->comm_type == carol_comm_type), "carol->comm_type == carol_comm_type");
    1.32      
    1.33      identity_list* to_list = new_identity_list(carol); // to carol
    1.34      message* outgoing_message = new_message(PEP_dir_outgoing);
    1.35 -    TEST_ASSERT(outgoing_message);
    1.36 +    TEST_ASSERT_MSG((outgoing_message), "outgoing_message");
    1.37      outgoing_message->from = alice;
    1.38      outgoing_message->to = to_list;
    1.39      outgoing_message->shortmsg = strdup("Greetings, humans!");
    1.40 @@ -80,8 +80,8 @@
    1.41  
    1.42      char* encoded_text = nullptr;
    1.43      status = mime_encode_message(outgoing_message, false, &encoded_text);
    1.44 -    TEST_ASSERT(status == PEP_STATUS_OK);
    1.45 -    TEST_ASSERT(encoded_text);
    1.46 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    1.47 +    TEST_ASSERT_MSG((encoded_text), "encoded_text");
    1.48  
    1.49      cout << "unencrypted:\n\n";
    1.50      cout << encoded_text << "\n";
    1.51 @@ -94,14 +94,14 @@
    1.52      status = encrypt_message(session, outgoing_message, NULL, 
    1.53          &encrypted_msg, PEP_enc_PGP_MIME, 0);
    1.54      cout << "encrypt_message() returns " << std::hex << status << '.' << endl;
    1.55 -    TEST_ASSERT(status == PEP_STATUS_OK);
    1.56 -    TEST_ASSERT(encrypted_msg);
    1.57 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    1.58 +    TEST_ASSERT_MSG((encrypted_msg), "encrypted_msg");
    1.59      cout << "message encrypted.\n";
    1.60      
    1.61      encrypted_msg->enc_format = PEP_enc_none;
    1.62      status = mime_encode_message(encrypted_msg, false, &encoded_text);
    1.63 -    TEST_ASSERT(status == PEP_STATUS_OK);
    1.64 -    TEST_ASSERT(encoded_text);
    1.65 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    1.66 +    TEST_ASSERT_MSG((encoded_text), "encoded_text");
    1.67       
    1.68      cout << "encrypted:\n\n";
    1.69      cout << encoded_text << "\n";
    1.70 @@ -121,7 +121,7 @@
    1.71      
    1.72      message* decoded_msg = nullptr;
    1.73      status = mime_decode_message(encoded_text, strlen(encoded_text), &decoded_msg);
    1.74 -    TEST_ASSERT(status == PEP_STATUS_OK);
    1.75 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    1.76      const string string3 = encoded_text;
    1.77        
    1.78      unlink("msg_2.0.asc");
    1.79 @@ -139,12 +139,12 @@
    1.80      stringpair_list_add(encrypted_msg->opt_fields, autoconsume);
    1.81      flags = 0;
    1.82      status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
    1.83 -    TEST_ASSERT(decrypted_msg);
    1.84 -    TEST_ASSERT(keylist_used);
    1.85 -    TEST_ASSERT(rating);
    1.86 -    //TEST_ASSERT(status == PEP_STATUS_OK && rating == PEP_rating_reliable);
    1.87 +    TEST_ASSERT_MSG((decrypted_msg), "decrypted_msg");
    1.88 +    TEST_ASSERT_MSG((keylist_used), "keylist_used");
    1.89 +    TEST_ASSERT_MSG((rating), "rating");
    1.90 +    //TEST_ASSERT_MSG((status == PEP_STATUS_OK && rating == PEP_rating_reliable), "status == PEP_STATUS_OK && rating == PEP_rating_reliable");
    1.91      //PEP_comm_type ct = encrypted_msg->from->comm_type;
    1.92 -    //TEST_ASSERT(ct == PEP_ct_pEp);
    1.93 +    //TEST_ASSERT_MSG((ct == PEP_ct_pEp), "ct == PEP_ct_pEp");
    1.94      
    1.95      cout << "keys used:\n";
    1.96      
    1.97 @@ -155,8 +155,8 @@
    1.98       
    1.99      decrypted_msg->enc_format = PEP_enc_none; 
   1.100      status = _mime_encode_message_internal(decrypted_msg, false, &encoded_text, false);
   1.101 -    TEST_ASSERT(status == PEP_STATUS_OK);
   1.102 -    TEST_ASSERT(encoded_text);
   1.103 +    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   1.104 +    TEST_ASSERT_MSG((encoded_text), "encoded_text");
   1.105      cout << "Decrypted message: " << endl;
   1.106      cout << encoded_text << endl;
   1.107