Added default test assert messages.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/convenience_scripts/README Wed May 09 11:39:10 2018 +0200
1.3 @@ -0,0 +1,1 @@
1.4 +This is just a collection of scripts and source files I've used to convert things and make the test environment behave from time to time. USE AT YOUR OWN RISK.
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/test/convenience_scripts/convert_test_assert.py Wed May 09 11:39:10 2018 +0200
2.3 @@ -0,0 +1,74 @@
2.4 +import sys
2.5 +import argparse
2.6 +import re
2.7 +
2.8 +def get_closing_parenthesis(paren_start):
2.9 + paren_level = 0
2.10 + index = 0
2.11 +
2.12 + for c in paren_start:
2.13 + if c == '(':
2.14 + paren_level += 1
2.15 + elif c == ')':
2.16 + paren_level -= 1
2.17 +
2.18 + if paren_level == 0:
2.19 + break;
2.20 +
2.21 + index += 1
2.22 +
2.23 + return index
2.24 +
2.25 +# TEST_ASSERT(assertion blah blah)
2.26 +# want: TEST_ASSERT_MSG(assertion blah blah, "AUTOMSG: assertion blah blah")
2.27 +
2.28 +parser = argparse.ArgumentParser()
2.29 +parser.add_argument('files', nargs = '*', help = 'files to convert')
2.30 +args = parser.parse_args()
2.31 +
2.32 +# if not args.files:
2.33 +# print("ERROR: Can't make something from nothing. See: first law of thermodynamics.")
2.34 +# sys.exit(1)
2.35 +
2.36 +for f in args.files:
2.37 + infile = open(f, "r");
2.38 + lines = infile.readlines();
2.39 +
2.40 + output = ""
2.41 +
2.42 + # For each line in file - too lazy for regex this morning
2.43 + for l in lines:
2.44 + output_line = l
2.45 + old_assert = "TEST_ASSERT("
2.46 + old_assert_len = len(old_assert)
2.47 +
2.48 + l_index = l.find(old_assert)
2.49 +
2.50 + # if this line contains "TEST_ASSERT("
2.51 + if (l_index >= 0):
2.52 + # 1. get replaceable string (TEST_ASSERT(assertion blah blah))
2.53 + old_r_index = l.find(")", l_index)
2.54 + paren_start = l_index + old_assert_len - 1
2.55 + r_index = paren_start + get_closing_parenthesis(l[paren_start:])
2.56 +
2.57 + #print("l is " + str(l_index) + " and r is " + str(not_r_index))
2.58 +
2.59 + # 2. filter to get assertion
2.60 + assertion = l[l_index + old_assert_len:r_index]
2.61 +# print("Assertion is " + assertion)
2.62 + # 3. create replacement
2.63 + new_assert = "TEST_ASSERT_MSG((" + assertion + "), \"" + assertion.replace('"','\\"') + "\")"
2.64 +# print("New assertion is " + new_assert)
2.65 + # 4. replace
2.66 + output_line = l[0:l_index] + new_assert + l[r_index + 1:]
2.67 +
2.68 + output += (output_line)
2.69 + l_index = 0
2.70 +
2.71 + print(output)
2.72 +
2.73 + infile.close()
2.74 +
2.75 + outfile = open(f, "w")
2.76 + outfile.write(output)
2.77 + outfile.close()
3.1 --- a/test/msg_2.0.asc Wed May 09 10:22:22 2018 +0200
3.2 +++ b/test/msg_2.0.asc Wed May 09 11:39:10 2018 +0200
3.3 @@ -6,82 +6,82 @@
3.4 <three-OMGWTFBBQ.edfddffd839274982347239847@pep-project.org>
3.5 X-pEp-Version: 2.0
3.6 MIME-Version: 1.0
3.7 -Content-Type: multipart/mixed; boundary="6cad4c4136e0bc423c41981d462ac858"
3.8 +Content-Type: multipart/mixed; boundary="7fc8987062b7a13c4b986b451a1122ba"
3.9
3.10 ---6cad4c4136e0bc423c41981d462ac858
3.11 +--7fc8987062b7a13c4b986b451a1122ba
3.12 Content-Type: text/plain; charset="utf-8"
3.13 Content-Transfer-Encoding: quoted-printable
3.14 Content-Disposition: inline; filename="msg.txt"
3.15
3.16 this message was encrypted with p=E2=89=A1p https://pEp-project.org
3.17 ---6cad4c4136e0bc423c41981d462ac858
3.18 +--7fc8987062b7a13c4b986b451a1122ba
3.19 Content-Type: application/pgp-encrypted
3.20
3.21 Version: 1
3.22 ---6cad4c4136e0bc423c41981d462ac858
3.23 +--7fc8987062b7a13c4b986b451a1122ba
3.24 Content-Type: application/octet-stream
3.25 Content-Disposition: attachment; filename="msg.asc"
3.26
3.27 -----BEGIN PGP MESSAGE-----
3.28
3.29 -hQEMA1oCBdlzCD9NAQgAivwEr8qWwwxPQDjDqg9U2xGDmkm86ACaGK0wRrO/xgAQ
3.30 -HhwMVQLGCuJp0R8Fp+r9sJpSsEw2G2vPt0yiB1NewcAHn1AdN6AgPbQ1H91Q87Jp
3.31 -o2jxZUWFPQw3DBymb6wZEUhHCfuO4laccK1YPCQTxpZp4DIOeym61lJcNdeGdf8R
3.32 -xtY3yQ5HtvM9sXkSsXH9dy23C6NGRQruscm51vEyE9JlpMbHmSS/Gr4PZ2dNQHQ4
3.33 -R2ppBQiNQ8C2uY3mwtOAO4p4WBINzS9tWWlhzam4E5J6h5aXhMSPNOczc25Mnv4b
3.34 -Xnj0XWhZDOocbPm8FbbqQlWFU+fH2LFciGDgLJzCoIUBDAOo6/9vKSPoQgEIAKTe
3.35 -fiC/6PKuz+P/ud7NBYmyjovZviVPITW7lc1Cu+V6zmiFgrtogq6WU/Yg4XgRCKZm
3.36 -2WNEZqMzFdtGW8ihVfHR9xNwB/CILH0VdzM2OqHXb30GPw87ask4S/y5z5ls5yk2
3.37 -rKnMFC5J4GHxUGzkcf8Uq/hpZOU1LEnsvGfI9ewwUPUwOe/4XsStzidKB03ACEv9
3.38 -QErJ7IeobyuLsnmBfHW2CVU9jr/fdcvcB/lsEu+XeFVbAc99ueBN6jbmxTC9SduU
3.39 -bLIM0KZTPh2VN4nv8XPfJaipwjpn+3h1tNL7QJWvktGLfJ80GwAofqIfDv3yhaTJ
3.40 -6KAythJobbPL/543i0jS6wErlhXckrIv3yrP+iJo2ywaWo35gVNFWxUzdeCvtFP1
3.41 -vh63G0XiWZSuiwKfMW5h2+Jt0uKPq0Oz1FBzYHl362HZ+aK0hCzhcOXrpM8ApSvJ
3.42 -lYffUSAAEYfO+BKdHZ/zV7B6nTngHSpeXLoZI9Sr5HoXauLmmkeeDNMXM7wn3AUq
3.43 -INzTfcZ0ZpRL3brpa97zT1hGvFHr7yGUpCNQxtJgnfkAabGfYdbUEtvZ+hX5npvE
3.44 -e9RFA5/iCWNX+n7gG1v1C5spbNa+oV3UlONcAj2xM1DwxfoEuuH6IUCMBA9L/Nxv
3.45 -fnJfa1XV0uUFWomwWZBealp8vqoESQ3vJJLpqjCkX54Tzqps2JkEaAy5v/0tQO44
3.46 -jhKQQkN1yaeAJe2qI05fUYHb65FWmlAyg/rkBu9mqP2AfBFZmuYrg/SJh0P1a+gb
3.47 -0vNs1YIXrS0lp6JvAtrKF+HDeZ90Mrwmpge+BOocUqxABTMN+S1vTjX3umPMODcn
3.48 -rdKxxTf0URZBhuQTBwjDTP6dmvcJLYLOW5ZQk0KPMcqT7iJn0GZN9LdcqzZu5gPa
3.49 -xRfeK0uBTrY/HoZhZ7m6aKDRfEPwF2NmBf7LLtxGWZgcyTFIqHR+ObLLRGGUN0Bp
3.50 -hcQ5IaOyKpL3sn1UnB2yXfFcpCWh3oZh0d5wKj6C74lHXUUEfa8Oadgz62d5GFdL
3.51 -q/enS3kdEkDMquBM7Km5OiF6KIvJVRsN/+q8sEj1HwbHB9M9ZAw7CitMCqVgIAYw
3.52 -i1oQbNmm6OiHPMG/TzTNI003UsTSCoEoIJBQUBjlbBRSIw8HZy6aZ+DGk8NHHDw8
3.53 -52Qz6pPcnZMkLJcJaEblQQh3LBdhoTvRmt+A3CFryBh3uTBGniYSGNg+gAIwYupo
3.54 -9n7RCWGB84nui6MzujyqsyH8HxYp0zoPN60UQZ/pQuc5y9iS8AH7xKD67UXSsNmZ
3.55 -ORjp6T2jLyi4OpZZdHKITL1+blkrSgeStUs3qCokhUJV0/MNdZdkp87aZluZcvn+
3.56 -Jz77GWAxtfN/awL5rUdJtu9zC18LNv5GnmMfBJTCPk/wfywenrZkkhKkyB+A/Hot
3.57 -ufzrz95IVUKHF5RLXgDe59C6Lkbp0QLdfBfgYi/jj8b4ofKmNFYa29zFjsUpWWBC
3.58 -y+09OMT+CUmrLh5MpowBCWLNdJ7pstf57WuY2xdg6v3o0lLk5qkobSHLA0RY7b/4
3.59 -+sIkrB4s2QRnrrNJI8NovNVPvHjvkH5beWm1Sonaz97eHf4soVeWcwjH/l+mCzbA
3.60 -2FvxFxUNUQiTaGf5gY66dV34Y4HU285zSMlEsJJA8ypCuDvcZnSe97CwoZ6XjUM9
3.61 -Kxt/zaFQrAxdHE/6M73js7Iw1dEFs6fJttQpWrfLN2dOonVUTsLwMGHm7ZBLFvwB
3.62 -jTxDxV0A/koyqU57pjkXjWgi4yg3wkKSnHSajMI8W19i9EK3kks82KdZSMZfFFUX
3.63 -Z1Y1yDoV2IomDbIhYBi/O8tC1KsUUUl88nKQE15UreCAoLzs9tFOhLZ4amUx7j69
3.64 -EWw0QtwlsRuQK5O6zqQE8p6AQuyCrnB7u+pCKlqNH3JzM8T/Zg7iptwOmyd052gJ
3.65 -3gM3IAN2EluwmyeWt7I03wvZafhCw6qT14/v73lx1bbGTIiNlXGkciZwye1elRGL
3.66 -sp5X5MtROaJQ4GW1SA30wObtFKTY0Q4urUhvuLRed2q1H10GYe359RN4PVK12FL8
3.67 -CfEoZ1u0+nE/5hVkEg9j8lVixehaazHajnA6gUXkTLF3pMsJQZI/D0xJLbfyIRyV
3.68 -MsvmV/XIOt3ApCgc8ccBFayJypLwt37FBzLF1ue9Jscj0RHYYWh5+WQJAf+//b7U
3.69 -OZih7zlumsLMRfLstzp7FP6T6qxc3xH0DgcSDC+04QLflqYw3Hw3p7fFG02RztmS
3.70 -KNwDeAKwWHT3BeCPa3o6DGGGGFuWYLWOB6quN1nzgULQxlnf7sbQpOdX4HpdtkPb
3.71 -7hZyG4gX2CkYAJ7drompO7klIe4uD8gzSm5GK0pyLuJk+lJCIrK83fcBaPi+oORy
3.72 -+1bWBUE/w1bQaUl+NWVN/hbpzw6D+XFDzVaE+z+6YYp+PZzLzcl7J5oPrRCrqyYu
3.73 -s1tPvA1Doy11Z2xAEUaN1PZq5787emHPyWBFeYoXkOpr3eg2iJHpsY5Lo76Hn2+d
3.74 -pI7nE8PMwT2oi+l5YfWuLy2H7CQ7sw43btkMZ8tf4A5RyBhEEVB35Uf31i1dWe8i
3.75 -hw6ycs/9C3egImaxAYPcLizl4JJJvuN6n2GCtanQee9v+cFT8nZLuMo8F6R+mY8N
3.76 -Y4NOZar15VXvO8JRvnxPeaiRiVfvr2pyFEmYz/NdjjBHItLUaiidA4/b3WaiCzqR
3.77 -A4aDAgHUqy5ev7Wxa1ARvHXq7ErwH7DF7UT/rwCs++1tByjKrVfop/LpbkqfEZPX
3.78 -QoVRljtaZxOgMMyvb+iAO6YvyqJ6D+KgioqCA+m/zsm6kswGdVKNPW52bSM5G1Go
3.79 -9IbGhHNg7+3TVoIVJl4njlQDtPYgZqMTRXZpVtKEHjOPTgRfF9RIxaW2SOZ+BEaT
3.80 -wl37CL0C6IDa4oMA4WA0XaCBDHcYK/VyeCpNDnsu7ZfLDNDVg1df50elL65Rle5t
3.81 -PdY5iXA5lDj5xyw6eK8teYstBRoiG7BbDr9VWtUz2RAF0UMQ0tzP2y8JIL3e5ShV
3.82 -mCykxH1lj8A8Fcmgrax5kyfyBPhuyZqqYQ4dCFVHPXt1WOXgO6tlefcZGBDKoEKq
3.83 -bk2oRLQ2QCaUCWQGqfkKQHRBeqXQIYvMl1aK+0ak7pycgi+3mtS2VccQJv0Dg6ke
3.84 -767ffJGwkTB2rLo1hsNZBuCM9J+4P89khxgQQQTPBRphOjX9uOv/N3uwEUzDnCGr
3.85 -RfDiPcbbMvo4MYCQfbSz
3.86 -=YLvY
3.87 +hQEMA1oCBdlzCD9NAQf+K3rqpYDR+0+599UjAf8bkZfzpKWIQEPhnuQzTxP5xogJ
3.88 +6Boi1pDuwKfa3bX5yJmKaSOuicYlYzxB+bk6/wzl1MyWddkjFoeaHw+zAxlOHpQF
3.89 +h57crYrkIPp+vb4ZvmOFGOkQHCR/OGh9H6VOBXJM7YhwPO79rFsVEaKLjByoniWI
3.90 +k9E8oK7FcvJTwFjtx129UdwYhF0x8lA1I1KpKRzFqGyGRMAXdzLyRO57r6Kf7PGi
3.91 +5j0aXCq9rTjl0VKFGwP1JoZw77HHRwZuKY8prk5GQwji9rglbxr694MmGfJ49wXF
3.92 +CmEC5R737fmXn7cstfx/mlSLpxxU7dytGxGb05xTGoUBDAOo6/9vKSPoQgEH/jO1
3.93 +Pv1UniHL+ejAFPGe+KXNkq496xwj7C4xZn3Qe3oTDGENWQLXIMLEMBi3QQGZLiz0
3.94 +SAmyPZafXezmdFH9gTc5WKUwXqlDRUj7r0PEC3U5ExmfvVTDzcqDR2nSxhvULbvY
3.95 +bK1YFwcyqcD7Cgk/XDb9LKFe9TZ/le1EAjWR7ivLbwvtDgoU5RpaThwQg2Zb9xpc
3.96 +GShQFFqIlpUe+/OUOCFmraZapWnSkvtqiaLj/YMMjXq1GTksHkMXhPRIbcqwbdAj
3.97 +mFrBtLmKKpo2+tS8N3gZjnw/55rcSte3d+E5RaFXihzpGmcFjF8269sfuIQaZp/t
3.98 +eFoLaF/aAYGr/pnaLcfS6wFTYpFICGyWRDSYd+TlLIpsq9sciSzDgJtUlHzhMdHX
3.99 +TthwPH+IwQQst3spfF5xf7yJ+VPAOBdiHVJM5O7L/E6Gtb5lWyOWDHuIr+tF9Hdl
3.100 +tStyuG5SSiQdvhNQQYbLCQozGL9itN1WWQ0HjeGxeq7ml2iVhDEp1FChwmk8wW5b
3.101 +U2iKZM99OKB01JoHlFBNrWVwBHZhFU3C7QVgv9njNkhiayDUhXQscrdSfeGBjURy
3.102 +fvYFTFnwLPqk/aa7Yttz4by7FzQWF7jx13KGE8bic7rBDThu8YvMFDYRvEksfcZI
3.103 +gIuhehAM9SNDUpFd2o3sFMj5E6zhxRDUsA4yt5LtmTBkrlt7zAGavRdkpaGwarVN
3.104 +bU+vgQRXwg45WakVeBWeOVbj1XuRV5q2sT+OEcyCpIHo1pjHcd+ZzEPMWWQ+iAfh
3.105 +nD5UHPCrZUvY2/v5UQkoguvAtz+3P6Pc2HBwnZ4oU7JRqFDoSE1q6YSG6SWmzdfE
3.106 +N7A4JEiCOCSraKd+AhWsPAlb6XcUR0LJdt27B9EvrilWDztpIbsS4bp5WiwWWE9z
3.107 +7Cbq22xVJx/Z/GTsQfUywuiv6naTy6zQceVMTLGYNPmLpFG6AYC7B0QM92GwJl3h
3.108 +fh3IvcwBvjnxbRlbtzbMxdroPPJKr/z31xgVCnwgeTKteSGR/87RUVyusWQgFTGH
3.109 +oRAqrBje8lpMWzuCFo0J1c+FDWW9uKlDcenMGufzrTaaVOILjF7nqG9S44mH8b6/
3.110 +QvbPDMHrLe08YbOKM+DWxHmi1H5xS6HanvmLnX86LXUzbAOJNkBQybjbCt+AHvMA
3.111 +SzMUesKv9rMXpZ43wN5OPREAaalp3xFezJi9aGGZecU4ugS3PY5DAAm/CQUs3gTw
3.112 +SroB7o6Pn4g1dByjPrs9o6Vk8XqmLisJ5KAdWSfDlzNAnSgNvxgBPGy9eSNBvPPa
3.113 +JKlrw/1KyOI40RRgfaDQdR7tMIyecwSNMQIR09Annr5AoS3T/HB8fxl8I3njnfCJ
3.114 +CoGkX1BH0NAN9X891bk/h5MqRIQ6UeY80SZR//rAYBpElwSZxbrKs5/82e6bOv47
3.115 +O2p2iPzGB5yQlk2oXabq23JuHaCo3vjbNTsUP3P3jOc7sEfx9a45+7S6GaUORwJb
3.116 +4xLeWQTCI63T1/B7BHCLtcSlFbAiMPUpXsBjd69mgo/1NTgOkfez+Csqkk9PThLQ
3.117 +q/Zc7M1DHG1/mzlNIIdG0miHIsSpIuuXIjtenCQGj+nS4yMuy3mlgXyyQwYT6Q5u
3.118 +vn4Y8be06skAJYwgD3Lpskd/aGJaE5qoIDeHpcFvp71HHPPARE6ZQIqNYLGYvCEt
3.119 +Mv+7ouvKQzFu6hMqpvHWn8FqrANoM9r7j51SjIIyg877q1r7pYLNASITvdbf5RmX
3.120 +lyALr5VH8mgerbdupnvtfbpnOBVAB0eJbux83j0xCCRo2ajH9MHSFOiPLLon9XlW
3.121 +8ePi6ThjVejbn8MOIyzJIaNPcWvq2oe95cv645s/+8mVhoZRlDXlPcqcfoUhVNfr
3.122 +CW6tNdo/3Nea2jmIbbgELUlM2zEWJJp9PnpV7IDsWX+DHZGdrhL9DD95Nz2+7i5S
3.123 +TifPH6hGuzyuroZb5VuivS5uZmP6IJesSa2lnAwYnqtp3CC3eFJW+sWZatZElkmW
3.124 +Skd+YBfqulxaIKOuRD9DhveD0yfntg+mLiNdkYkOo+Co0XO52y3hUWV6igNJGmo/
3.125 +REwenK8QdGXQSUcga0zRtUJCjaq0qY+5lrz54CcEDoa7FJ6HrVbUeAj/2Dc7ncUA
3.126 +Gw4tIz6BLfKlb0tU64bldzDHyh0205IEj2mQi91yFUKjtvNH29eblovCivFlnLRo
3.127 +yjlOINSsQRSziUwLY5ydmSdLbxaveqQnAYqrHw3avGcpnirdtbf/qYQvhIy5AhwM
3.128 +UECMDFJRlF/Ty8paaKjJv74aJoPF+TY3kGfkzsPTjhLTDRC8n5s6Vtu/lUuTYTaL
3.129 +KRF/T0FdmN+sAMt2hoBMiZh7CjK5bryyNMJPsZvb6uvj3Den+wwigGXjn15NKanO
3.130 +JX5/c2oCPi+HXLef2xOao62mp9nq3rkfG4TqQ1dmTAXAVeyoajhzCBzjcBj7tRmW
3.131 +mrMD7M+iEXl8Qh5dFw8XCP+NITMAn0W+4vXlO2v5wKm3qQwzcx1BKg4EXQAxvBRm
3.132 +g3UaTS+kWTKA7fuGb2vC3vKNshlOCZWZohuMh7wH8rZHdLyzZDQQtynpnOJjyEZD
3.133 +mdEHQzMuuTwvCAj0Op0nkuaA3PUZb5Kb6A3UpBjVPuug7GMwmzBLKmcvWWF9fA2C
3.134 +kPMhHdJgcbx0TFPMMLb/MnZ0/i58GY2sSnvt+XGVJi7HFps3n3akvJlasTiU9Uph
3.135 +i/tW8daU3tJjXp0lynepQYeB7xYKrZfCK4aGvc5oljFDy04F6B+wZIczfmoO7ufo
3.136 +YKOhfrSqUIt6y50vNHViT0ld0GybIHDYbFZAmoEPzNtrHD0bTIgMCcmm4VYVzyOs
3.137 +SQmL354qJG0J8HThuQV7BfRTz3d+vtwWyQSUzQzR57IUDQswInTN3SfXMzxJMz+j
3.138 +wfw9zpjCxhRxFuqeon7ZqHaXV3l/ToWFvhqbLU/vaYDcznVte8EPrXjM5SD4yv6M
3.139 +2ik+74rpUNmEi3BNU1J4KYPJxmjfwhGCasDjB6QZUGPl6f8xNGX3jcieOsNPeCSU
3.140 +w19CBCB4SyHd6EUwV9KNMs9lR3J9+7Gm3YWUk9V0fVXfVyGR1Wb0zIaU6icVslNP
3.141 +csDxzocCGyNRcXZxH+9ydIvutu+2rpuaNmqky7AIwryle04qIhgSxxwd1GVn5ZFk
3.142 +LPFcDwTkyRP9HHEPtNWmgCw720E1g0xwEB/nN2WJtMir13nH7AI5WP3XnUskqEii
3.143 +cIe1KLyyMKh2HkpX4bwOQg+3+w==
3.144 +=bxby
3.145 -----END PGP MESSAGE-----
3.146
3.147 ---6cad4c4136e0bc423c41981d462ac858--
3.148 +--7fc8987062b7a13c4b986b451a1122ba--
4.1 --- a/test/src/engine_tests/AppleMailTests.cc Wed May 09 10:22:22 2018 +0200
4.2 +++ b/test/src/engine_tests/AppleMailTests.cc Wed May 09 11:39:10 2018 +0200
4.3 @@ -63,8 +63,8 @@
4.4 PEP_decrypt_flags_t flags = 0;
4.5
4.6 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
4.7 - TEST_ASSERT(status == PEP_STATUS_OK);
4.8 - TEST_ASSERT(msg_ptr);
4.9 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
4.10 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
4.11
4.12 update_identity(session, msg_ptr->from);
4.13 update_identity(session, msg_ptr->to->ident);
4.14 @@ -78,7 +78,7 @@
4.15 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
4.16 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
4.17
4.18 - TEST_ASSERT(color_from_rating(rating) == PEP_color_green);
4.19 + TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_green), "color_from_rating(rating) == PEP_color_green");
4.20
4.21 if (final_ptr == dest_msg)
4.22 free_message(dest_msg);
4.23 @@ -96,8 +96,8 @@
4.24 const string mailtext2 = slurp(mailfile2);
4.25
4.26 status = mime_decode_message(mailtext2.c_str(), mailtext2.length(), &msg_ptr);
4.27 - TEST_ASSERT(status == PEP_STATUS_OK);
4.28 - TEST_ASSERT(msg_ptr);
4.29 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
4.30 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
4.31 final_ptr = msg_ptr;
4.32 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
4.33 final_ptr = dest_msg ? dest_msg : msg_ptr;
4.34 @@ -106,7 +106,7 @@
4.35 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
4.36 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
4.37
4.38 - TEST_ASSERT(color_from_rating(rating) == PEP_color_green);
4.39 + TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_green), "color_from_rating(rating) == PEP_color_green");
4.40
4.41 if (final_ptr == dest_msg)
4.42 free_message(dest_msg);
5.1 --- a/test/src/engine_tests/BlacklistAcceptNewKeyTests.cc Wed May 09 10:22:22 2018 +0200
5.2 +++ b/test/src/engine_tests/BlacklistAcceptNewKeyTests.cc Wed May 09 11:39:10 2018 +0200
5.3 @@ -49,22 +49,22 @@
5.4 PEP_STATUS status8 = update_identity(session, blacklisted_identity);
5.5 PEP_STATUS status9 = blacklist_add(session, bl_fpr_1);
5.6 PEP_STATUS status10 = blacklist_is_listed(session, bl_fpr_1, &is_blacklisted);
5.7 - TEST_ASSERT(is_blacklisted);
5.8 + TEST_ASSERT_MSG((is_blacklisted), "is_blacklisted");
5.9 PEP_STATUS status11 = update_identity(session, blacklisted_identity);
5.10 - TEST_ASSERT(status11 == PEP_STATUS_OK);
5.11 - TEST_ASSERT(_streq(bl_fpr_1, blacklisted_identity->fpr));
5.12 + TEST_ASSERT_MSG((status11 == PEP_STATUS_OK), "status11 == PEP_STATUS_OK");
5.13 + TEST_ASSERT_MSG((_streq(bl_fpr_1, blacklisted_identity->fpr)), "_streq(bl_fpr_1, blacklisted_identity->fpr)");
5.14
5.15 bool id_def, us_def, addr_def;
5.16 status11 = get_valid_pubkey(session, blacklisted_identity,
5.17 &id_def, &us_def, &addr_def, true);
5.18 - TEST_ASSERT(blacklisted_identity->comm_type == PEP_ct_unknown);
5.19 + TEST_ASSERT_MSG((blacklisted_identity->comm_type == PEP_ct_unknown), "blacklisted_identity->comm_type == PEP_ct_unknown");
5.20
5.21 if (!(blacklisted_identity->fpr))
5.22 cout << "OK! blacklisted_identity->fpr is empty. Yay!" << endl;
5.23 else
5.24 cout << "Not OK. blacklisted_identity->fpr is " << blacklisted_identity->fpr << "." << endl
5.25 << "Expected it to be empty." << endl;
5.26 - TEST_ASSERT(!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0');
5.27 + TEST_ASSERT_MSG((!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0'), "!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0'");
5.28
5.29 /* identity is blacklisted. Now let's read in a message which contains a new key for that ID. */
5.30
5.31 @@ -80,13 +80,13 @@
5.32 PEP_decrypt_flags_t flags = 0;
5.33
5.34 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
5.35 - TEST_ASSERT(status == PEP_STATUS_OK);
5.36 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
5.37 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
5.38
5.39 PEP_STATUS status12 = get_valid_pubkey(session, blacklisted_identity,
5.40 &id_def, &us_def, &addr_def, true);
5.41
5.42 - TEST_ASSERT(strcasecmp(blacklisted_identity->fpr, new_key) == 0);
5.43 + TEST_ASSERT_MSG((strcasecmp(blacklisted_identity->fpr, new_key) == 0), "strcasecmp(blacklisted_identity->fpr, new_key) == 0");
5.44
5.45 PEP_STATUS status13 = blacklist_delete(session, bl_fpr_1);
5.46 PEP_STATUS status14 = update_identity(session, blacklisted_identity);
6.1 --- a/test/src/engine_tests/BlacklistTests.cc Wed May 09 10:22:22 2018 +0200
6.2 +++ b/test/src/engine_tests/BlacklistTests.cc Wed May 09 11:39:10 2018 +0200
6.3 @@ -42,19 +42,19 @@
6.4
6.5 cout << "adding 23 to blacklist\n";
6.6 PEP_STATUS status2 = blacklist_add(session, "23");
6.7 - TEST_ASSERT(status2 == PEP_STATUS_OK);
6.8 + TEST_ASSERT_MSG((status2 == PEP_STATUS_OK), "status2 == PEP_STATUS_OK");
6.9 cout << "added.\n";
6.10
6.11 bool listed;
6.12 PEP_STATUS status3 = blacklist_is_listed(session, "23", &listed);
6.13 - TEST_ASSERT(status3 == PEP_STATUS_OK);
6.14 - TEST_ASSERT(listed);
6.15 + TEST_ASSERT_MSG((status3 == PEP_STATUS_OK), "status3 == PEP_STATUS_OK");
6.16 + TEST_ASSERT_MSG((listed), "listed");
6.17 cout << "23 is listed.\n";
6.18
6.19 stringlist_t *blacklist;
6.20 PEP_STATUS status6 = blacklist_retrieve(session, &blacklist);
6.21 - TEST_ASSERT(status6 == PEP_STATUS_OK);
6.22 - TEST_ASSERT(blacklist);
6.23 + TEST_ASSERT_MSG((status6 == PEP_STATUS_OK), "status6 == PEP_STATUS_OK");
6.24 + TEST_ASSERT_MSG((blacklist), "blacklist");
6.25
6.26 bool in23 = false;
6.27 cout << "the blacklist contains now: ";
6.28 @@ -64,17 +64,17 @@
6.29 in23 = true;
6.30 }
6.31 cout << "END\n";
6.32 - TEST_ASSERT(in23);
6.33 + TEST_ASSERT_MSG((in23), "in23");
6.34 free_stringlist(blacklist);
6.35
6.36 cout << "deleting 23 from blacklist\n";
6.37 PEP_STATUS status4 = blacklist_delete(session, "23");
6.38 - TEST_ASSERT(status4 == PEP_STATUS_OK);
6.39 + TEST_ASSERT_MSG((status4 == PEP_STATUS_OK), "status4 == PEP_STATUS_OK");
6.40 cout << "deleted.\n";
6.41
6.42 PEP_STATUS status5 = blacklist_is_listed(session, "23", &listed);
6.43 - TEST_ASSERT(status5 == PEP_STATUS_OK);
6.44 - TEST_ASSERT(!listed);
6.45 + TEST_ASSERT_MSG((status5 == PEP_STATUS_OK), "status5 == PEP_STATUS_OK");
6.46 + TEST_ASSERT_MSG((!listed), "!listed");
6.47 cout << "23 is not listed any more.\n";
6.48
6.49 cout << "blacklist only key for identity / unblacklist key / add key" << endl;
6.50 @@ -117,15 +117,15 @@
6.51
6.52 PEP_STATUS status999 = update_identity(session, blacklisted_identity);
6.53
6.54 - TEST_ASSERT(blacklisted_identity->comm_type == PEP_ct_OpenPGP);
6.55 + TEST_ASSERT_MSG((blacklisted_identity->comm_type == PEP_ct_OpenPGP), "blacklisted_identity->comm_type == PEP_ct_OpenPGP");
6.56
6.57 PEP_STATUS status9 = blacklist_add(session, bl_fpr_1);
6.58 status10 = blacklist_is_listed(session, bl_fpr_1, &is_blacklisted);
6.59 PEP_STATUS status11 = update_identity(session, blacklisted_identity);
6.60 /* new!!! */
6.61 - TEST_ASSERT(is_blacklisted);
6.62 - TEST_ASSERT(status11 == PEP_STATUS_OK);
6.63 - TEST_ASSERT(_streq(bl_fpr_1, blacklisted_identity->fpr));
6.64 + TEST_ASSERT_MSG((is_blacklisted), "is_blacklisted");
6.65 + TEST_ASSERT_MSG((status11 == PEP_STATUS_OK), "status11 == PEP_STATUS_OK");
6.66 + TEST_ASSERT_MSG((_streq(bl_fpr_1, blacklisted_identity->fpr)), "_streq(bl_fpr_1, blacklisted_identity->fpr)");
6.67
6.68 bool id_def, us_def, addr_def;
6.69 status11 = get_valid_pubkey(session, blacklisted_identity,
6.70 @@ -141,7 +141,7 @@
6.71 else
6.72 cout << "Not OK. blacklisted_identity->fpr is " << blacklisted_identity->fpr << "." << endl
6.73 << "Expected it to be empty or (possibly) " << bl_fpr_2 << endl;
6.74 - TEST_ASSERT(!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0'|| (strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0));
6.75 + TEST_ASSERT_MSG((!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0'|| (strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0)), "!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0'|| (strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0)");
6.76
6.77 const string keytext2 = slurp("blacklisted_pub2.asc");
6.78 PEP_STATUS status14 = import_key(session, keytext2.c_str(), keytext2.length(), NULL);
6.79 @@ -152,7 +152,7 @@
6.80 "Blacklist Keypair");
6.81 PEP_STATUS status15 = update_identity(session, blacklisted_identity2);
6.82 //
6.83 - // TEST_ASSERT(blacklisted_identity2->fpr && strcmp(blacklisted_identity2->fpr, bl_fpr_2) == 0);
6.84 + // TEST_ASSERT_MSG((blacklisted_identity2->fpr && strcmp(blacklisted_identity2->fpr, bl_fpr_2) == 0), "blacklisted_identity2->fpr && strcmp(blacklisted_identity2->fpr, bl_fpr_2) == 0");
6.85 // if (blacklisted_identity2->fpr && strcmp(blacklisted_identity2->fpr, bl_fpr_2) == 0)
6.86 // cout << "blacklisted identity's fpr successfully replaced by the unblacklisted one" << endl;
6.87 // // else
6.88 @@ -169,7 +169,7 @@
6.89 // PEP_STATUS status00 = update_identity(session, stored_identity);
6.90 //
6.91 // // FIXME
6.92 - // // TEST_ASSERT(stored_identity->comm_type == PEP_ct_pEp);
6.93 + // // TEST_ASSERT_MSG((stored_identity->comm_type == PEP_ct_pEp), "stored_identity->comm_type == PEP_ct_pEp");
6.94
6.95 PEP_STATUS status16 = delete_keypair(session, bl_fpr_1);
6.96 update_identity(session, blacklisted_identity);
7.1 --- a/test/src/engine_tests/BloblistTests.cc Wed May 09 10:22:22 2018 +0200
7.2 +++ b/test/src/engine_tests/BloblistTests.cc Wed May 09 11:39:10 2018 +0200
7.3 @@ -58,12 +58,12 @@
7.4 cout << "duping one-element bloblist...\n";
7.5
7.6 bloblist_t* new_bl = bloblist_dup(bl1);
7.7 - TEST_ASSERT(new_bl);
7.8 - TEST_ASSERT(test_bloblist_node_equals(bl1, new_bl));
7.9 - TEST_ASSERT(new_bl->next == NULL);
7.10 - TEST_ASSERT(bl1->value != new_bl->value);
7.11 - TEST_ASSERT(bl1->mime_type != new_bl->mime_type || !(bl1->mime_type || new_bl->mime_type));
7.12 - TEST_ASSERT(bl1->filename != new_bl->filename || !(bl1->filename || new_bl->filename));
7.13 + TEST_ASSERT_MSG((new_bl), "new_bl");
7.14 + TEST_ASSERT_MSG((test_bloblist_node_equals(bl1, new_bl)), "test_bloblist_node_equals(bl1, new_bl)");
7.15 + TEST_ASSERT_MSG((new_bl->next == NULL), "new_bl->next == NULL");
7.16 + TEST_ASSERT_MSG((bl1->value != new_bl->value), "bl1->value != new_bl->value");
7.17 + TEST_ASSERT_MSG((bl1->mime_type != new_bl->mime_type || !(bl1->mime_type || new_bl->mime_type)), "bl1->mime_type != new_bl->mime_type || !(bl1->mime_type || new_bl->mime_type)");
7.18 + TEST_ASSERT_MSG((bl1->filename != new_bl->filename || !(bl1->filename || new_bl->filename)), "bl1->filename != new_bl->filename || !(bl1->filename || new_bl->filename)");
7.19 cout << "one-element bloblist duplicated.\n\n";
7.20
7.21 cout << "freeing bloblist...\n";
7.22 @@ -78,22 +78,22 @@
7.23 to_copy = bl_arr[i];
7.24 p = bloblist_add(new_bl, strdup(to_copy->value), to_copy->size, to_copy->mime_type, to_copy->filename);
7.25
7.26 - TEST_ASSERT(p);
7.27 + TEST_ASSERT_MSG((p), "p");
7.28 }
7.29
7.30 p = new_bl;
7.31
7.32 for (i = 0; i < 4; i++) {
7.33 - TEST_ASSERT(p);
7.34 + TEST_ASSERT_MSG((p), "p");
7.35
7.36 - TEST_ASSERT(test_bloblist_node_equals(p, bl_arr[i]));
7.37 - TEST_ASSERT(p->value != bl_arr[i]->value);
7.38 - TEST_ASSERT(p->mime_type != bl_arr[i]->mime_type || !(p->mime_type || bl_arr[i]->mime_type));
7.39 - TEST_ASSERT(p->filename != bl_arr[i]->filename || !(p->filename || bl_arr[i]->filename));
7.40 + TEST_ASSERT_MSG((test_bloblist_node_equals(p, bl_arr[i])), "test_bloblist_node_equals(p, bl_arr[i])");
7.41 + TEST_ASSERT_MSG((p->value != bl_arr[i]->value), "p->value != bl_arr[i]->value");
7.42 + TEST_ASSERT_MSG((p->mime_type != bl_arr[i]->mime_type || !(p->mime_type || bl_arr[i]->mime_type)), "p->mime_type != bl_arr[i]->mime_type || !(p->mime_type || bl_arr[i]->mime_type)");
7.43 + TEST_ASSERT_MSG((p->filename != bl_arr[i]->filename || !(p->filename || bl_arr[i]->filename)), "p->filename != bl_arr[i]->filename || !(p->filename || bl_arr[i]->filename)");
7.44
7.45 p = p->next;
7.46 }
7.47 - TEST_ASSERT(p == NULL);
7.48 + TEST_ASSERT_MSG((p == NULL), "p == NULL");
7.49
7.50 cout << "\nduplicating four-element list...\n\n";
7.51 bloblist_t* duplist = bloblist_dup(new_bl);
7.52 @@ -102,15 +102,15 @@
7.53 bloblist_t* dup_p = duplist;
7.54
7.55 while (dup_p) {
7.56 - TEST_ASSERT(test_bloblist_node_equals(p, dup_p));
7.57 - TEST_ASSERT(p != dup_p);
7.58 - TEST_ASSERT(p->value != dup_p->value);
7.59 - TEST_ASSERT(p->mime_type != dup_p->mime_type || !(p->mime_type || dup_p->mime_type));
7.60 - TEST_ASSERT(p->filename != dup_p->filename || !(p->filename || dup_p->filename));
7.61 + TEST_ASSERT_MSG((test_bloblist_node_equals(p, dup_p)), "test_bloblist_node_equals(p, dup_p)");
7.62 + TEST_ASSERT_MSG((p != dup_p), "p != dup_p");
7.63 + TEST_ASSERT_MSG((p->value != dup_p->value), "p->value != dup_p->value");
7.64 + TEST_ASSERT_MSG((p->mime_type != dup_p->mime_type || !(p->mime_type || dup_p->mime_type)), "p->mime_type != dup_p->mime_type || !(p->mime_type || dup_p->mime_type)");
7.65 + TEST_ASSERT_MSG((p->filename != dup_p->filename || !(p->filename || dup_p->filename)), "p->filename != dup_p->filename || !(p->filename || dup_p->filename)");
7.66
7.67 dup_p = dup_p->next;
7.68 p = p->next;
7.69 - TEST_ASSERT((p == NULL) == (dup_p == NULL));
7.70 + TEST_ASSERT_MSG(((p == NULL) == (dup_p == NULL)), "(p == NULL) == (dup_p == NULL)");
7.71 }
7.72 cout << "\nfour-element bloblist successfully duplicated.\n\n";
7.73
8.1 --- a/test/src/engine_tests/CaseAndDotAddressTests.cc Wed May 09 10:22:22 2018 +0200
8.2 +++ b/test/src/engine_tests/CaseAndDotAddressTests.cc Wed May 09 11:39:10 2018 +0200
8.3 @@ -35,7 +35,7 @@
8.4 const char* alice_email_case_and_dot = "PE.p.teS.t.ALICE@pep-project.OrG";
8.5
8.6 PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
8.7 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
8.8 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
8.9
8.10 pEp_identity * alice_id = new_identity("pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", user_id, "Alice Test");
8.11
8.12 @@ -43,8 +43,8 @@
8.13
8.14 pEp_identity * new_alice_id = new_identity("pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", user_id, "Alice Test");
8.15 status = update_identity(session, new_alice_id);
8.16 - TEST_ASSERT(new_alice_id->fpr);
8.17 - TEST_ASSERT(strcmp(new_alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
8.18 + TEST_ASSERT_MSG((new_alice_id->fpr), "new_alice_id->fpr");
8.19 + TEST_ASSERT_MSG((strcmp(new_alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0), "strcmp(new_alice_id->fpr, \"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97\") == 0");
8.20 free_identity(new_alice_id);
8.21 free_identity(alice_id);
8.22 alice_id = NULL;
8.23 @@ -52,33 +52,33 @@
8.24
8.25 alice_id = new_identity(alice_email_case, NULL, user_id, "Alice Test");
8.26 status = update_identity(session, alice_id);
8.27 - TEST_ASSERT(alice_id->fpr);
8.28 + TEST_ASSERT_MSG((alice_id->fpr), "alice_id->fpr");
8.29 cout << "Alice email: " << alice_email_case << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
8.30 - TEST_ASSERT(strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
8.31 + TEST_ASSERT_MSG((strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0), "strcmp(alice_id->fpr, \"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97\") == 0");
8.32 free_identity(alice_id);
8.33 alice_id = NULL;
8.34
8.35 alice_id = new_identity(alice_email_dot, NULL, user_id, "Alice Test");
8.36 status = update_identity(session, alice_id);
8.37 - TEST_ASSERT(alice_id->fpr);
8.38 + TEST_ASSERT_MSG((alice_id->fpr), "alice_id->fpr");
8.39 cout << "Alice email: " << alice_email_dot << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
8.40 - TEST_ASSERT(strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
8.41 + TEST_ASSERT_MSG((strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0), "strcmp(alice_id->fpr, \"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97\") == 0");
8.42 free_identity(alice_id);
8.43 alice_id = NULL;
8.44
8.45 alice_id = new_identity(alice_email_dotless, NULL, user_id, "Alice Test");
8.46 status = update_identity(session, alice_id);
8.47 - TEST_ASSERT(alice_id->fpr);
8.48 + TEST_ASSERT_MSG((alice_id->fpr), "alice_id->fpr");
8.49 cout << "Alice email: " << alice_email_dotless << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
8.50 - TEST_ASSERT(strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
8.51 + TEST_ASSERT_MSG((strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0), "strcmp(alice_id->fpr, \"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97\") == 0");
8.52 free_identity(alice_id);
8.53 alice_id = NULL;
8.54
8.55 alice_id = new_identity(alice_email_case_and_dot, NULL, user_id, "Alice Test");
8.56 status = update_identity(session, alice_id);
8.57 - TEST_ASSERT(alice_id->fpr);
8.58 + TEST_ASSERT_MSG((alice_id->fpr), "alice_id->fpr");
8.59 cout << "Alice email: " << alice_email_case_and_dot << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
8.60 - TEST_ASSERT(strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0);
8.61 + TEST_ASSERT_MSG((strcmp(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97") == 0), "strcmp(alice_id->fpr, \"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97\") == 0");
8.62 free_identity(alice_id);
8.63 alice_id = NULL;
8.64 }
9.1 --- a/test/src/engine_tests/CrashdumpTests.cc Wed May 09 10:22:22 2018 +0200
9.2 +++ b/test/src/engine_tests/CrashdumpTests.cc Wed May 09 11:39:10 2018 +0200
9.3 @@ -20,6 +20,6 @@
9.4 // MODULE test code
9.5 char *text;
9.6 PEP_STATUS status2 = get_crashdump_log(session, 0, &text);
9.7 - TEST_ASSERT(status2 == PEP_STATUS_OK);
9.8 + TEST_ASSERT_MSG((status2 == PEP_STATUS_OK), "status2 == PEP_STATUS_OK");
9.9 cout << text;
9.10 }
10.1 --- a/test/src/engine_tests/DecorateTests.cc Wed May 09 10:22:22 2018 +0200
10.2 +++ b/test/src/engine_tests/DecorateTests.cc Wed May 09 11:39:10 2018 +0200
10.3 @@ -35,9 +35,9 @@
10.4 PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
10.5 PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
10.6 PEP_STATUS statusbob = import_key(session, bob_pub_key.c_str(), bob_pub_key.length(), NULL);
10.7 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
10.8 - TEST_ASSERT(statuspriv == PEP_STATUS_OK);
10.9 - TEST_ASSERT(statusbob == PEP_STATUS_OK);
10.10 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
10.11 + TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
10.12 + TEST_ASSERT_MSG((statusbob == PEP_STATUS_OK), "statusbob == PEP_STATUS_OK");
10.13
10.14 cout << "creating message…\n";
10.15 pEp_identity* alice = new_identity("pep.test.alice@pep-project.org", NULL, PEP_OWN_USERID, "Alice Test");
10.16 @@ -45,13 +45,13 @@
10.17 alice->me = true;
10.18 identity_list* to_list = new_identity_list(bob); // to bob
10.19 message* outgoing_message = new_message(PEP_dir_outgoing);
10.20 - TEST_ASSERT(outgoing_message);
10.21 + TEST_ASSERT_MSG((outgoing_message), "outgoing_message");
10.22 outgoing_message->from = alice;
10.23 outgoing_message->to = to_list;
10.24 outgoing_message->shortmsg = strdup("Greetings, humans!");
10.25 outgoing_message->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
10.26 outgoing_message->longmsg = strdup("This is a dumb message.\nBut it's done.\n");
10.27 - TEST_ASSERT(outgoing_message->longmsg);
10.28 + TEST_ASSERT_MSG((outgoing_message->longmsg), "outgoing_message->longmsg");
10.29 cout << "message created.\n";
10.30
10.31 char* encoded_text = nullptr;
10.32 @@ -60,13 +60,13 @@
10.33 cout << "calling encrypt_message\n";
10.34 PEP_STATUS status = encrypt_message (session, outgoing_message, NULL, &encrypted_msg, PEP_enc_PGP_MIME, 0);
10.35 cout << "encrypt_message() returns " << tl_status_string(status) << '.' << endl;
10.36 - TEST_ASSERT(status == PEP_STATUS_OK);
10.37 - TEST_ASSERT(encrypted_msg);
10.38 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
10.39 + TEST_ASSERT_MSG((encrypted_msg), "encrypted_msg");
10.40 cout << "message encrypted.\n";
10.41
10.42 status = mime_encode_message(encrypted_msg, false, &encoded_text);
10.43 - TEST_ASSERT(status == PEP_STATUS_OK);
10.44 - TEST_ASSERT(encoded_text);
10.45 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
10.46 + TEST_ASSERT_MSG((encoded_text), "encoded_text");
10.47
10.48 bool contains_version = false;
10.49
10.50 @@ -79,7 +79,7 @@
10.51 if (strncmp(enc_string.c_str(), version_str, version_prefix_len) == 0)
10.52 contains_version = true;
10.53 }
10.54 - TEST_ASSERT(contains_version);
10.55 + TEST_ASSERT_MSG((contains_version), "contains_version");
10.56
10.57 if (contains_version)
10.58 cout << "Version string in encrypted message, as it should be." << endl;
11.1 --- a/test/src/engine_tests/DecryptAttachPrivateKeyTrustedTests.cc Wed May 09 10:22:22 2018 +0200
11.2 +++ b/test/src/engine_tests/DecryptAttachPrivateKeyTrustedTests.cc Wed May 09 11:39:10 2018 +0200
11.3 @@ -45,11 +45,11 @@
11.4 // 13A9F97964A2B52520CAA40E51BCA783C065A213
11.5 input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0xC065A213_pub.asc");
11.6 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
11.7 - TEST_ASSERT(status == PEP_STATUS_OK);
11.8 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
11.9
11.10 input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0xC065A213_priv.asc");
11.11 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
11.12 - TEST_ASSERT(status == PEP_STATUS_OK);
11.13 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
11.14
11.15 // ensure there's no private key - doesn't work in automated tests, sadly. Uncommon when running script manually.
11.16 bool has_priv = false;
11.17 @@ -60,7 +60,7 @@
11.18 // if (status == PEP_STATUS_OK) {
11.19 // has_priv = false;
11.20 // status = contains_priv_key(session, fpr_same_addr_same_uid, &has_priv);
11.21 - // TEST_ASSERT(has_priv == false);
11.22 + // TEST_ASSERT_MSG((has_priv == false), "has_priv == false");
11.23 // cout << "Successfully deleted keypair for " << fpr_same_addr_same_uid << " - will now import the public key only" << endl;
11.24 // }
11.25 // else
11.26 @@ -71,23 +71,23 @@
11.27 // 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
11.28 input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
11.29 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
11.30 - TEST_ASSERT(status == PEP_STATUS_OK);
11.31 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
11.32
11.33
11.34 cout << "Setting up own identity with default key " << fpr_main_me << endl;
11.35 // Own identity with default key etc
11.36 main_me = new_identity(main_addr, fpr_main_me, own_uid, "PrivateKey Import Test");
11.37 status = set_own_key(session, main_me, fpr_main_me);
11.38 - TEST_ASSERT(status == PEP_STATUS_OK);
11.39 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
11.40
11.41 - TEST_ASSERT(strcmp(main_me->fpr, fpr_main_me) == 0);
11.42 + TEST_ASSERT_MSG((strcmp(main_me->fpr, fpr_main_me) == 0), "strcmp(main_me->fpr, fpr_main_me) == 0");
11.43 cout << "Done!" << endl << endl;
11.44
11.45 cout << "Setting up sender identities and resetting key trust." << endl;
11.46 cout << "Same address, same user_id - address: " << main_addr << ", user_id: " << own_uid << ", fpr: " << fpr_same_addr_same_uid << endl;
11.47 same_addr_same_uid = new_identity(main_addr, fpr_same_addr_same_uid, own_uid, "PrivateKey Import Test");
11.48 - TEST_ASSERT(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
11.49 - TEST_ASSERT((same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed);
11.50 + TEST_ASSERT_MSG((status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY), "status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY");
11.51 + TEST_ASSERT_MSG(((same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed), "(same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed");
11.52
11.53 status = key_reset_trust(session, same_addr_same_uid);
11.54
11.55 @@ -110,14 +110,14 @@
11.56 cout << "Trusting personal key for " << same_addr_same_uid->user_id << " and " << same_addr_same_uid->fpr << endl;
11.57 status = trust_personal_key(session, same_addr_same_uid);
11.58 cout << "Status is " << tl_status_string(status) << endl;
11.59 - TEST_ASSERT(status == PEP_STATUS_OK);
11.60 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
11.61 free(decrypted_text);
11.62 decrypted_text = NULL;
11.63
11.64 status = get_trust(session, same_addr_same_uid);
11.65 cout << tl_ct_string(same_addr_same_uid->comm_type) << endl;
11.66
11.67 - TEST_ASSERT(same_addr_same_uid->comm_type == PEP_ct_pEp);
11.68 + TEST_ASSERT_MSG((same_addr_same_uid->comm_type == PEP_ct_pEp), "same_addr_same_uid->comm_type == PEP_ct_pEp");
11.69
11.70 flags = 0;
11.71 status = MIME_decrypt_message(session, encoded_text.c_str(),
11.72 @@ -126,7 +126,7 @@
11.73 &modified_src);
11.74
11.75 status = get_trust(session, same_addr_same_uid);
11.76 - TEST_ASSERT(same_addr_same_uid->comm_type == PEP_ct_pEp);
11.77 + TEST_ASSERT_MSG((same_addr_same_uid->comm_type == PEP_ct_pEp), "same_addr_same_uid->comm_type == PEP_ct_pEp");
11.78
11.79 flags = 0;
11.80 status = MIME_decrypt_message(session, encoded_text.c_str(),
11.81 @@ -135,13 +135,13 @@
11.82 &modified_src);
11.83
11.84 cout << "Status: " << tl_status_string(status) << endl;
11.85 - TEST_ASSERT(status == PEP_STATUS_OK);
11.86 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
11.87
11.88 cout << decrypted_text << endl;
11.89
11.90 has_priv = false;
11.91 status = contains_priv_key(session, fpr_same_addr_same_uid, &has_priv);
11.92 - TEST_ASSERT(has_priv == true);
11.93 + TEST_ASSERT_MSG((has_priv == true), "has_priv == true");
11.94 cout << "Private key was also imported." << endl;
11.95
11.96 cout << "PASS!" << endl;
12.1 --- a/test/src/engine_tests/DecryptAttachPrivateKeyUntrustedTests.cc Wed May 09 10:22:22 2018 +0200
12.2 +++ b/test/src/engine_tests/DecryptAttachPrivateKeyUntrustedTests.cc Wed May 09 11:39:10 2018 +0200
12.3 @@ -44,11 +44,11 @@
12.4 // 13A9F97964A2B52520CAA40E51BCA783C065A213
12.5 input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0xC065A213_pub.asc");
12.6 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
12.7 - TEST_ASSERT(status == PEP_STATUS_OK);
12.8 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
12.9
12.10 input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0xC065A213_priv.asc");
12.11 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
12.12 - TEST_ASSERT(status == PEP_STATUS_OK);
12.13 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
12.14
12.15 // ensure there's no private key - doesn't work in automated tests, sadly. Uncommon when running script manually.
12.16 bool has_priv = false;
12.17 @@ -64,23 +64,23 @@
12.18 // 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
12.19 input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
12.20 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
12.21 - TEST_ASSERT(status == PEP_STATUS_OK);
12.22 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
12.23
12.24
12.25 cout << "Setting up own identity with default key " << fpr_main_me << endl;
12.26 // Own identity with default key etc
12.27 main_me = new_identity(main_addr, fpr_main_me, own_uid, "PrivateKey Import Test");
12.28 status = set_own_key(session, main_me, fpr_main_me);
12.29 - TEST_ASSERT(status == PEP_STATUS_OK);
12.30 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
12.31
12.32 - TEST_ASSERT(strcmp(main_me->fpr, fpr_main_me) == 0);
12.33 + TEST_ASSERT_MSG((strcmp(main_me->fpr, fpr_main_me) == 0), "strcmp(main_me->fpr, fpr_main_me) == 0");
12.34 cout << "Done!" << endl << endl;
12.35
12.36 cout << "Setting up sender identities and resetting key trust." << endl;
12.37 cout << "Same address, same user_id - address: " << main_addr << ", user_id: " << own_uid << ", fpr: " << fpr_same_addr_same_uid << endl;
12.38 same_addr_same_uid = new_identity(main_addr, fpr_same_addr_same_uid, own_uid, "PrivateKey Import Test");
12.39 - TEST_ASSERT(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
12.40 - TEST_ASSERT((same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed);
12.41 + TEST_ASSERT_MSG((status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY), "status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY");
12.42 + TEST_ASSERT_MSG(((same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed), "(same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed");
12.43
12.44 status = key_reset_trust(session, same_addr_same_uid);
12.45
12.46 @@ -103,7 +103,7 @@
12.47 status = get_trust(session, same_addr_same_uid);
12.48 cout << tl_ct_string(same_addr_same_uid->comm_type) << endl;
12.49
12.50 - TEST_ASSERT((same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed);
12.51 + TEST_ASSERT_MSG(((same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed), "(same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed");
12.52
12.53 flags = 0;
12.54 status = MIME_decrypt_message(session, encoded_text.c_str(),
12.55 @@ -112,7 +112,7 @@
12.56 &modified_src);
12.57
12.58 status = get_trust(session, same_addr_same_uid);
12.59 - TEST_ASSERT(same_addr_same_uid->comm_type == PEP_ct_pEp_unconfirmed);
12.60 + TEST_ASSERT_MSG((same_addr_same_uid->comm_type == PEP_ct_pEp_unconfirmed), "same_addr_same_uid->comm_type == PEP_ct_pEp_unconfirmed");
12.61
12.62 cout << "Case 1 Status: " << tl_status_string(status) << endl;
12.63 cout << "Private key is not trusted for " << same_addr_same_uid->fpr << ", as desired, as the public key was not trusted." << endl;
13.1 --- a/test/src/engine_tests/EncryptAttachPrivateKeyTests.cc Wed May 09 10:22:22 2018 +0200
13.2 +++ b/test/src/engine_tests/EncryptAttachPrivateKeyTests.cc Wed May 09 11:39:10 2018 +0200
13.3 @@ -56,44 +56,44 @@
13.4 // 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
13.5 input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
13.6 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
13.7 - TEST_ASSERT(status == PEP_STATUS_OK);
13.8 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.9
13.10 input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0x3276D2E5_priv.asc");
13.11 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
13.12 - TEST_ASSERT(status == PEP_STATUS_OK);
13.13 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.14
13.15 // key with same address and user_id (initially untrusted, then trusted)
13.16 // 359DD8AC87D1F5E4304D08338D7185F180C8CD87
13.17 input_key = slurp("test_keys/pub/priv-key-import-test-main_1-0x80C8CD87_pub.asc");
13.18 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
13.19 - TEST_ASSERT(status == PEP_STATUS_OK);
13.20 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.21
13.22 // key with same address and to have different (non-aliased) user_id (initially untrusted, then trusted)
13.23 // B044B83639E292283A3F6E14C2E64B520B74809C
13.24 input_key = slurp("test_keys/pub/priv-key-import-test-main_2-0x0B74809C_pub.asc");
13.25 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
13.26 - TEST_ASSERT(status == PEP_STATUS_OK);
13.27 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.28
13.29 // key with different address to have same user_id (initially untrusted, then trusted)
13.30 // C52911EBA0D34B0F549594A15A7A363BD11252C9
13.31 input_key = slurp("test_keys/pub/priv-key-import-test-other_0-0xD11252C9_pub.asc");
13.32 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
13.33 - TEST_ASSERT(status == PEP_STATUS_OK);
13.34 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.35
13.36 // key with different address to have different user_id (initially untrusted, then trusted)
13.37 // 567212EFB8A3A76B1D32B9565F45BEA9C785F20A
13.38 input_key = slurp("test_keys/pub/priv-key-import-test-other_1-0xC785F20A_pub.asc");
13.39 status = import_key(session, input_key.c_str(), input_key.length(), NULL);
13.40 - TEST_ASSERT(status == PEP_STATUS_OK);
13.41 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.42 cout << "Done!" << endl << endl;
13.43
13.44 cout << "Setting up own identity with default key " << fpr_main_me << endl;
13.45 // Own identity with default key etc
13.46 main_me = new_identity(main_addr, fpr_main_me, own_uid, "PrivateKey Import Test");
13.47 status = set_own_key(session, main_me, fpr_main_me);
13.48 - TEST_ASSERT(status == PEP_STATUS_OK);
13.49 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.50
13.51 - TEST_ASSERT(strcmp(main_me->fpr, fpr_main_me) == 0);
13.52 + TEST_ASSERT_MSG((strcmp(main_me->fpr, fpr_main_me) == 0), "strcmp(main_me->fpr, fpr_main_me) == 0");
13.53 cout << "Done!" << endl << endl;
13.54
13.55 cout << "Setting up recipient identities and resetting key trust." << endl;
13.56 @@ -101,32 +101,32 @@
13.57 // Identity with same address and user_id - the fpr here will be ignored in update_identity and friends.
13.58 same_addr_same_uid = new_identity(main_addr, fpr_same_addr_same_uid, own_uid, "PrivateKey Import Test");
13.59 status = key_reset_trust(session, same_addr_same_uid);
13.60 - TEST_ASSERT(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
13.61 - TEST_ASSERT(strcmp(same_addr_same_uid->fpr, fpr_same_addr_same_uid) == 0);
13.62 + TEST_ASSERT_MSG((status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY), "status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY");
13.63 + TEST_ASSERT_MSG((strcmp(same_addr_same_uid->fpr, fpr_same_addr_same_uid) == 0), "strcmp(same_addr_same_uid->fpr, fpr_same_addr_same_uid) == 0");
13.64
13.65 // Identity with same address and different user_id
13.66 cout << "#2: same address, different user_id - address: " << main_addr << ", user_id: " << diff_uid_0 << ", fpr: " << fpr_same_addr_diff_uid << endl;
13.67 same_addr_diff_uid = new_identity(main_addr, fpr_same_addr_diff_uid, diff_uid_0, "PrivateKey Import Test");
13.68 - TEST_ASSERT(same_addr_diff_uid);
13.69 + TEST_ASSERT_MSG((same_addr_diff_uid), "same_addr_diff_uid");
13.70 status = key_reset_trust(session, same_addr_diff_uid);
13.71 - TEST_ASSERT(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
13.72 - TEST_ASSERT(strcmp(same_addr_diff_uid->fpr, fpr_same_addr_diff_uid) == 0);
13.73 + TEST_ASSERT_MSG((status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY), "status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY");
13.74 + TEST_ASSERT_MSG((strcmp(same_addr_diff_uid->fpr, fpr_same_addr_diff_uid) == 0), "strcmp(same_addr_diff_uid->fpr, fpr_same_addr_diff_uid) == 0");
13.75
13.76 // Identity with diff address and same user_id
13.77 cout << "#3: different address, same user_id - address: " << diff_addr_0 << ", user_id: " << own_uid << ", fpr: " << fpr_diff_addr_same_uid << endl;
13.78 diff_addr_same_uid = new_identity(diff_addr_0, fpr_diff_addr_same_uid, own_uid, "PrivateKey Import Test");
13.79 - TEST_ASSERT(diff_addr_same_uid);
13.80 + TEST_ASSERT_MSG((diff_addr_same_uid), "diff_addr_same_uid");
13.81 status = key_reset_trust(session, diff_addr_same_uid);
13.82 - TEST_ASSERT(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
13.83 - TEST_ASSERT(strcmp(diff_addr_same_uid->fpr, fpr_diff_addr_same_uid) == 0);
13.84 + TEST_ASSERT_MSG((status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY), "status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY");
13.85 + TEST_ASSERT_MSG((strcmp(diff_addr_same_uid->fpr, fpr_diff_addr_same_uid) == 0), "strcmp(diff_addr_same_uid->fpr, fpr_diff_addr_same_uid) == 0");
13.86
13.87 // Identity with different address and different user_id
13.88 cout << "#4: different address, different user_id - address: " << diff_addr_1 << ", user_id: " << diff_uid_1 << ", fpr: " << fpr_diff_addr_diff_uid << endl;
13.89 diff_addr_diff_uid = new_identity(diff_addr_1, fpr_diff_addr_diff_uid, diff_uid_1, "PrivateKey Import Test");
13.90 - TEST_ASSERT(diff_addr_diff_uid);
13.91 + TEST_ASSERT_MSG((diff_addr_diff_uid), "diff_addr_diff_uid");
13.92 status = key_reset_trust(session, diff_addr_diff_uid);
13.93 - TEST_ASSERT(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
13.94 - TEST_ASSERT(strcmp(diff_addr_diff_uid->fpr, fpr_diff_addr_diff_uid) == 0);
13.95 + TEST_ASSERT_MSG((status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY), "status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY");
13.96 + TEST_ASSERT_MSG((strcmp(diff_addr_diff_uid->fpr, fpr_diff_addr_diff_uid) == 0), "strcmp(diff_addr_diff_uid->fpr, fpr_diff_addr_diff_uid) == 0");
13.97 cout << "Done!" << endl << endl;
13.98
13.99 message* msg_same_addr_same_uid = new_message(PEP_dir_outgoing);
13.100 @@ -143,7 +143,7 @@
13.101 // Case 1:
13.102 // Same address, same user_id, untrusted
13.103 cout << "Case 1: Same address, same user_id, untrusted" << endl;
13.104 - TEST_ASSERT(msg_same_addr_same_uid);
13.105 + TEST_ASSERT_MSG((msg_same_addr_same_uid), "msg_same_addr_same_uid");
13.106 identity_list* to_list = new_identity_list(same_addr_same_uid);
13.107 msg_same_addr_same_uid->to = to_list;
13.108 message* enc_same_addr_same_uid_untrusted = NULL;
13.109 @@ -155,7 +155,7 @@
13.110 0);
13.111
13.112 cout << "Case 1 Status: " << tl_status_string(status) << endl;
13.113 - TEST_ASSERT(status == PEP_ILLEGAL_VALUE);
13.114 + TEST_ASSERT_MSG((status == PEP_ILLEGAL_VALUE), "status == PEP_ILLEGAL_VALUE");
13.115 cout << "PASS!" << endl;
13.116
13.117 // Case 2:
13.118 @@ -163,7 +163,7 @@
13.119 cout << "Case 2: Same address, same user_id, trusted" << endl;
13.120 status = trust_personal_key(session, same_addr_same_uid);
13.121 cout << "Trust personal key for " << same_addr_same_uid << " gives status " << tl_status_string(status) << " (" << status << ")" << endl;
13.122 - TEST_ASSERT(status == PEP_STATUS_OK);
13.123 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.124 message* enc_same_addr_same_uid_trusted = NULL;
13.125 status = encrypt_message_and_add_priv_key(session,
13.126 msg_same_addr_same_uid,
13.127 @@ -173,13 +173,13 @@
13.128 0);
13.129
13.130 cout << "Case 2 Status: " << tl_status_string(status) << endl;
13.131 - TEST_ASSERT(status == PEP_STATUS_OK);
13.132 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.133 cout << "PASS!" << endl;
13.134
13.135 // Case 3:
13.136 // Different address, same user_id, untrusted
13.137 cout << "Case 3: Different address, same user_id, untrusted" << endl;
13.138 - TEST_ASSERT(msg_diff_addr_same_uid);
13.139 + TEST_ASSERT_MSG((msg_diff_addr_same_uid), "msg_diff_addr_same_uid");
13.140 identity_list* to_list_1 = new_identity_list(diff_addr_same_uid);
13.141 msg_diff_addr_same_uid->to = to_list_1;
13.142 message* enc_diff_addr_same_uid_untrusted = NULL;
13.143 @@ -191,14 +191,14 @@
13.144 0);
13.145
13.146 cout << "Case 3 Status: " << tl_status_string(status) << endl;
13.147 - TEST_ASSERT(status == PEP_ILLEGAL_VALUE);
13.148 + TEST_ASSERT_MSG((status == PEP_ILLEGAL_VALUE), "status == PEP_ILLEGAL_VALUE");
13.149 cout << "PASS!" << endl;
13.150
13.151 // Case 4:
13.152 // Different address, same user_id, trusted
13.153 cout << "Case 4: Different address, same user_id, trusted" << endl;
13.154 status = trust_personal_key(session, diff_addr_same_uid);
13.155 - TEST_ASSERT(status == PEP_STATUS_OK);
13.156 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.157 message* enc_diff_addr_same_uid_trusted = NULL;
13.158 status = encrypt_message_and_add_priv_key(session,
13.159 msg_diff_addr_same_uid,
13.160 @@ -208,13 +208,13 @@
13.161 0);
13.162
13.163 cout << "Case 4 Status: " << tl_status_string(status) << endl;
13.164 - TEST_ASSERT(status == PEP_ILLEGAL_VALUE);
13.165 + TEST_ASSERT_MSG((status == PEP_ILLEGAL_VALUE), "status == PEP_ILLEGAL_VALUE");
13.166 cout << "PASS!" << endl;
13.167
13.168 // Case 5:
13.169 // Same address, different user_id, untrusted
13.170 cout << "Case 5: Same address, different user_id, untrusted" << endl;
13.171 - TEST_ASSERT(msg_same_addr_diff_uid);
13.172 + TEST_ASSERT_MSG((msg_same_addr_diff_uid), "msg_same_addr_diff_uid");
13.173 identity_list* to_list_2 = new_identity_list(same_addr_diff_uid);
13.174 msg_same_addr_diff_uid->to = to_list_2;
13.175 message* enc_same_addr_diff_uid_untrusted = NULL;
13.176 @@ -226,14 +226,14 @@
13.177 0);
13.178
13.179 cout << "Case 5 Status: " << tl_status_string(status) << endl;
13.180 - TEST_ASSERT(status == PEP_ILLEGAL_VALUE);
13.181 + TEST_ASSERT_MSG((status == PEP_ILLEGAL_VALUE), "status == PEP_ILLEGAL_VALUE");
13.182 cout << "PASS!" << endl;
13.183
13.184 // Case 6:
13.185 // Same address, different user_id, trusted
13.186 cout << "Case 6: Same address, different user_id, trusted" << endl;
13.187 status = trust_personal_key(session, same_addr_diff_uid);
13.188 - TEST_ASSERT(status == PEP_STATUS_OK);
13.189 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.190 message* enc_same_addr_diff_uid_trusted = NULL;
13.191 status = encrypt_message_and_add_priv_key(session,
13.192 msg_same_addr_diff_uid,
13.193 @@ -243,13 +243,13 @@
13.194 0);
13.195
13.196 cout << "Case 6 Status: " << tl_status_string(status) << endl;
13.197 - TEST_ASSERT(status == PEP_ILLEGAL_VALUE);
13.198 + TEST_ASSERT_MSG((status == PEP_ILLEGAL_VALUE), "status == PEP_ILLEGAL_VALUE");
13.199 cout << "PASS!" << endl;
13.200
13.201 // Case 7:
13.202 // Different address, different user_id, untrusted
13.203 cout << "Case 7: Different address, different user_id, untrusted" << endl;
13.204 - TEST_ASSERT(msg_diff_addr_diff_uid);
13.205 + TEST_ASSERT_MSG((msg_diff_addr_diff_uid), "msg_diff_addr_diff_uid");
13.206 identity_list* to_list_3 = new_identity_list(diff_addr_diff_uid);
13.207 msg_diff_addr_diff_uid->to = to_list_3;
13.208 message* enc_diff_addr_diff_uid_untrusted = NULL;
13.209 @@ -261,14 +261,14 @@
13.210 0);
13.211
13.212 cout << "Case 7 Status: " << tl_status_string(status) << endl;
13.213 - TEST_ASSERT(status == PEP_ILLEGAL_VALUE);
13.214 + TEST_ASSERT_MSG((status == PEP_ILLEGAL_VALUE), "status == PEP_ILLEGAL_VALUE");
13.215 cout << "PASS!" << endl;
13.216
13.217 // Case 8:
13.218 // Different address, different user_id, trusted
13.219 cout << "Case 8: Different address, different user_id, trusted" << endl;
13.220 status = trust_personal_key(session, diff_addr_diff_uid);
13.221 - TEST_ASSERT(status == PEP_STATUS_OK);
13.222 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
13.223 message* enc_diff_addr_diff_uid_trusted = NULL;
13.224 status = encrypt_message_and_add_priv_key(session,
13.225 msg_diff_addr_diff_uid,
13.226 @@ -278,7 +278,7 @@
13.227 0);
13.228
13.229 cout << "Case 8 Status: " << tl_status_string(status) << endl;
13.230 - TEST_ASSERT(status == PEP_ILLEGAL_VALUE);
13.231 + TEST_ASSERT_MSG((status == PEP_ILLEGAL_VALUE), "status == PEP_ILLEGAL_VALUE");
13.232 cout << "PASS!" << endl;
13.233
13.234 cout << "Correctly encrypted message:" << endl << endl;
14.1 --- a/test/src/engine_tests/EncryptForIdentityTests.cc Wed May 09 10:22:22 2018 +0200
14.2 +++ b/test/src/engine_tests/EncryptForIdentityTests.cc Wed May 09 11:39:10 2018 +0200
14.3 @@ -37,13 +37,13 @@
14.4
14.5 PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
14.6 PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
14.7 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
14.8 - TEST_ASSERT(statuspriv == PEP_STATUS_OK);
14.9 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
14.10 + TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
14.11
14.12 statuspub = import_key(session, gabrielle_pub_key.c_str(), gabrielle_pub_key.length(), NULL);
14.13 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
14.14 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
14.15 statuspub = import_key(session, bella_pub_key.c_str(), bella_pub_key.length(), NULL);
14.16 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
14.17 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
14.18
14.19 const char* alice_fpr = "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97";
14.20 const char* gabrielle_fpr = "906C9B8349954E82C5623C3C8C541BD4E203586C";
14.21 @@ -57,11 +57,11 @@
14.22 alice->me = true;
14.23
14.24 PEP_STATUS mystatus = set_own_key(session, alice, alice_fpr);
14.25 - TEST_ASSERT(mystatus == PEP_STATUS_OK);
14.26 + TEST_ASSERT_MSG((mystatus == PEP_STATUS_OK), "mystatus == PEP_STATUS_OK");
14.27
14.28 identity_list* to_list = new_identity_list(bob); // to bob
14.29 message* outgoing_message = new_message(PEP_dir_outgoing);
14.30 - TEST_ASSERT(outgoing_message);
14.31 + TEST_ASSERT_MSG((outgoing_message), "outgoing_message");
14.32 outgoing_message->from = alice;
14.33 outgoing_message->to = to_list;
14.34 outgoing_message->shortmsg = strdup("Greetings, humans!");
14.35 @@ -71,8 +71,8 @@
14.36
14.37 char* encoded_text = nullptr;
14.38 PEP_STATUS status = mime_encode_message(outgoing_message, false, &encoded_text);
14.39 - TEST_ASSERT(status == PEP_STATUS_OK);
14.40 - TEST_ASSERT(encoded_text);
14.41 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
14.42 + TEST_ASSERT_MSG((encoded_text), "encoded_text");
14.43
14.44 cout << "decrypted:\n\n";
14.45 cout << encoded_text << "\n";
14.46 @@ -83,20 +83,20 @@
14.47 cout << "calling encrypt_message_for_identity()\n";
14.48 status = encrypt_message_for_self(session, alice, outgoing_message, NULL, &encrypted_msg, PEP_enc_PGP_MIME, PEP_encrypt_flag_force_unsigned | PEP_encrypt_flag_force_no_attached_key);
14.49 cout << "encrypt_message() returns " << std::hex << status << '.' << endl;
14.50 - TEST_ASSERT(status == PEP_STATUS_OK);
14.51 - TEST_ASSERT(encrypted_msg);
14.52 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
14.53 + TEST_ASSERT_MSG((encrypted_msg), "encrypted_msg");
14.54 cout << "message encrypted.\n";
14.55
14.56 status = mime_encode_message(encrypted_msg, false, &encoded_text);
14.57 - TEST_ASSERT(status == PEP_STATUS_OK);
14.58 - TEST_ASSERT(encoded_text);
14.59 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
14.60 + TEST_ASSERT_MSG((encoded_text), "encoded_text");
14.61
14.62 cout << "encrypted:\n\n";
14.63 cout << encoded_text << "\n";
14.64
14.65 message* decoded_msg = nullptr;
14.66 status = mime_decode_message(encoded_text, strlen(encoded_text), &decoded_msg);
14.67 - TEST_ASSERT(status == PEP_STATUS_OK);
14.68 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
14.69 const string string3 = encoded_text;
14.70
14.71 unlink("msg_encrypt_for_self.asc");
14.72 @@ -112,12 +112,12 @@
14.73
14.74 flags = 0;
14.75 status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
14.76 - TEST_ASSERT(decrypted_msg);
14.77 - TEST_ASSERT(keylist_used);
14.78 - TEST_ASSERT(rating);
14.79 - TEST_ASSERT(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);
14.80 + TEST_ASSERT_MSG((decrypted_msg), "decrypted_msg");
14.81 + TEST_ASSERT_MSG((keylist_used), "keylist_used");
14.82 + TEST_ASSERT_MSG((rating), "rating");
14.83 + TEST_ASSERT_MSG((status == PEP_DECRYPTED && rating == PEP_rating_unreliable), "status == PEP_DECRYPTED && rating == PEP_rating_unreliable");
14.84 PEP_comm_type ct = encrypted_msg->from->comm_type;
14.85 - TEST_ASSERT(ct == PEP_ct_pEp || ct == PEP_ct_pEp_unconfirmed || ct == PEP_ct_OpenPGP || ct == PEP_ct_OpenPGP_unconfirmed );
14.86 + TEST_ASSERT_MSG((ct == PEP_ct_pEp || ct == PEP_ct_pEp_unconfirmed || ct == PEP_ct_OpenPGP || ct == PEP_ct_OpenPGP_unconfirmed ), "ct == PEP_ct_pEp || ct == PEP_ct_pEp_unconfirmed || ct == PEP_ct_OpenPGP || ct == PEP_ct_OpenPGP_unconfirmed ");
14.87
14.88 cout << "keys used:\n";
14.89
14.90 @@ -126,14 +126,14 @@
14.91 for (stringlist_t* kl4 = keylist_used; kl4 && kl4->value; kl4 = kl4->next, i++)
14.92 {
14.93 if (i == 0) {
14.94 - TEST_ASSERT(strcasecmp("",kl4->value) == 0);
14.95 + TEST_ASSERT_MSG((strcasecmp("",kl4->value) == 0), "strcasecmp(\"\",kl4->value) == 0");
14.96 }
14.97 else {
14.98 cout << "\t " << kl4->value << endl;
14.99 - TEST_ASSERT(strcasecmp("4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", kl4->value) == 0);
14.100 + TEST_ASSERT_MSG((strcasecmp("4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", kl4->value) == 0), "strcasecmp(\"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97\", kl4->value) == 0");
14.101 cout << "Encrypted for Alice! Yay! It worked!" << endl;
14.102 }
14.103 - TEST_ASSERT(i < 2);
14.104 + TEST_ASSERT_MSG((i < 2), "i < 2");
14.105 }
14.106 cout << "Encrypted ONLY for Alice! Test passed. Move along. These are not the bugs you are looking for." << endl;
14.107
14.108 @@ -153,18 +153,18 @@
14.109 cout << "calling encrypt_message_for_identity()\n";
14.110 status = encrypt_message_for_self(session, alice, outgoing_message, extra_keys, &encrypted_msg, PEP_enc_PGP_MIME, PEP_encrypt_flag_force_unsigned | PEP_encrypt_flag_force_no_attached_key);
14.111 cout << "encrypt_message() returns " << std::hex << status << '.' << endl;
14.112 - TEST_ASSERT(status == PEP_STATUS_OK);
14.113 - TEST_ASSERT(encrypted_msg);
14.114 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
14.115 + TEST_ASSERT_MSG((encrypted_msg), "encrypted_msg");
14.116 cout << "message encrypted.\n";
14.117
14.118 flags = 0;
14.119 status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
14.120 - TEST_ASSERT(decrypted_msg);
14.121 - TEST_ASSERT(keylist_used);
14.122 - TEST_ASSERT(rating);
14.123 - TEST_ASSERT(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);
14.124 + TEST_ASSERT_MSG((decrypted_msg), "decrypted_msg");
14.125 + TEST_ASSERT_MSG((keylist_used), "keylist_used");
14.126 + TEST_ASSERT_MSG((rating), "rating");
14.127 + TEST_ASSERT_MSG((status == PEP_DECRYPTED && rating == PEP_rating_unreliable), "status == PEP_DECRYPTED && rating == PEP_rating_unreliable");
14.128 ct = encrypted_msg->from->comm_type;
14.129 - TEST_ASSERT(ct == PEP_ct_pEp || ct == PEP_ct_pEp_unconfirmed || ct == PEP_ct_OpenPGP || ct == PEP_ct_OpenPGP_unconfirmed );
14.130 + TEST_ASSERT_MSG((ct == PEP_ct_pEp || ct == PEP_ct_pEp_unconfirmed || ct == PEP_ct_OpenPGP || ct == PEP_ct_OpenPGP_unconfirmed ), "ct == PEP_ct_pEp || ct == PEP_ct_pEp_unconfirmed || ct == PEP_ct_OpenPGP || ct == PEP_ct_OpenPGP_unconfirmed ");
14.131
14.132 cout << "keys used:\n";
14.133
14.134 @@ -179,7 +179,7 @@
14.135 }
14.136 }
14.137 cout << endl;
14.138 - TEST_ASSERT(found);
14.139 + TEST_ASSERT_MSG((found), "found");
14.140 }
14.141 cout << "Encrypted for all the extra keys!" << endl;
14.142
14.143 @@ -192,7 +192,7 @@
14.144 break;
14.145 }
14.146 }
14.147 - TEST_ASSERT(found);
14.148 + TEST_ASSERT_MSG((found), "found");
14.149
14.150 free_message(encrypted_msg);
14.151 encrypted_msg = NULL;
14.152 @@ -208,7 +208,7 @@
14.153 cout << "calling encrypt_message_for_identity()\n";
14.154 status = encrypt_message_for_self(session, alice, outgoing_message, extra_keys, &encrypted_msg, PEP_enc_PGP_MIME, PEP_encrypt_flag_force_unsigned | PEP_encrypt_flag_force_no_attached_key);
14.155 cout << "encrypt_message() returns " << std::hex << status << '.' << endl;
14.156 - TEST_ASSERT(status != PEP_STATUS_OK);
14.157 + TEST_ASSERT_MSG((status != PEP_STATUS_OK), "status != PEP_STATUS_OK");
14.158
14.159 free_message(outgoing_message);
14.160 outgoing_message = NULL;
14.161 @@ -263,11 +263,11 @@
14.162 &mimeflags,
14.163 &modified_src);
14.164
14.165 - TEST_ASSERT(decrypted_mimetext);
14.166 - TEST_ASSERT(keylist_used);
14.167 - TEST_ASSERT(mimerating);
14.168 + TEST_ASSERT_MSG((decrypted_mimetext), "decrypted_mimetext");
14.169 + TEST_ASSERT_MSG((keylist_used), "keylist_used");
14.170 + TEST_ASSERT_MSG((mimerating), "mimerating");
14.171
14.172 - TEST_ASSERT(status == PEP_DECRYPTED && mimerating == PEP_rating_unreliable);
14.173 + TEST_ASSERT_MSG((status == PEP_DECRYPTED && mimerating == PEP_rating_unreliable), "status == PEP_DECRYPTED && mimerating == PEP_rating_unreliable");
14.174
14.175 cout << "Decrypted message:" << endl;
14.176 cout << decrypted_mimetext << endl;
14.177 @@ -279,14 +279,14 @@
14.178 for (stringlist_t* kl4 = keylist_used; kl4 && kl4->value; kl4 = kl4->next, i++)
14.179 {
14.180 if (i == 0) {
14.181 - TEST_ASSERT(strcasecmp("",kl4->value) == 0);
14.182 + TEST_ASSERT_MSG((strcasecmp("",kl4->value) == 0), "strcasecmp(\"\",kl4->value) == 0");
14.183 }
14.184 else {
14.185 cout << "\t " << kl4->value << endl;
14.186 - TEST_ASSERT(strcasecmp("4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", kl4->value) == 0);
14.187 + TEST_ASSERT_MSG((strcasecmp("4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", kl4->value) == 0), "strcasecmp(\"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97\", kl4->value) == 0");
14.188 cout << "Encrypted for Alice! Yay! It worked!" << endl;
14.189 }
14.190 - TEST_ASSERT(i < 2);
14.191 + TEST_ASSERT_MSG((i < 2), "i < 2");
14.192 }
14.193 cout << "Encrypted ONLY for Alice! Test passed. Move along. These are not the bugs you are looking for." << endl;
14.194 }
15.1 --- a/test/src/engine_tests/EncryptMissingPrivateKeyTests.cc Wed May 09 10:22:22 2018 +0200
15.2 +++ b/test/src/engine_tests/EncryptMissingPrivateKeyTests.cc Wed May 09 11:39:10 2018 +0200
15.3 @@ -47,7 +47,7 @@
15.4 const string mailtext = slurp("test_mails/blacklist_no_key.eml");
15.5
15.6 PEP_STATUS status = mime_decode_message(mailtext.c_str(), mailtext.length(), &tmp_msg);
15.7 - TEST_ASSERT(status == PEP_STATUS_OK);
15.8 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
15.9
15.10 status = update_identity(session, tmp_msg->from);
15.11 identity_list* to_list = tmp_msg->to;
15.12 @@ -66,7 +66,7 @@
15.13 &enc_msg,
15.14 PEP_enc_PGP_MIME,
15.15 0);
15.16 - TEST_ASSERT(status == PEP_STATUS_OK);
15.17 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
15.18
15.19
15.20 char* new_key = enc_msg->from->fpr;
16.1 --- a/test/src/engine_tests/ExternalRevokeTests.cc Wed May 09 10:22:22 2018 +0200
16.2 +++ b/test/src/engine_tests/ExternalRevokeTests.cc Wed May 09 11:39:10 2018 +0200
16.3 @@ -36,13 +36,13 @@
16.4 const string fenris_pub_key = slurp("test_keys/pub/pep.test.fenris-0x4F3D2900_pub.asc");
16.5 const string fenris_priv_key = slurp("test_keys/priv/pep.test.fenris-0x4F3D2900_priv.asc");
16.6
16.7 - TEST_ASSERT(fenris_pub_key.length() != 0);
16.8 - TEST_ASSERT(fenris_priv_key.length() != 0);
16.9 + TEST_ASSERT_MSG((fenris_pub_key.length() != 0), "fenris_pub_key.length() != 0");
16.10 + TEST_ASSERT_MSG((fenris_priv_key.length() != 0), "fenris_priv_key.length() != 0");
16.11
16.12 PEP_STATUS statuspub = import_key(session, fenris_pub_key.c_str(), fenris_pub_key.length(), NULL);
16.13 PEP_STATUS statuspriv = import_key(session, fenris_priv_key.c_str(), fenris_priv_key.length(), NULL);
16.14 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
16.15 - TEST_ASSERT(statuspriv == PEP_STATUS_OK);
16.16 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
16.17 + TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
16.18
16.19 // Create sender ID
16.20
16.21 @@ -91,7 +91,7 @@
16.22 cout << "Creating message…\n";
16.23 identity_list* to_list = new_identity_list(identity_dup(recip1)); // to bob
16.24 message* outgoing_msg = new_message(PEP_dir_outgoing);
16.25 - TEST_ASSERT(outgoing_msg);
16.26 + TEST_ASSERT_MSG((outgoing_msg), "outgoing_msg");
16.27 outgoing_msg->from = identity_dup(me);
16.28 outgoing_msg->to = to_list;
16.29 outgoing_msg->shortmsg = strdup("Greetings, humans!");
16.30 @@ -105,18 +105,18 @@
16.31 status = encrypt_message(session, outgoing_msg, NULL, &encrypted_outgoing_msg, PEP_enc_PGP_MIME, 0);
16.32 cout << "Encrypted message with status " << tl_status_string(status) << endl;
16.33 // check status
16.34 - TEST_ASSERT(status == PEP_STATUS_OK);
16.35 - TEST_ASSERT(encrypted_outgoing_msg);
16.36 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
16.37 + TEST_ASSERT_MSG((encrypted_outgoing_msg), "encrypted_outgoing_msg");
16.38
16.39 cout << "Checking message recipient comm_type from message." << endl;
16.40 // check comm_type
16.41 cout << "comm_type: " << tl_ct_string(encrypted_outgoing_msg->to->ident->comm_type) << endl;
16.42 - TEST_ASSERT(encrypted_outgoing_msg->to->ident->comm_type == PEP_ct_OpenPGP);
16.43 + TEST_ASSERT_MSG((encrypted_outgoing_msg->to->ident->comm_type == PEP_ct_OpenPGP), "encrypted_outgoing_msg->to->ident->comm_type == PEP_ct_OpenPGP");
16.44
16.45 status = get_trust(session, recip1);
16.46
16.47 cout << "Recip's trust DB comm_type = " << hex << tl_ct_string(recip1->comm_type) << endl;
16.48 - TEST_ASSERT(recip1->comm_type == PEP_ct_OpenPGP); // FIXME: PEP_ct_pEp???
16.49 + TEST_ASSERT_MSG((recip1->comm_type == PEP_ct_OpenPGP), "recip1->comm_type == PEP_ct_OpenPGP"); // FIXME: PEP_ct_pEp???
16.50
16.51 // decrypt message
16.52 free_message(outgoing_msg);
16.53 @@ -134,18 +134,18 @@
16.54 cout << "Decrypting message." << endl;
16.55 status = decrypt_message(session, encrypted_outgoing_msg, &outgoing_msg, &keylist, &rating, &flags);
16.56 cout << "Decrypted message with status " << tl_status_string(status) << endl;
16.57 - TEST_ASSERT(status == PEP_STATUS_OK);
16.58 - TEST_ASSERT(rating == PEP_rating_trusted);
16.59 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
16.60 + TEST_ASSERT_MSG((rating == PEP_rating_trusted), "rating == PEP_rating_trusted");
16.61
16.62 // check rating
16.63 cout << "Rating of decrypted message to trusted recip: " << tl_rating_string(rating) << endl;
16.64 - TEST_ASSERT(rating == PEP_rating_trusted); // FIXME: trusted and anonymised?
16.65 + TEST_ASSERT_MSG((rating == PEP_rating_trusted), "rating == PEP_rating_trusted"); // FIXME: trusted and anonymised?
16.66
16.67 // check comm_type
16.68 status = get_trust(session, recip1);
16.69
16.70 cout << "Recip's trust DB comm_type = " << tl_ct_string(recip1->comm_type) << endl;
16.71 - TEST_ASSERT(recip1->comm_type == PEP_ct_OpenPGP); // FIXME: PEP_ct_pEp???
16.72 + TEST_ASSERT_MSG((recip1->comm_type == PEP_ct_OpenPGP), "recip1->comm_type == PEP_ct_OpenPGP"); // FIXME: PEP_ct_pEp???
16.73
16.74 cout << endl << "---------------------------------------------------------" << endl;
16.75 cout << "2a. Revoke key for (currently) trusted partner." << endl;
16.76 @@ -168,7 +168,7 @@
16.77 cout << "creating message…\n";
16.78 to_list = new_identity_list(identity_dup(recip1)); // to bob
16.79 outgoing_msg = new_message(PEP_dir_outgoing);
16.80 - TEST_ASSERT(outgoing_msg);
16.81 + TEST_ASSERT_MSG((outgoing_msg), "outgoing_msg");
16.82 outgoing_msg->from = identity_dup(me);
16.83 outgoing_msg->to = to_list;
16.84 outgoing_msg->shortmsg = strdup("Greetings, humans!");
16.85 @@ -189,19 +189,19 @@
16.86 TEST_ASSERT (status == PEP_UNENCRYPTED);
16.87 TEST_ASSERT (encrypted_outgoing_msg == NULL);
16.88 status = update_identity(session, recip1);
16.89 - TEST_ASSERT(recip1->comm_type = PEP_ct_key_not_found);
16.90 + TEST_ASSERT_MSG((recip1->comm_type = PEP_ct_key_not_found), "recip1->comm_type = PEP_ct_key_not_found");
16.91
16.92 cout << endl << "---------------------------------------------------------" << endl;
16.93 cout << "2c. Check trust of recip, whose only key has been revoked, once an encryption attempt has been made." << endl;
16.94 cout << "---------------------------------------------------------" << endl << endl;
16.95
16.96 - TEST_ASSERT(recip1->fpr == NULL);
16.97 + TEST_ASSERT_MSG((recip1->fpr == NULL), "recip1->fpr == NULL");
16.98 recip1->fpr = fprs[0];
16.99 status = get_trust(session, recip1);
16.100 recip1->fpr = NULL;
16.101
16.102 cout << "Recip's trust DB comm_type = " << hex << tl_ct_string(recip1->comm_type) << endl;
16.103 - TEST_ASSERT(recip1->comm_type == PEP_ct_unknown || recip1->comm_type == PEP_ct_key_revoked);
16.104 + TEST_ASSERT_MSG((recip1->comm_type == PEP_ct_unknown || recip1->comm_type == PEP_ct_key_revoked), "recip1->comm_type == PEP_ct_unknown || recip1->comm_type == PEP_ct_key_revoked");
16.105
16.106 free_message(decrypted_msg);
16.107 free_message(outgoing_msg);
16.108 @@ -233,7 +233,7 @@
16.109 // status = update_identity(session, recip1);
16.110 to_list = new_identity_list(identity_dup(recip1)); // to bob
16.111 outgoing_msg = new_message(PEP_dir_outgoing);
16.112 - TEST_ASSERT(outgoing_msg);
16.113 + TEST_ASSERT_MSG((outgoing_msg), "outgoing_msg");
16.114 outgoing_msg->from = identity_dup(me);
16.115 outgoing_msg->to = to_list;
16.116 outgoing_msg->shortmsg = strdup("Greetings, humans!");
16.117 @@ -250,12 +250,12 @@
16.118
16.119 // check comm_type
16.120 cout << "comm_type: " << tl_ct_string(ct) << endl;
16.121 - TEST_ASSERT(ct == PEP_ct_OpenPGP_unconfirmed);
16.122 + TEST_ASSERT_MSG((ct == PEP_ct_OpenPGP_unconfirmed), "ct == PEP_ct_OpenPGP_unconfirmed");
16.123
16.124 status = get_trust(session, recip1);
16.125
16.126 cout << "Recip's trust DB comm_type (should be unknown, as we're using a keyring-only key, not in DB) = " << hex << tl_ct_string(recip1->comm_type) << endl;
16.127 - TEST_ASSERT(recip1->comm_type != PEP_ct_OpenPGP_unconfirmed);
16.128 + TEST_ASSERT_MSG((recip1->comm_type != PEP_ct_OpenPGP_unconfirmed), "recip1->comm_type != PEP_ct_OpenPGP_unconfirmed");
16.129
16.130 // decrypt message
16.131 // free_message(outgoing_msg);
16.132 @@ -269,23 +269,23 @@
16.133 flags = 0;
16.134 status = decrypt_message(session, encrypted_outgoing_msg, &decrypted_msg, &keylist, &rating, &flags);
16.135 cout << "Decryption returns with status " << tl_status_string(status) << endl;
16.136 - TEST_ASSERT(status == PEP_STATUS_OK);
16.137 - TEST_ASSERT(decrypted_msg);
16.138 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
16.139 + TEST_ASSERT_MSG((decrypted_msg), "decrypted_msg");
16.140
16.141 // check rating
16.142 cout << "Rating of decrypted message to trusted recip: " << tl_rating_string(rating) << endl;
16.143 - TEST_ASSERT(rating == PEP_rating_reliable);
16.144 + TEST_ASSERT_MSG((rating == PEP_rating_reliable), "rating == PEP_rating_reliable");
16.145
16.146 status = update_identity(session, decrypted_msg->to->ident);
16.147 ct = (decrypted_msg ? decrypted_msg->to->ident->comm_type : outgoing_msg->to->ident->comm_type);
16.148
16.149 cout << "comm_type: " << tl_ct_string(ct) << endl;
16.150 - TEST_ASSERT(ct == PEP_ct_OpenPGP_unconfirmed);
16.151 + TEST_ASSERT_MSG((ct == PEP_ct_OpenPGP_unconfirmed), "ct == PEP_ct_OpenPGP_unconfirmed");
16.152
16.153 status = get_trust(session, recip1);
16.154
16.155 cout << "Recip's trust DB comm_type (should be unknown - there's nothing in the DB) = " << hex << tl_ct_string(recip1->comm_type) << endl;
16.156 - TEST_ASSERT(recip1->comm_type == PEP_ct_unknown);
16.157 + TEST_ASSERT_MSG((recip1->comm_type == PEP_ct_unknown), "recip1->comm_type == PEP_ct_unknown");
16.158
16.159 free_message(encrypted_outgoing_msg);
16.160 free_message(decrypted_msg);
17.1 --- a/test/src/engine_tests/I18nTests.cc Wed May 09 10:22:22 2018 +0200
17.2 +++ b/test/src/engine_tests/I18nTests.cc Wed May 09 11:39:10 2018 +0200
17.3 @@ -25,21 +25,21 @@
17.4
17.5 char *languages;
17.6 PEP_STATUS status2 = get_languagelist(session, &languages);
17.7 - TEST_ASSERT(status2 == PEP_STATUS_OK);
17.8 - TEST_ASSERT(languages);
17.9 + TEST_ASSERT_MSG((status2 == PEP_STATUS_OK), "status2 == PEP_STATUS_OK");
17.10 + TEST_ASSERT_MSG((languages), "languages");
17.11
17.12 cout << languages;
17.13 pEp_free(languages);
17.14
17.15 char *phrase;
17.16 PEP_STATUS status3 = get_phrase(session, "de", 1000, &phrase);
17.17 - TEST_ASSERT(status3 == PEP_STATUS_OK);
17.18 - TEST_ASSERT(phrase);
17.19 + TEST_ASSERT_MSG((status3 == PEP_STATUS_OK), "status3 == PEP_STATUS_OK");
17.20 + TEST_ASSERT_MSG((phrase), "phrase");
17.21
17.22 cout << "\nGerman: " << phrase << "\n";
17.23 pEp_free(phrase);
17.24
17.25 status3 = get_phrase(session, "zz", 1000, &phrase);
17.26 - TEST_ASSERT(status3 == PEP_PHRASE_NOT_FOUND);
17.27 - TEST_ASSERT(phrase == NULL);
17.28 + TEST_ASSERT_MSG((status3 == PEP_PHRASE_NOT_FOUND), "status3 == PEP_PHRASE_NOT_FOUND");
17.29 + TEST_ASSERT_MSG((phrase == NULL), "phrase == NULL");
17.30 }
18.1 --- a/test/src/engine_tests/IdentityListTests.cc Wed May 09 10:22:22 2018 +0200
18.2 +++ b/test/src/engine_tests/IdentityListTests.cc Wed May 09 11:39:10 2018 +0200
18.3 @@ -86,23 +86,23 @@
18.4 cout << "creating one-element identity_list...\n";
18.5
18.6 pEp_identity* new_id = identity_dup(id1);
18.7 - TEST_ASSERT(new_id);
18.8 + TEST_ASSERT_MSG((new_id), "new_id");
18.9 identity_list* idlist = new_identity_list(new_id);
18.10 - TEST_ASSERT(idlist->ident);
18.11 - TEST_ASSERT(test_identity_equals(id1, idlist->ident));
18.12 - TEST_ASSERT(idlist->next == NULL);
18.13 + TEST_ASSERT_MSG((idlist->ident), "idlist->ident");
18.14 + TEST_ASSERT_MSG((test_identity_equals(id1, idlist->ident)), "test_identity_equals(id1, idlist->ident)");
18.15 + TEST_ASSERT_MSG((idlist->next == NULL), "idlist->next == NULL");
18.16 cout << "one-element identity_list created, next element is NULL\n\n";
18.17
18.18 cout << "duplicating one-element list...\n";
18.19 identity_list* duplist = identity_list_dup(idlist);
18.20 pEp_identity* srcid = idlist->ident;
18.21 pEp_identity* dstid = duplist->ident;
18.22 - TEST_ASSERT(dstid);
18.23 - TEST_ASSERT(test_identity_equals(srcid, dstid));
18.24 - TEST_ASSERT(srcid->address != dstid->address); // test deep copies
18.25 - TEST_ASSERT(srcid->fpr != dstid->fpr);
18.26 - TEST_ASSERT(srcid->username != dstid->username);
18.27 - TEST_ASSERT(duplist->next == NULL);
18.28 + TEST_ASSERT_MSG((dstid), "dstid");
18.29 + TEST_ASSERT_MSG((test_identity_equals(srcid, dstid)), "test_identity_equals(srcid, dstid)");
18.30 + TEST_ASSERT_MSG((srcid->address != dstid->address), "srcid->address != dstid->address"); // test deep copies
18.31 + TEST_ASSERT_MSG((srcid->fpr != dstid->fpr), "srcid->fpr != dstid->fpr");
18.32 + TEST_ASSERT_MSG((srcid->username != dstid->username), "srcid->username != dstid->username");
18.33 + TEST_ASSERT_MSG((duplist->next == NULL), "duplist->next == NULL");
18.34 cout << "one-element identity_list duplicated.\n\n";
18.35
18.36 cout << "freeing identity_lists...\n";
18.37 @@ -117,25 +117,25 @@
18.38 idlist = identity_list_add(idlist, identity_dup(id_arr[0]));
18.39 for (i = 1; i < 4; i++) {
18.40 p = identity_list_add(idlist, identity_dup(id_arr[i]));
18.41 - TEST_ASSERT(p);
18.42 + TEST_ASSERT_MSG((p), "p");
18.43 }
18.44
18.45 p = idlist;
18.46
18.47 for (i = 0; i < 4; i++) {
18.48 - TEST_ASSERT(p);
18.49 + TEST_ASSERT_MSG((p), "p");
18.50
18.51 srcid = p->ident;
18.52 - TEST_ASSERT(srcid);
18.53 + TEST_ASSERT_MSG((srcid), "srcid");
18.54
18.55 - TEST_ASSERT(test_identity_equals(srcid, id_arr[i]));
18.56 - TEST_ASSERT(srcid->address != id_arr[i]->address); // test deep copies
18.57 - TEST_ASSERT(srcid->fpr != id_arr[i]->fpr);
18.58 - TEST_ASSERT(srcid->username != id_arr[i]->username);
18.59 + TEST_ASSERT_MSG((test_identity_equals(srcid, id_arr[i])), "test_identity_equals(srcid, id_arr[i])");
18.60 + TEST_ASSERT_MSG((srcid->address != id_arr[i]->address), "srcid->address != id_arr[i]->address"); // test deep copies
18.61 + TEST_ASSERT_MSG((srcid->fpr != id_arr[i]->fpr), "srcid->fpr != id_arr[i]->fpr");
18.62 + TEST_ASSERT_MSG((srcid->username != id_arr[i]->username), "srcid->username != id_arr[i]->username");
18.63
18.64 p = p->next;
18.65 }
18.66 - TEST_ASSERT(p == NULL);
18.67 + TEST_ASSERT_MSG((p == NULL), "p == NULL");
18.68
18.69 cout << "\nduplicating four-element list...\n\n";
18.70 duplist = identity_list_dup(idlist);
18.71 @@ -147,20 +147,20 @@
18.72 srcid = p->ident;
18.73 dstid = dup_p->ident;
18.74
18.75 - TEST_ASSERT(dstid);
18.76 + TEST_ASSERT_MSG((dstid), "dstid");
18.77
18.78 - TEST_ASSERT(test_identity_equals(srcid, dstid));
18.79 + TEST_ASSERT_MSG((test_identity_equals(srcid, dstid)), "test_identity_equals(srcid, dstid)");
18.80
18.81 - TEST_ASSERT(srcid != dstid); // test deep copies
18.82 - TEST_ASSERT(srcid->address != dstid->address); // test deep copies
18.83 - TEST_ASSERT(srcid->fpr != dstid->fpr);
18.84 - TEST_ASSERT(srcid->username != dstid->username);
18.85 + TEST_ASSERT_MSG((srcid != dstid), "srcid != dstid"); // test deep copies
18.86 + TEST_ASSERT_MSG((srcid->address != dstid->address), "srcid->address != dstid->address"); // test deep copies
18.87 + TEST_ASSERT_MSG((srcid->fpr != dstid->fpr), "srcid->fpr != dstid->fpr");
18.88 + TEST_ASSERT_MSG((srcid->username != dstid->username), "srcid->username != dstid->username");
18.89
18.90 i++;
18.91 p = p->next;
18.92
18.93 dup_p = dup_p->next;
18.94 - TEST_ASSERT((p == NULL) == (dup_p == NULL));
18.95 + TEST_ASSERT_MSG(((p == NULL) == (dup_p == NULL)), "(p == NULL) == (dup_p == NULL)");
18.96 }
18.97 cout << "\nfour-element identity_list successfully duplicated.\n\n";
18.98
19.1 --- a/test/src/engine_tests/KeyeditTests.cc Wed May 09 10:22:22 2018 +0200
19.2 +++ b/test/src/engine_tests/KeyeditTests.cc Wed May 09 11:39:10 2018 +0200
19.3 @@ -33,10 +33,10 @@
19.4 "423",
19.5 "expire test key"
19.6 );
19.7 - TEST_ASSERT(identity);
19.8 + TEST_ASSERT_MSG((identity), "identity");
19.9 PEP_STATUS generate_status = generate_keypair(session, identity);
19.10 cout << "generate_keypair() exits with " << generate_status << "\n";
19.11 - TEST_ASSERT(generate_status == PEP_STATUS_OK);
19.12 + TEST_ASSERT_MSG((generate_status == PEP_STATUS_OK), "generate_status == PEP_STATUS_OK");
19.13 cout << "generated key is " << identity->fpr << "\n";
19.14
19.15 string key(identity->fpr);
19.16 @@ -51,7 +51,7 @@
19.17
19.18 PEP_STATUS status2 = renew_key(session, key.c_str(), ts);
19.19 cout << "renew_key() exited with " << status2 << "\n";
19.20 - TEST_ASSERT(status2 == PEP_STATUS_OK);
19.21 + TEST_ASSERT_MSG((status2 == PEP_STATUS_OK), "status2 == PEP_STATUS_OK");
19.22 free_timestamp(ts);
19.23
19.24 cout << "key renewed.\n";
19.25 @@ -59,12 +59,12 @@
19.26 cout << "key will be revoked\n";
19.27 PEP_STATUS status3 = revoke_key(session, key.c_str(), "revoke test");
19.28 cout << "revoke_key() exited with " << status3 << "\n";
19.29 - TEST_ASSERT(status3 == PEP_STATUS_OK);
19.30 + TEST_ASSERT_MSG((status3 == PEP_STATUS_OK), "status3 == PEP_STATUS_OK");
19.31
19.32 cout << "key revoked.\n";
19.33
19.34 cout << "deleting key pair " << key.c_str() << "\n";
19.35 PEP_STATUS delete_status = delete_keypair(session, key.c_str());
19.36 cout << "delete_keypair() exits with " << delete_status << "\n";
19.37 - TEST_ASSERT(delete_status == PEP_STATUS_OK);
19.38 + TEST_ASSERT_MSG((delete_status == PEP_STATUS_OK), "delete_status == PEP_STATUS_OK");
19.39 }
20.1 --- a/test/src/engine_tests/LeastColorGroupTests.cc Wed May 09 10:22:22 2018 +0200
20.2 +++ b/test/src/engine_tests/LeastColorGroupTests.cc Wed May 09 11:39:10 2018 +0200
20.3 @@ -41,7 +41,7 @@
20.4 cout << "\t read keyfile \"" << name << "\"..." << std::endl;
20.5 const string keytextkey = slurp(name);
20.6 PEP_STATUS statuskey = import_key(session, keytextkey.c_str(), keytextkey.length(), NULL);
20.7 - TEST_ASSERT(statuskey == PEP_STATUS_OK);
20.8 + TEST_ASSERT_MSG((statuskey == PEP_STATUS_OK), "statuskey == PEP_STATUS_OK");
20.9 }
20.10
20.11 cout << "\t read keyfile mailfile \"" << mailfile << "\"..." << std::endl;
20.12 @@ -70,8 +70,8 @@
20.13 PEP_decrypt_flags_t flags;
20.14
20.15 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
20.16 - TEST_ASSERT(status == PEP_STATUS_OK);
20.17 - TEST_ASSERT(msg_ptr);
20.18 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
20.19 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
20.20 final_ptr = msg_ptr;
20.21 flags = 0;
20.22 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
21.1 --- a/test/src/engine_tests/LeastCommonDenomColorTests.cc Wed May 09 10:22:22 2018 +0200
21.2 +++ b/test/src/engine_tests/LeastCommonDenomColorTests.cc Wed May 09 11:39:10 2018 +0200
21.3 @@ -68,15 +68,15 @@
21.4 PEP_decrypt_flags_t flags;
21.5
21.6 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
21.7 - TEST_ASSERT(status == PEP_STATUS_OK);
21.8 - TEST_ASSERT(msg_ptr);
21.9 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
21.10 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
21.11
21.12 flags = 0;
21.13 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
21.14 - TEST_ASSERT(status == PEP_STATUS_OK);
21.15 - TEST_ASSERT(dest_msg);
21.16 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
21.17 + TEST_ASSERT_MSG((dest_msg), "dest_msg");
21.18 /* message is signed and no recip is mistrusted... */
21.19 - TEST_ASSERT(color_from_rating(rating) == PEP_color_yellow);
21.20 + TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_yellow), "color_from_rating(rating) == PEP_color_yellow");
21.21
21.22 cout << "shortmsg: " << dest_msg->shortmsg << endl << endl;
21.23 cout << "longmsg: " << dest_msg->longmsg << endl << endl;
21.24 @@ -86,26 +86,26 @@
21.25
21.26 /* re-evaluate rating, counting on optional fields */
21.27 status = re_evaluate_message_rating(session, dest_msg, NULL, PEP_rating_undefined, &rating);
21.28 - TEST_ASSERT(status == PEP_STATUS_OK);
21.29 - TEST_ASSERT(color_from_rating(rating) == PEP_color_yellow);
21.30 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
21.31 + TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_yellow), "color_from_rating(rating) == PEP_color_yellow");
21.32
21.33 /* re-evaluate rating, without optional fields */
21.34 status = re_evaluate_message_rating(session, dest_msg, keylist, decrypt_rating, &rating);
21.35 - TEST_ASSERT(status == PEP_STATUS_OK);
21.36 - TEST_ASSERT(color_from_rating(rating) == PEP_color_yellow);
21.37 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
21.38 + TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_yellow), "color_from_rating(rating) == PEP_color_yellow");
21.39
21.40 /* Ok, now mistrust one recip */
21.41 key_mistrusted(session, recip2);
21.42
21.43 /* re-evaluate rating, counting on optional fields */
21.44 status = re_evaluate_message_rating(session, dest_msg, NULL, PEP_rating_undefined, &rating);
21.45 - TEST_ASSERT(status == PEP_STATUS_OK);
21.46 - TEST_ASSERT(color_from_rating(rating) == PEP_color_red);
21.47 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
21.48 + TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_red), "color_from_rating(rating) == PEP_color_red");
21.49
21.50 /* re-evaluate rating, without optional fields */
21.51 status = re_evaluate_message_rating(session, dest_msg, keylist, decrypt_rating, &rating);
21.52 - TEST_ASSERT(status == PEP_STATUS_OK);
21.53 - TEST_ASSERT(color_from_rating(rating) == PEP_color_red);
21.54 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
21.55 + TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_red), "color_from_rating(rating) == PEP_color_red");
21.56
21.57 free_message(dest_msg);
21.58 free_message(msg_ptr);
21.59 @@ -117,8 +117,8 @@
21.60 rating = PEP_rating_unreliable;
21.61
21.62 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
21.63 - TEST_ASSERT(status == PEP_STATUS_OK);
21.64 - TEST_ASSERT(msg_ptr);
21.65 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
21.66 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
21.67 flags = 0;
21.68 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
21.69
21.70 @@ -127,7 +127,7 @@
21.71 cout << "longmsg_formatted: " << (dest_msg->longmsg_formatted ? dest_msg->longmsg_formatted : "(empty)") << endl << endl;
21.72
21.73 /* message is signed and no recip is mistrusted... */
21.74 - TEST_ASSERT(color_from_rating(rating) == PEP_color_red);
21.75 + TEST_ASSERT_MSG((color_from_rating(rating) == PEP_color_red), "color_from_rating(rating) == PEP_color_red");
21.76
21.77 free_message(dest_msg);
21.78 free_message(msg_ptr);
22.1 --- a/test/src/engine_tests/MessageApiTests.cc Wed May 09 10:22:22 2018 +0200
22.2 +++ b/test/src/engine_tests/MessageApiTests.cc Wed May 09 11:39:10 2018 +0200
22.3 @@ -33,11 +33,11 @@
22.4 const string bob_pub_key = slurp("test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc");
22.5
22.6 PEP_STATUS status0 = import_key(session, alice_pub_key.c_str(), alice_pub_key.size(), NULL);
22.7 - TEST_ASSERT(status0 == PEP_STATUS_OK);
22.8 + TEST_ASSERT_MSG((status0 == PEP_STATUS_OK), "status0 == PEP_STATUS_OK");
22.9 status0 = import_key(session, alice_priv_key.c_str(), alice_priv_key.size(), NULL);
22.10 - TEST_ASSERT(status0 == PEP_STATUS_OK);
22.11 + TEST_ASSERT_MSG((status0 == PEP_STATUS_OK), "status0 == PEP_STATUS_OK");
22.12 status0 = import_key(session, bob_pub_key.c_str(), bob_pub_key.size(), NULL);
22.13 - TEST_ASSERT(status0 == PEP_STATUS_OK);
22.14 + TEST_ASSERT_MSG((status0 == PEP_STATUS_OK), "status0 == PEP_STATUS_OK");
22.15 // message_api test code
22.16
22.17 cout << "creating message…\n";
22.18 @@ -47,7 +47,7 @@
22.19 identity_list *to2 = new_identity_list(new_identity("pep.test.bob@pep-project.org", NULL, "42", "Bob Test"));
22.20 // identity_list *to2 = new_identity_list(new_identity("still@nokey.blup", NULL, "42", "Still no key"));
22.21 message *msg2 = new_message(PEP_dir_outgoing);
22.22 - TEST_ASSERT(msg2);
22.23 + TEST_ASSERT_MSG((msg2), "msg2");
22.24 msg2->from = me2;
22.25 msg2->to = to2;
22.26 msg2->shortmsg = strdup("hello, world");
22.27 @@ -56,8 +56,8 @@
22.28
22.29 char *text2 = nullptr;
22.30 PEP_STATUS status2 = mime_encode_message(msg2, false, &text2);
22.31 - TEST_ASSERT(status2 == PEP_STATUS_OK);
22.32 - TEST_ASSERT(text2);
22.33 + TEST_ASSERT_MSG((status2 == PEP_STATUS_OK), "status2 == PEP_STATUS_OK");
22.34 + TEST_ASSERT_MSG((text2), "text2");
22.35
22.36 cout << "decrypted:\n\n";
22.37 cout << text2 << "\n";
22.38 @@ -69,20 +69,20 @@
22.39 cout << "calling encrypt_message()\n";
22.40 status2 = encrypt_message(session, msg2, NULL, &enc_msg2, PEP_enc_PGP_MIME, 0);
22.41 cout << "encrypt_message() returns " << status2 << '.' << endl;
22.42 - TEST_ASSERT(status2 == PEP_STATUS_OK);
22.43 - TEST_ASSERT(enc_msg2);
22.44 + TEST_ASSERT_MSG((status2 == PEP_STATUS_OK), "status2 == PEP_STATUS_OK");
22.45 + TEST_ASSERT_MSG((enc_msg2), "enc_msg2");
22.46 cout << "message encrypted.\n";
22.47
22.48 status2 = mime_encode_message(enc_msg2, false, &text2);
22.49 - TEST_ASSERT(status2 == PEP_STATUS_OK);
22.50 - TEST_ASSERT(text2);
22.51 + TEST_ASSERT_MSG((status2 == PEP_STATUS_OK), "status2 == PEP_STATUS_OK");
22.52 + TEST_ASSERT_MSG((text2), "text2");
22.53
22.54 cout << "encrypted:\n\n";
22.55 cout << text2 << "\n";
22.56
22.57 message *msg3 = nullptr;
22.58 PEP_STATUS status3 = mime_decode_message(text2, strlen(text2), &msg3);
22.59 - TEST_ASSERT(status3 == PEP_STATUS_OK);
22.60 + TEST_ASSERT_MSG((status3 == PEP_STATUS_OK), "status3 == PEP_STATUS_OK");
22.61 const string string3 = text2;
22.62 //free(text2);
22.63
22.64 @@ -98,12 +98,12 @@
22.65
22.66 flags = 0;
22.67 PEP_STATUS status4 = decrypt_message(session, enc_msg2, &msg4, &keylist4, &rating, &flags);
22.68 - TEST_ASSERT(status4 == PEP_STATUS_OK);
22.69 - TEST_ASSERT(msg4);
22.70 - TEST_ASSERT(keylist4);
22.71 - TEST_ASSERT(rating);
22.72 + TEST_ASSERT_MSG((status4 == PEP_STATUS_OK), "status4 == PEP_STATUS_OK");
22.73 + TEST_ASSERT_MSG((msg4), "msg4");
22.74 + TEST_ASSERT_MSG((keylist4), "keylist4");
22.75 + TEST_ASSERT_MSG((rating), "rating");
22.76 PEP_comm_type ct = enc_msg2->from->comm_type;
22.77 - TEST_ASSERT(ct == PEP_ct_pEp || ct == PEP_ct_pEp_unconfirmed || ct == PEP_ct_OpenPGP || ct == PEP_ct_OpenPGP_unconfirmed );
22.78 + TEST_ASSERT_MSG((ct == PEP_ct_pEp || ct == PEP_ct_pEp_unconfirmed || ct == PEP_ct_OpenPGP || ct == PEP_ct_OpenPGP_unconfirmed ), "ct == PEP_ct_pEp || ct == PEP_ct_pEp_unconfirmed || ct == PEP_ct_OpenPGP || ct == PEP_ct_OpenPGP_unconfirmed ");
22.79
22.80 free_stringpair_list(enc_msg2->opt_fields);
22.81 enc_msg2->opt_fields = NULL;
22.82 @@ -120,7 +120,7 @@
22.83
22.84 cout << "opening msg_no_key.asc for reading\n";
22.85 ifstream inFile3 ("msg_no_key.asc");
22.86 - TEST_ASSERT(inFile3.is_open());
22.87 + TEST_ASSERT_MSG((inFile3.is_open()), "inFile3.is_open()");
22.88
22.89 string text3;
22.90
22.91 @@ -134,7 +134,7 @@
22.92
22.93 message *msg5 = nullptr;
22.94 PEP_STATUS status5 = mime_decode_message(text3.c_str(), text3.length(), &msg5);
22.95 - TEST_ASSERT(status5 == PEP_STATUS_OK);
22.96 + TEST_ASSERT_MSG((status5 == PEP_STATUS_OK), "status5 == PEP_STATUS_OK");
22.97
22.98 message *msg6 = nullptr;
22.99 stringlist_t *keylist5 = nullptr;
22.100 @@ -142,10 +142,10 @@
22.101 PEP_decrypt_flags_t flags2;
22.102 flags2 = 0;
22.103 PEP_STATUS status6 = decrypt_message(session, msg5, &msg6, &keylist5, &rating2, &flags2);
22.104 - TEST_ASSERT(status6 == PEP_DECRYPT_NO_KEY);
22.105 - TEST_ASSERT(msg6 == NULL);
22.106 - TEST_ASSERT(keylist5 == NULL);
22.107 - TEST_ASSERT(rating2 == PEP_rating_have_no_key);
22.108 + TEST_ASSERT_MSG((status6 == PEP_DECRYPT_NO_KEY), "status6 == PEP_DECRYPT_NO_KEY");
22.109 + TEST_ASSERT_MSG((msg6 == NULL), "msg6 == NULL");
22.110 + TEST_ASSERT_MSG((keylist5 == NULL), "keylist5 == NULL");
22.111 + TEST_ASSERT_MSG((rating2 == PEP_rating_have_no_key), "rating2 == PEP_rating_have_no_key");
22.112 cout << "rating :" << rating2 << "\n";
22.113 free_stringlist(keylist5);
22.114
22.115 @@ -153,7 +153,7 @@
22.116
22.117 cout << "opening alice_bob_encrypt_test_plaintext_mime.eml for reading\n";
22.118 ifstream inFile4 ("test_mails/alice_bob_encrypt_test_plaintext_mime.eml");
22.119 - TEST_ASSERT(inFile4.is_open());
22.120 + TEST_ASSERT_MSG((inFile4.is_open()), "inFile4.is_open()");
22.121
22.122 string text4;
22.123
22.124 @@ -173,7 +173,7 @@
22.125
22.126 PEP_STATUS status7 = MIME_encrypt_message(session, text4.c_str(), text4.length(), NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
22.127 // PEP_STATUS status7 = MIME_encrypt_message(session, out_msg_plain, strlen(out_msg_plain), NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
22.128 - TEST_ASSERT(status7 == PEP_STATUS_OK);
22.129 + TEST_ASSERT_MSG((status7 == PEP_STATUS_OK), "status7 == PEP_STATUS_OK");
22.130
22.131 cout << enc_msg << endl;
22.132
22.133 @@ -185,7 +185,7 @@
22.134 dec_flags = 0;
22.135 char* modified_src = NULL;
22.136 PEP_STATUS status8 = MIME_decrypt_message(session, text5.c_str(), text5.length(), &dec_msg, &keys_used, &rating, &dec_flags, &modified_src);
22.137 - TEST_ASSERT(status8 == PEP_STATUS_OK);
22.138 + TEST_ASSERT_MSG((status8 == PEP_STATUS_OK), "status8 == PEP_STATUS_OK");
22.139
22.140 cout << dec_msg << endl;
22.141
22.142 @@ -202,13 +202,13 @@
22.143 message *enc7 = nullptr;
22.144 PEP_STATUS status9 = encrypt_message(session, msg7, NULL, &enc7, PEP_enc_none, 0);
22.145 std::cout << "encrypt_message returned " << std::dec << status9 << std::hex << " (0x" << status9 << ")" << std::dec << endl;
22.146 - TEST_ASSERT(status9 == PEP_UNENCRYPTED);
22.147 - TEST_ASSERT(enc7 == nullptr);
22.148 - TEST_ASSERT(msg7->shortmsg && msg7->longmsg);
22.149 + TEST_ASSERT_MSG((status9 == PEP_UNENCRYPTED), "status9 == PEP_UNENCRYPTED");
22.150 + TEST_ASSERT_MSG((enc7 == nullptr), "enc7 == nullptr");
22.151 + TEST_ASSERT_MSG((msg7->shortmsg && msg7->longmsg), "msg7->shortmsg && msg7->longmsg");
22.152 cout << msg7->shortmsg << "\n";
22.153 cout << msg7->longmsg << "\n";
22.154 - TEST_ASSERT(strcmp(msg7->shortmsg, "My Subject") == 0);
22.155 - TEST_ASSERT(strcmp(msg7->longmsg, "This is some text.\n") == 0);
22.156 + TEST_ASSERT_MSG((strcmp(msg7->shortmsg, "My Subject") == 0), "strcmp(msg7->shortmsg, \"My Subject\") == 0");
22.157 + TEST_ASSERT_MSG((strcmp(msg7->longmsg, "This is some text.\n") == 0), "strcmp(msg7->longmsg, \"This is some text.\n\") == 0");
22.158
22.159 cout << "\nfreeing messages…\n";
22.160 free_message(msg7);
23.1 --- a/test/src/engine_tests/MessageTwoPointOhTests.cc Wed May 09 10:22:22 2018 +0200
23.2 +++ b/test/src/engine_tests/MessageTwoPointOhTests.cc Wed May 09 11:39:10 2018 +0200
23.3 @@ -39,12 +39,12 @@
23.4
23.5 PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
23.6 PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
23.7 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
23.8 - TEST_ASSERT(statuspriv == PEP_STATUS_OK);
23.9 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
23.10 + TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
23.11 statuspub = import_key(session, carol_pub_key.c_str(), carol_pub_key.length(), NULL);
23.12 statuspriv = import_key(session, carol_priv_key.c_str(), carol_priv_key.length(), NULL);
23.13 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
23.14 - TEST_ASSERT(statuspriv == PEP_STATUS_OK);
23.15 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
23.16 + TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
23.17
23.18 cout << "creating message…\n";
23.19 pEp_identity* alice = new_identity("pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", PEP_OWN_USERID, "Alice Test");
23.20 @@ -57,15 +57,15 @@
23.21 status = update_trust_for_fpr(session, carol->fpr, carol_comm_type);
23.22
23.23 PEP_STATUS mystatus = myself(session, alice);
23.24 - TEST_ASSERT(mystatus == PEP_STATUS_OK);
23.25 + TEST_ASSERT_MSG((mystatus == PEP_STATUS_OK), "mystatus == PEP_STATUS_OK");
23.26 alice_status = update_identity(session, alice);
23.27 alice_status = update_identity(session, carol);
23.28 - TEST_ASSERT(alice->comm_type == PEP_ct_pEp);
23.29 - TEST_ASSERT(carol->comm_type == carol_comm_type);
23.30 + TEST_ASSERT_MSG((alice->comm_type == PEP_ct_pEp), "alice->comm_type == PEP_ct_pEp");
23.31 + TEST_ASSERT_MSG((carol->comm_type == carol_comm_type), "carol->comm_type == carol_comm_type");
23.32
23.33 identity_list* to_list = new_identity_list(carol); // to carol
23.34 message* outgoing_message = new_message(PEP_dir_outgoing);
23.35 - TEST_ASSERT(outgoing_message);
23.36 + TEST_ASSERT_MSG((outgoing_message), "outgoing_message");
23.37 outgoing_message->from = alice;
23.38 outgoing_message->to = to_list;
23.39 outgoing_message->shortmsg = strdup("Greetings, humans!");
23.40 @@ -80,8 +80,8 @@
23.41
23.42 char* encoded_text = nullptr;
23.43 status = mime_encode_message(outgoing_message, false, &encoded_text);
23.44 - TEST_ASSERT(status == PEP_STATUS_OK);
23.45 - TEST_ASSERT(encoded_text);
23.46 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
23.47 + TEST_ASSERT_MSG((encoded_text), "encoded_text");
23.48
23.49 cout << "unencrypted:\n\n";
23.50 cout << encoded_text << "\n";
23.51 @@ -94,14 +94,14 @@
23.52 status = encrypt_message(session, outgoing_message, NULL,
23.53 &encrypted_msg, PEP_enc_PGP_MIME, 0);
23.54 cout << "encrypt_message() returns " << std::hex << status << '.' << endl;
23.55 - TEST_ASSERT(status == PEP_STATUS_OK);
23.56 - TEST_ASSERT(encrypted_msg);
23.57 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
23.58 + TEST_ASSERT_MSG((encrypted_msg), "encrypted_msg");
23.59 cout << "message encrypted.\n";
23.60
23.61 encrypted_msg->enc_format = PEP_enc_none;
23.62 status = mime_encode_message(encrypted_msg, false, &encoded_text);
23.63 - TEST_ASSERT(status == PEP_STATUS_OK);
23.64 - TEST_ASSERT(encoded_text);
23.65 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
23.66 + TEST_ASSERT_MSG((encoded_text), "encoded_text");
23.67
23.68 cout << "encrypted:\n\n";
23.69 cout << encoded_text << "\n";
23.70 @@ -121,7 +121,7 @@
23.71
23.72 message* decoded_msg = nullptr;
23.73 status = mime_decode_message(encoded_text, strlen(encoded_text), &decoded_msg);
23.74 - TEST_ASSERT(status == PEP_STATUS_OK);
23.75 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
23.76 const string string3 = encoded_text;
23.77
23.78 unlink("msg_2.0.asc");
23.79 @@ -139,12 +139,12 @@
23.80 stringpair_list_add(encrypted_msg->opt_fields, autoconsume);
23.81 flags = 0;
23.82 status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
23.83 - TEST_ASSERT(decrypted_msg);
23.84 - TEST_ASSERT(keylist_used);
23.85 - TEST_ASSERT(rating);
23.86 - //TEST_ASSERT(status == PEP_STATUS_OK && rating == PEP_rating_reliable);
23.87 + TEST_ASSERT_MSG((decrypted_msg), "decrypted_msg");
23.88 + TEST_ASSERT_MSG((keylist_used), "keylist_used");
23.89 + TEST_ASSERT_MSG((rating), "rating");
23.90 + //TEST_ASSERT_MSG((status == PEP_STATUS_OK && rating == PEP_rating_reliable), "status == PEP_STATUS_OK && rating == PEP_rating_reliable");
23.91 //PEP_comm_type ct = encrypted_msg->from->comm_type;
23.92 - //TEST_ASSERT(ct == PEP_ct_pEp);
23.93 + //TEST_ASSERT_MSG((ct == PEP_ct_pEp), "ct == PEP_ct_pEp");
23.94
23.95 cout << "keys used:\n";
23.96
23.97 @@ -155,8 +155,8 @@
23.98
23.99 decrypted_msg->enc_format = PEP_enc_none;
23.100 status = _mime_encode_message_internal(decrypted_msg, false, &encoded_text, false);
23.101 - TEST_ASSERT(status == PEP_STATUS_OK);
23.102 - TEST_ASSERT(encoded_text);
23.103 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
23.104 + TEST_ASSERT_MSG((encoded_text), "encoded_text");
23.105 cout << "Decrypted message: " << endl;
23.106 cout << encoded_text << endl;
23.107
24.1 --- a/test/src/engine_tests/MimeTests.cc Wed May 09 10:22:22 2018 +0200
24.2 +++ b/test/src/engine_tests/MimeTests.cc Wed May 09 11:39:10 2018 +0200
24.3 @@ -75,8 +75,8 @@
24.4
24.5 cout << "calling init()\n";
24.6 PEP_STATUS status1 = init(&session);
24.7 - TEST_ASSERT(status1 == PEP_STATUS_OK);
24.8 - TEST_ASSERT(session);
24.9 + TEST_ASSERT_MSG((status1 == PEP_STATUS_OK), "status1 == PEP_STATUS_OK");
24.10 + TEST_ASSERT_MSG((session), "session");
24.11 cout << "init() completed.\n";
24.12
24.13 // mime test code
24.14 @@ -84,7 +84,7 @@
24.15 // testing multipart/alternative
24.16
24.17 message *msg2 = new_message(PEP_dir_incoming);
24.18 - TEST_ASSERT(msg2);
24.19 + TEST_ASSERT_MSG((msg2), "msg2");
24.20 msg2->from = new_identity("vb@dingens.org", NULL, NULL, "Volker Birk");
24.21 msg2->to = new_identity_list(new_identity("trischa@dingens.org", NULL, NULL, "Patricia Bädnar")),
24.22 msg2->shortmsg = strdup("my sübject");
24.23 @@ -93,13 +93,13 @@
24.24 msg2->longmsg = strdup(text2.c_str());
24.25 string html2 = "<html><body><p>my message to you</p></body></html>";
24.26 msg2->longmsg_formatted = strdup(html2.c_str());
24.27 - TEST_ASSERT(msg2->longmsg_formatted);
24.28 + TEST_ASSERT_MSG((msg2->longmsg_formatted), "msg2->longmsg_formatted");
24.29
24.30 cout << "encoding message…\n";
24.31 char *result2;
24.32 PEP_STATUS status2 = mime_encode_message(msg2, false, &result2);
24.33 - TEST_ASSERT(result2);
24.34 - TEST_ASSERT(status2 == PEP_STATUS_OK);
24.35 + TEST_ASSERT_MSG((result2), "result2");
24.36 + TEST_ASSERT_MSG((status2 == PEP_STATUS_OK), "status2 == PEP_STATUS_OK");
24.37
24.38 cout << "result:\n";
24.39 cout << result2 << "\n";
25.1 --- a/test/src/engine_tests/MistrustUndoTests.cc Wed May 09 10:22:22 2018 +0200
25.2 +++ b/test/src/engine_tests/MistrustUndoTests.cc Wed May 09 11:39:10 2018 +0200
25.3 @@ -32,17 +32,17 @@
25.4 cout << "importing key 0x39E5DAB5." << endl;
25.5 const string pub_key = slurp("test_keys/pub/mistrust.undo.test-0x39E5DAB5_pub.asc");
25.6
25.7 - TEST_ASSERT(pub_key.length() != 0);
25.8 + TEST_ASSERT_MSG((pub_key.length() != 0), "pub_key.length() != 0");
25.9
25.10 PEP_STATUS statuspub = import_key(session, pub_key.c_str(), pub_key.length(), NULL);
25.11 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
25.12 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
25.13 cout << "Key imported." << endl << endl;
25.14
25.15 cout << "Setting up identity for mistrust.undo.test@pep-project.org and making comm_type PEP_ct_pEp." << endl;
25.16 pEp_identity* recip1 = new_identity("mistrust.undo.test@pep-project.org", NULL, "TOFU_mistrust.undo.test@pep-project.org", "Mistrust Undo");
25.17 status = update_identity(session,recip1);
25.18 - TEST_ASSERT(status == PEP_STATUS_OK);
25.19 - TEST_ASSERT(strcmp(recip1->fpr, "BACC7A60A88A39A25D99B4A545D7542F39E5DAB5") == 0);
25.20 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
25.21 + TEST_ASSERT_MSG((strcmp(recip1->fpr, "BACC7A60A88A39A25D99B4A545D7542F39E5DAB5") == 0), "strcmp(recip1->fpr, \"BACC7A60A88A39A25D99B4A545D7542F39E5DAB5\") == 0");
25.22
25.23 // First, we need the fpr to be in the DB system.
25.24 status = set_identity(session,recip1);
25.25 @@ -51,31 +51,31 @@
25.26 status = update_trust_for_fpr(session, recip1->fpr, PEP_ct_pEp);
25.27 // Then we retrieve the new trust.
25.28 status = update_identity(session,recip1);
25.29 - TEST_ASSERT(status == PEP_STATUS_OK);
25.30 - TEST_ASSERT(recip1->comm_type == PEP_ct_pEp);
25.31 - TEST_ASSERT(strcmp(recip1->fpr, "BACC7A60A88A39A25D99B4A545D7542F39E5DAB5") == 0);
25.32 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
25.33 + TEST_ASSERT_MSG((recip1->comm_type == PEP_ct_pEp), "recip1->comm_type == PEP_ct_pEp");
25.34 + TEST_ASSERT_MSG((strcmp(recip1->fpr, "BACC7A60A88A39A25D99B4A545D7542F39E5DAB5") == 0), "strcmp(recip1->fpr, \"BACC7A60A88A39A25D99B4A545D7542F39E5DAB5\") == 0");
25.35 cout << "mistrust.undo.test@pep-project.org set up and comm_type is PEP_ct_pEp." << endl << endl;
25.36
25.37 // Ok, mistrust away
25.38 cout << "Mistrusting mistrust.undo.test@pep-project.org (BACC7A60A88A39A25D99B4A545D7542F39E5DAB5)." << endl;
25.39 status = key_mistrusted(session, recip1);
25.40 - TEST_ASSERT(status == PEP_STATUS_OK);
25.41 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
25.42 status = update_identity(session,recip1);
25.43 - TEST_ASSERT(status == PEP_STATUS_OK);
25.44 - TEST_ASSERT(recip1->comm_type == PEP_ct_key_not_found);
25.45 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
25.46 + TEST_ASSERT_MSG((recip1->comm_type == PEP_ct_key_not_found), "recip1->comm_type == PEP_ct_key_not_found");
25.47 recip1->fpr = strdup("BACC7A60A88A39A25D99B4A545D7542F39E5DAB5");
25.48 status = get_trust(session, recip1);
25.49 - TEST_ASSERT(recip1->comm_type == PEP_ct_mistrusted);
25.50 + TEST_ASSERT_MSG((recip1->comm_type == PEP_ct_mistrusted), "recip1->comm_type == PEP_ct_mistrusted");
25.51
25.52 cout << "Mistrusted mistrust.undo.test@pep-project.org (BACC7A60A88A39A25D99B4A545D7542F39E5DAB5) and comm_type IN DB set to PEP_ct_mistrusted)." << endl << endl;
25.53
25.54 cout << "Undo mistrust (restore identity and trust in DB)" << endl;
25.55 // Undo it
25.56 status = undo_last_mistrust(session);
25.57 - TEST_ASSERT(status == PEP_STATUS_OK);
25.58 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
25.59 status = update_identity(session, recip1);
25.60 - TEST_ASSERT(recip1->comm_type == PEP_ct_pEp);
25.61 - TEST_ASSERT(strcmp(recip1->fpr, "BACC7A60A88A39A25D99B4A545D7542F39E5DAB5") == 0);
25.62 + TEST_ASSERT_MSG((recip1->comm_type == PEP_ct_pEp), "recip1->comm_type == PEP_ct_pEp");
25.63 + TEST_ASSERT_MSG((strcmp(recip1->fpr, "BACC7A60A88A39A25D99B4A545D7542F39E5DAB5") == 0), "strcmp(recip1->fpr, \"BACC7A60A88A39A25D99B4A545D7542F39E5DAB5\") == 0");
25.64 cout << "Undo mistrust (restore identity and trust in DB) - trust is now PEP_ct_pEp." << endl << endl;
25.65
25.66 cout << "Success!!!" << endl << endl;
26.1 --- a/test/src/engine_tests/NewUpdateIdAndMyselfTests.cc Wed May 09 10:22:22 2018 +0200
26.2 +++ b/test/src/engine_tests/NewUpdateIdAndMyselfTests.cc Wed May 09 11:39:10 2018 +0200
26.3 @@ -50,15 +50,15 @@
26.4 cout << "* I: 1. myself() on id with no record in the DB and no input fpr" << endl;
26.5 cout << "***********************************************************************" << endl << endl;
26.6 status = myself(session, new_me);
26.7 - TEST_ASSERT(status == PEP_STATUS_OK);
26.8 - TEST_ASSERT(new_me->fpr);
26.9 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.10 + TEST_ASSERT_MSG((new_me->fpr), "new_me->fpr");
26.11
26.12 cout << "PASS: myself() generated fingerprint ";
26.13 cout << new_me->fpr << endl << endl;
26.14
26.15 char* generated_fpr = strdup(new_me->fpr);
26.16
26.17 - TEST_ASSERT(new_me->comm_type == PEP_ct_pEp);
26.18 + TEST_ASSERT_MSG((new_me->comm_type == PEP_ct_pEp), "new_me->comm_type == PEP_ct_pEp");
26.19
26.20 free_identity(new_me);
26.21
26.22 @@ -68,14 +68,14 @@
26.23
26.24 new_me = new_identity(uniqname, NULL, own_user_id, NULL);
26.25 status = myself(session, new_me);
26.26 - TEST_ASSERT(status == PEP_STATUS_OK);
26.27 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.28
26.29 - TEST_ASSERT(new_me->fpr);
26.30 - TEST_ASSERT(strcmp(new_me->fpr, generated_fpr) == 0);
26.31 - TEST_ASSERT(new_me->username);
26.32 - TEST_ASSERT(strcmp(new_me->username, start_username) == 0);
26.33 - TEST_ASSERT(new_me->user_id);
26.34 - TEST_ASSERT(new_me->comm_type == PEP_ct_pEp);
26.35 + TEST_ASSERT_MSG((new_me->fpr), "new_me->fpr");
26.36 + TEST_ASSERT_MSG((strcmp(new_me->fpr, generated_fpr) == 0), "strcmp(new_me->fpr, generated_fpr) == 0");
26.37 + TEST_ASSERT_MSG((new_me->username), "new_me->username");
26.38 + TEST_ASSERT_MSG((strcmp(new_me->username, start_username) == 0), "strcmp(new_me->username, start_username) == 0");
26.39 + TEST_ASSERT_MSG((new_me->user_id), "new_me->user_id");
26.40 + TEST_ASSERT_MSG((new_me->comm_type == PEP_ct_pEp), "new_me->comm_type == PEP_ct_pEp");
26.41
26.42 char* default_own_id = NULL;
26.43 status = get_userid_alias_default(session, own_user_id, &default_own_id);
26.44 @@ -84,7 +84,7 @@
26.45 default_own_id = strdup(own_user_id);
26.46 }
26.47
26.48 - TEST_ASSERT(strcmp(new_me->user_id, default_own_id) == 0);
26.49 + TEST_ASSERT_MSG((strcmp(new_me->user_id, default_own_id) == 0), "strcmp(new_me->user_id, default_own_id) == 0");
26.50
26.51 cout << "PASS: myself() retrieved the correct fpr, username and default user id" << endl << endl;
26.52
26.53 @@ -98,21 +98,21 @@
26.54
26.55 new_me = new_identity(uniqname, NULL, alias_id, NULL);
26.56 status = myself(session, new_me);
26.57 - TEST_ASSERT(status == PEP_STATUS_OK);
26.58 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.59
26.60 - TEST_ASSERT(new_me->fpr);
26.61 - TEST_ASSERT(strcmp(new_me->fpr, generated_fpr) == 0);
26.62 - TEST_ASSERT(new_me->username);
26.63 - TEST_ASSERT(strcmp(new_me->username, start_username) == 0);
26.64 - TEST_ASSERT(new_me->user_id);
26.65 - TEST_ASSERT(strcmp(new_me->user_id, default_own_id) == 0);
26.66 - TEST_ASSERT(new_me->comm_type == PEP_ct_pEp);
26.67 + TEST_ASSERT_MSG((new_me->fpr), "new_me->fpr");
26.68 + TEST_ASSERT_MSG((strcmp(new_me->fpr, generated_fpr) == 0), "strcmp(new_me->fpr, generated_fpr) == 0");
26.69 + TEST_ASSERT_MSG((new_me->username), "new_me->username");
26.70 + TEST_ASSERT_MSG((strcmp(new_me->username, start_username) == 0), "strcmp(new_me->username, start_username) == 0");
26.71 + TEST_ASSERT_MSG((new_me->user_id), "new_me->user_id");
26.72 + TEST_ASSERT_MSG((strcmp(new_me->user_id, default_own_id) == 0), "strcmp(new_me->user_id, default_own_id) == 0");
26.73 + TEST_ASSERT_MSG((new_me->comm_type == PEP_ct_pEp), "new_me->comm_type == PEP_ct_pEp");
26.74
26.75 char* tmp_def = NULL;
26.76
26.77 status = get_userid_alias_default(session, alias_id, &tmp_def);
26.78 - TEST_ASSERT(status == PEP_STATUS_OK);
26.79 - TEST_ASSERT(strcmp(tmp_def, default_own_id) == 0);
26.80 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.81 + TEST_ASSERT_MSG((strcmp(tmp_def, default_own_id) == 0), "strcmp(tmp_def, default_own_id) == 0");
26.82
26.83 cout << "PASS: myself() retrieved the correct fpr, username and default user id, and put the right alias in for the default";
26.84 cout << endl << endl;
26.85 @@ -126,7 +126,7 @@
26.86
26.87 new_me = new_identity(uniqname, NULL, alias_id, start_username);
26.88 status = generate_keypair(session, new_me);
26.89 - TEST_ASSERT(new_me->fpr);
26.90 + TEST_ASSERT_MSG((new_me->fpr), "new_me->fpr");
26.91
26.92 cout << "Generated fingerprint ";
26.93 cout << new_me->fpr << "\n";
26.94 @@ -134,16 +134,16 @@
26.95 char* new_fpr = strdup(new_me->fpr);
26.96
26.97 status = set_own_key(session, new_me, new_fpr);
26.98 - TEST_ASSERT(status == PEP_STATUS_OK);
26.99 - TEST_ASSERT(new_me->fpr);
26.100 - TEST_ASSERT(strcmp(new_me->fpr, generated_fpr) != 0);
26.101 - TEST_ASSERT(strcmp(new_me->fpr, new_fpr) == 0);
26.102 - TEST_ASSERT(new_me->username);
26.103 - TEST_ASSERT(strcmp(new_me->username, start_username) == 0);
26.104 - TEST_ASSERT(new_me->user_id);
26.105 - TEST_ASSERT(strcmp(new_me->user_id, default_own_id) == 0);
26.106 - TEST_ASSERT(new_me->me);
26.107 - TEST_ASSERT(new_me->comm_type == PEP_ct_pEp);
26.108 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.109 + TEST_ASSERT_MSG((new_me->fpr), "new_me->fpr");
26.110 + TEST_ASSERT_MSG((strcmp(new_me->fpr, generated_fpr) != 0), "strcmp(new_me->fpr, generated_fpr) != 0");
26.111 + TEST_ASSERT_MSG((strcmp(new_me->fpr, new_fpr) == 0), "strcmp(new_me->fpr, new_fpr) == 0");
26.112 + TEST_ASSERT_MSG((new_me->username), "new_me->username");
26.113 + TEST_ASSERT_MSG((strcmp(new_me->username, start_username) == 0), "strcmp(new_me->username, start_username) == 0");
26.114 + TEST_ASSERT_MSG((new_me->user_id), "new_me->user_id");
26.115 + TEST_ASSERT_MSG((strcmp(new_me->user_id, default_own_id) == 0), "strcmp(new_me->user_id, default_own_id) == 0");
26.116 + TEST_ASSERT_MSG((new_me->me), "new_me->me");
26.117 + TEST_ASSERT_MSG((new_me->comm_type == PEP_ct_pEp), "new_me->comm_type == PEP_ct_pEp");
26.118
26.119 cout << "PASS: myself() set and retrieved the new fpr, username and default user id, and put the right alias in for the default";
26.120 cout << endl << endl;
26.121 @@ -153,9 +153,9 @@
26.122 new_me->fpr = strdup(generated_fpr);
26.123 new_me->comm_type = PEP_ct_unknown;
26.124 status = set_own_key(session, new_me, generated_fpr);
26.125 - TEST_ASSERT(status == PEP_STATUS_OK);
26.126 - TEST_ASSERT(strcmp(new_me->fpr, generated_fpr) == 0);
26.127 - TEST_ASSERT(new_me->comm_type == PEP_ct_pEp);
26.128 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.129 + TEST_ASSERT_MSG((strcmp(new_me->fpr, generated_fpr) == 0), "strcmp(new_me->fpr, generated_fpr) == 0");
26.130 + TEST_ASSERT_MSG((new_me->comm_type == PEP_ct_pEp), "new_me->comm_type == PEP_ct_pEp");
26.131
26.132 cout << "****************************************************************************************" << endl;
26.133 cout << "* I: 5. myself(), replace fpr, revoke key" << endl;
26.134 @@ -167,15 +167,15 @@
26.135 new_me = new_identity(uniqname, NULL, alias_id, start_username);
26.136
26.137 status = set_own_key(session, new_me, new_fpr);
26.138 - TEST_ASSERT(status == PEP_STATUS_OK);
26.139 - TEST_ASSERT(new_me->fpr);
26.140 - TEST_ASSERT(strcmp(new_me->fpr, generated_fpr) != 0);
26.141 - TEST_ASSERT(new_me->username);
26.142 - TEST_ASSERT(strcmp(new_me->username, start_username) == 0);
26.143 - TEST_ASSERT(new_me->user_id);
26.144 - TEST_ASSERT(strcmp(new_me->user_id, default_own_id) == 0);
26.145 - TEST_ASSERT(new_me->me);
26.146 - TEST_ASSERT(new_me->comm_type == PEP_ct_pEp);
26.147 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.148 + TEST_ASSERT_MSG((new_me->fpr), "new_me->fpr");
26.149 + TEST_ASSERT_MSG((strcmp(new_me->fpr, generated_fpr) != 0), "strcmp(new_me->fpr, generated_fpr) != 0");
26.150 + TEST_ASSERT_MSG((new_me->username), "new_me->username");
26.151 + TEST_ASSERT_MSG((strcmp(new_me->username, start_username) == 0), "strcmp(new_me->username, start_username) == 0");
26.152 + TEST_ASSERT_MSG((new_me->user_id), "new_me->user_id");
26.153 + TEST_ASSERT_MSG((strcmp(new_me->user_id, default_own_id) == 0), "strcmp(new_me->user_id, default_own_id) == 0");
26.154 + TEST_ASSERT_MSG((new_me->me), "new_me->me");
26.155 + TEST_ASSERT_MSG((new_me->comm_type == PEP_ct_pEp), "new_me->comm_type == PEP_ct_pEp");
26.156
26.157 cout << "PASS: myself() retrieved the new fpr, username and default user id, and put the right alias in for the default";
26.158 cout << endl << endl;
26.159 @@ -195,27 +195,27 @@
26.160 const string alex_pub_key = slurp("test_keys/pub/pep.test.alexander-0x26B54E4E_pub.asc");
26.161
26.162 PEP_STATUS statuspub = import_key(session, alex_pub_key.c_str(), alex_pub_key.length(), NULL);
26.163 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
26.164 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
26.165
26.166 pEp_identity* alex = new_identity(alex_address, alex_fpr, alex_userid, alex_username);
26.167
26.168 // 2. set identity
26.169 status = set_identity(session, alex);
26.170 - TEST_ASSERT(status == PEP_STATUS_OK);
26.171 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.172 free_identity(alex);
26.173
26.174 alex = new_identity(alex_address, NULL, alex_userid, alex_username);
26.175 status = update_identity(session, alex);
26.176 - TEST_ASSERT(status == PEP_STATUS_OK);
26.177 - TEST_ASSERT(alex->fpr);
26.178 - TEST_ASSERT(strcmp(alex->fpr, alex_fpr) == 0);
26.179 - TEST_ASSERT(alex->username);
26.180 - TEST_ASSERT(strcmp(alex->username, alex_username) == 0);
26.181 - TEST_ASSERT(alex->user_id);
26.182 - TEST_ASSERT(strcmp(alex->user_id, alex_userid) == 0);
26.183 - TEST_ASSERT(!alex->me);
26.184 - TEST_ASSERT(alex->comm_type == PEP_ct_OpenPGP_unconfirmed);
26.185 - TEST_ASSERT(strcmp(alex->address, alex_address) == 0);
26.186 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.187 + TEST_ASSERT_MSG((alex->fpr), "alex->fpr");
26.188 + TEST_ASSERT_MSG((strcmp(alex->fpr, alex_fpr) == 0), "strcmp(alex->fpr, alex_fpr) == 0");
26.189 + TEST_ASSERT_MSG((alex->username), "alex->username");
26.190 + TEST_ASSERT_MSG((strcmp(alex->username, alex_username) == 0), "strcmp(alex->username, alex_username) == 0");
26.191 + TEST_ASSERT_MSG((alex->user_id), "alex->user_id");
26.192 + TEST_ASSERT_MSG((strcmp(alex->user_id, alex_userid) == 0), "strcmp(alex->user_id, alex_userid) == 0");
26.193 + TEST_ASSERT_MSG((!alex->me), "!alex->me");
26.194 + TEST_ASSERT_MSG((alex->comm_type == PEP_ct_OpenPGP_unconfirmed), "alex->comm_type == PEP_ct_OpenPGP_unconfirmed");
26.195 + TEST_ASSERT_MSG((strcmp(alex->address, alex_address) == 0), "strcmp(alex->address, alex_address) == 0");
26.196
26.197 cout << "PASS: update_identity() correctly retrieved extant record with matching address, id, and username" << endl << endl;
26.198 free_identity(alex);
26.199 @@ -229,16 +229,16 @@
26.200 alex = new_identity(alex_address, NULL, alex_userid, new_username);
26.201 cout << "Timing is everything" << endl;
26.202 status = update_identity(session, alex);
26.203 - TEST_ASSERT(status == PEP_STATUS_OK);
26.204 - TEST_ASSERT(alex->fpr);
26.205 - TEST_ASSERT(strcmp(alex->fpr, alex_fpr) == 0);
26.206 - TEST_ASSERT(alex->username);
26.207 - TEST_ASSERT(strcmp(alex->username, new_username) == 0);
26.208 - TEST_ASSERT(alex->user_id);
26.209 - TEST_ASSERT(strcmp(alex->user_id, alex_userid) == 0);
26.210 - TEST_ASSERT(!alex->me);
26.211 - TEST_ASSERT(alex->comm_type == PEP_ct_OpenPGP_unconfirmed);
26.212 - TEST_ASSERT(strcmp(alex->address, alex_address) == 0);
26.213 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.214 + TEST_ASSERT_MSG((alex->fpr), "alex->fpr");
26.215 + TEST_ASSERT_MSG((strcmp(alex->fpr, alex_fpr) == 0), "strcmp(alex->fpr, alex_fpr) == 0");
26.216 + TEST_ASSERT_MSG((alex->username), "alex->username");
26.217 + TEST_ASSERT_MSG((strcmp(alex->username, new_username) == 0), "strcmp(alex->username, new_username) == 0");
26.218 + TEST_ASSERT_MSG((alex->user_id), "alex->user_id");
26.219 + TEST_ASSERT_MSG((strcmp(alex->user_id, alex_userid) == 0), "strcmp(alex->user_id, alex_userid) == 0");
26.220 + TEST_ASSERT_MSG((!alex->me), "!alex->me");
26.221 + TEST_ASSERT_MSG((alex->comm_type == PEP_ct_OpenPGP_unconfirmed), "alex->comm_type == PEP_ct_OpenPGP_unconfirmed");
26.222 + TEST_ASSERT_MSG((strcmp(alex->address, alex_address) == 0), "strcmp(alex->address, alex_address) == 0");
26.223
26.224 cout << "PASS: update_identity() correctly retrieved extant record with matching address and id, and patched username" << endl << endl;
26.225 free_identity(alex);
26.226 @@ -249,16 +249,16 @@
26.227
26.228 alex = new_identity(alex_address, NULL, alex_userid, NULL);
26.229 status = update_identity(session, alex);
26.230 - TEST_ASSERT(status == PEP_STATUS_OK);
26.231 - TEST_ASSERT(alex->fpr);
26.232 - TEST_ASSERT(strcmp(alex->fpr, alex_fpr) == 0);
26.233 - TEST_ASSERT(alex->username);
26.234 - TEST_ASSERT(strcmp(alex->username, new_username) == 0);
26.235 - TEST_ASSERT(alex->user_id);
26.236 - TEST_ASSERT(strcmp(alex->user_id, alex_userid) == 0);
26.237 - TEST_ASSERT(!alex->me);
26.238 - TEST_ASSERT(alex->comm_type == PEP_ct_OpenPGP_unconfirmed);
26.239 - TEST_ASSERT(strcmp(alex->address, alex_address) == 0);
26.240 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.241 + TEST_ASSERT_MSG((alex->fpr), "alex->fpr");
26.242 + TEST_ASSERT_MSG((strcmp(alex->fpr, alex_fpr) == 0), "strcmp(alex->fpr, alex_fpr) == 0");
26.243 + TEST_ASSERT_MSG((alex->username), "alex->username");
26.244 + TEST_ASSERT_MSG((strcmp(alex->username, new_username) == 0), "strcmp(alex->username, new_username) == 0");
26.245 + TEST_ASSERT_MSG((alex->user_id), "alex->user_id");
26.246 + TEST_ASSERT_MSG((strcmp(alex->user_id, alex_userid) == 0), "strcmp(alex->user_id, alex_userid) == 0");
26.247 + TEST_ASSERT_MSG((!alex->me), "!alex->me");
26.248 + TEST_ASSERT_MSG((alex->comm_type == PEP_ct_OpenPGP_unconfirmed), "alex->comm_type == PEP_ct_OpenPGP_unconfirmed");
26.249 + TEST_ASSERT_MSG((strcmp(alex->address, alex_address) == 0), "strcmp(alex->address, alex_address) == 0");
26.250
26.251 cout << "PASS: update_identity() correctly retrieved extant record with matching address and id, and patched username" << endl << endl;
26.252 free_identity(alex);
26.253 @@ -269,16 +269,16 @@
26.254
26.255 alex = new_identity(alex_address, NULL, NULL, new_username);
26.256 status = update_identity(session, alex);
26.257 - TEST_ASSERT(status == PEP_STATUS_OK);
26.258 - TEST_ASSERT(alex->fpr);
26.259 - TEST_ASSERT(strcmp(alex->fpr, alex_fpr) == 0);
26.260 - TEST_ASSERT(alex->username);
26.261 - TEST_ASSERT(strcmp(alex->username, new_username) == 0);
26.262 - TEST_ASSERT(alex->user_id);
26.263 - TEST_ASSERT(strcmp(alex->user_id, alex_userid) == 0);
26.264 - TEST_ASSERT(!alex->me);
26.265 - TEST_ASSERT(alex->comm_type == PEP_ct_OpenPGP_unconfirmed);
26.266 - TEST_ASSERT(strcmp(alex->address, alex_address) == 0);
26.267 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.268 + TEST_ASSERT_MSG((alex->fpr), "alex->fpr");
26.269 + TEST_ASSERT_MSG((strcmp(alex->fpr, alex_fpr) == 0), "strcmp(alex->fpr, alex_fpr) == 0");
26.270 + TEST_ASSERT_MSG((alex->username), "alex->username");
26.271 + TEST_ASSERT_MSG((strcmp(alex->username, new_username) == 0), "strcmp(alex->username, new_username) == 0");
26.272 + TEST_ASSERT_MSG((alex->user_id), "alex->user_id");
26.273 + TEST_ASSERT_MSG((strcmp(alex->user_id, alex_userid) == 0), "strcmp(alex->user_id, alex_userid) == 0");
26.274 + TEST_ASSERT_MSG((!alex->me), "!alex->me");
26.275 + TEST_ASSERT_MSG((alex->comm_type == PEP_ct_OpenPGP_unconfirmed), "alex->comm_type == PEP_ct_OpenPGP_unconfirmed");
26.276 + TEST_ASSERT_MSG((strcmp(alex->address, alex_address) == 0), "strcmp(alex->address, alex_address) == 0");
26.277
26.278 cout << "PASS: update_identity() correctly retrieved extant record with matching address and username" << endl << endl;
26.279 free_identity(alex);
26.280 @@ -289,16 +289,16 @@
26.281
26.282 alex = new_identity(alex_address, NULL, NULL, NULL);
26.283 status = update_identity(session, alex);
26.284 - TEST_ASSERT(status == PEP_STATUS_OK);
26.285 - TEST_ASSERT(alex->fpr);
26.286 - TEST_ASSERT(strcmp(alex->fpr, alex_fpr) == 0);
26.287 - TEST_ASSERT(alex->username);
26.288 - TEST_ASSERT(strcmp(alex->username, new_username) == 0);
26.289 - TEST_ASSERT(alex->user_id);
26.290 - TEST_ASSERT(strcmp(alex->user_id, alex_userid) == 0);
26.291 - TEST_ASSERT(!alex->me);
26.292 - TEST_ASSERT(alex->comm_type == PEP_ct_OpenPGP_unconfirmed);
26.293 - TEST_ASSERT(strcmp(alex->address, alex_address) == 0);
26.294 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.295 + TEST_ASSERT_MSG((alex->fpr), "alex->fpr");
26.296 + TEST_ASSERT_MSG((strcmp(alex->fpr, alex_fpr) == 0), "strcmp(alex->fpr, alex_fpr) == 0");
26.297 + TEST_ASSERT_MSG((alex->username), "alex->username");
26.298 + TEST_ASSERT_MSG((strcmp(alex->username, new_username) == 0), "strcmp(alex->username, new_username) == 0");
26.299 + TEST_ASSERT_MSG((alex->user_id), "alex->user_id");
26.300 + TEST_ASSERT_MSG((strcmp(alex->user_id, alex_userid) == 0), "strcmp(alex->user_id, alex_userid) == 0");
26.301 + TEST_ASSERT_MSG((!alex->me), "!alex->me");
26.302 + TEST_ASSERT_MSG((alex->comm_type == PEP_ct_OpenPGP_unconfirmed), "alex->comm_type == PEP_ct_OpenPGP_unconfirmed");
26.303 + TEST_ASSERT_MSG((strcmp(alex->address, alex_address) == 0), "strcmp(alex->address, alex_address) == 0");
26.304
26.305 cout << "PASS: update_identity() correctly retrieved extant record with just matching address. Retrieved previously patched username." << endl << endl;
26.306 free_identity(alex);
26.307 @@ -310,17 +310,17 @@
26.308
26.309 pEp_identity* somebody = new_identity(uniqname, NULL, NULL, NULL);
26.310 status = update_identity(session, somebody);
26.311 - TEST_ASSERT(status == PEP_STATUS_OK);
26.312 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.313 myself(session, somebody);
26.314 - TEST_ASSERT(somebody->fpr);
26.315 - TEST_ASSERT(strcmp(somebody->fpr, new_fpr) == 0);
26.316 - TEST_ASSERT(somebody->username);
26.317 - TEST_ASSERT(strcmp(somebody->username, start_username) == 0);
26.318 - TEST_ASSERT(somebody->user_id);
26.319 - TEST_ASSERT(strcmp(somebody->user_id, default_own_id) == 0);
26.320 - TEST_ASSERT(somebody->me); // true in this case, as it was an own identity
26.321 - TEST_ASSERT(somebody->comm_type == PEP_ct_pEp);
26.322 - TEST_ASSERT(strcmp(somebody->address, uniqname) == 0);
26.323 + TEST_ASSERT_MSG((somebody->fpr), "somebody->fpr");
26.324 + TEST_ASSERT_MSG((strcmp(somebody->fpr, new_fpr) == 0), "strcmp(somebody->fpr, new_fpr) == 0");
26.325 + TEST_ASSERT_MSG((somebody->username), "somebody->username");
26.326 + TEST_ASSERT_MSG((strcmp(somebody->username, start_username) == 0), "strcmp(somebody->username, start_username) == 0");
26.327 + TEST_ASSERT_MSG((somebody->user_id), "somebody->user_id");
26.328 + TEST_ASSERT_MSG((strcmp(somebody->user_id, default_own_id) == 0), "strcmp(somebody->user_id, default_own_id) == 0");
26.329 + TEST_ASSERT_MSG((somebody->me), "somebody->me"); // true in this case, as it was an own identity
26.330 + TEST_ASSERT_MSG((somebody->comm_type == PEP_ct_pEp), "somebody->comm_type == PEP_ct_pEp");
26.331 + TEST_ASSERT_MSG((strcmp(somebody->address, uniqname) == 0), "strcmp(somebody->address, uniqname) == 0");
26.332
26.333 cout << "PASS: update_identity() retrieved the right identity information given just an address";
26.334 cout << endl << endl;
26.335 @@ -333,9 +333,9 @@
26.336
26.337 somebody = new_identity("nope@nope.nope", NULL, "some_user_id", NULL);
26.338 status = update_identity(session, somebody);
26.339 - TEST_ASSERT(status == PEP_STATUS_OK);
26.340 - TEST_ASSERT(!somebody->fpr);
26.341 - TEST_ASSERT(somebody->comm_type == PEP_ct_key_not_found);
26.342 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.343 + TEST_ASSERT_MSG((!somebody->fpr), "!somebody->fpr");
26.344 + TEST_ASSERT_MSG((somebody->comm_type == PEP_ct_key_not_found), "somebody->comm_type == PEP_ct_key_not_found");
26.345
26.346 cout << "PASS: update_identity() returns identity with no key and unknown comm type" << endl << endl;
26.347
26.348 @@ -353,29 +353,29 @@
26.349 const string bella_pub_key = slurp("test_keys/pub/pep.test.bella-0xAF516AAE_pub.asc");
26.350
26.351 statuspub = import_key(session, bella_pub_key.c_str(), bella_pub_key.length(), NULL);
26.352 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
26.353 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
26.354
26.355 pEp_identity* bella = new_identity(bella_address, bella_fpr, bella_userid, bella_username);
26.356
26.357 // 2. set identity
26.358 status = set_identity(session, bella);
26.359 - TEST_ASSERT(status == PEP_STATUS_OK);
26.360 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.361 free_identity(bella);
26.362
26.363 const char* not_my_userid = "Bad Company";
26.364
26.365 bella = new_identity(bella_address, NULL, not_my_userid, bella_username);
26.366 status = update_identity(session, bella);
26.367 - TEST_ASSERT(status == PEP_STATUS_OK);
26.368 - TEST_ASSERT(bella->fpr);
26.369 - TEST_ASSERT(strcmp(bella->fpr, bella_fpr) == 0);
26.370 - TEST_ASSERT(bella->username);
26.371 - TEST_ASSERT(strcmp(bella->username, bella_username) == 0);
26.372 - TEST_ASSERT(bella->user_id);
26.373 - TEST_ASSERT(strcmp(bella->user_id, not_my_userid) == 0); // ???
26.374 - TEST_ASSERT(!bella->me);
26.375 - TEST_ASSERT(bella->comm_type == PEP_ct_OpenPGP_unconfirmed);
26.376 - TEST_ASSERT(strcmp(bella->address, bella_address) == 0);
26.377 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.378 + TEST_ASSERT_MSG((bella->fpr), "bella->fpr");
26.379 + TEST_ASSERT_MSG((strcmp(bella->fpr, bella_fpr) == 0), "strcmp(bella->fpr, bella_fpr) == 0");
26.380 + TEST_ASSERT_MSG((bella->username), "bella->username");
26.381 + TEST_ASSERT_MSG((strcmp(bella->username, bella_username) == 0), "strcmp(bella->username, bella_username) == 0");
26.382 + TEST_ASSERT_MSG((bella->user_id), "bella->user_id");
26.383 + TEST_ASSERT_MSG((strcmp(bella->user_id, not_my_userid) == 0), "strcmp(bella->user_id, not_my_userid) == 0"); // ???
26.384 + TEST_ASSERT_MSG((!bella->me), "!bella->me");
26.385 + TEST_ASSERT_MSG((bella->comm_type == PEP_ct_OpenPGP_unconfirmed), "bella->comm_type == PEP_ct_OpenPGP_unconfirmed");
26.386 + TEST_ASSERT_MSG((strcmp(bella->address, bella_address) == 0), "strcmp(bella->address, bella_address) == 0");
26.387
26.388 cout << "PASS: update_identity() correctly retrieved extant record with matching address and username; temp user_id in DB patched" << endl << endl;
26.389 free_identity(bella);
26.390 @@ -390,15 +390,15 @@
26.391 somebody = new_identity(rando_address, NULL, rando_userid, rando_name);
26.392 status = update_identity(session, somebody);
26.393
26.394 - TEST_ASSERT(status == PEP_STATUS_OK);
26.395 - TEST_ASSERT(!somebody->fpr || somebody->fpr[0] == '\0');
26.396 - TEST_ASSERT(somebody->username);
26.397 - TEST_ASSERT(strcmp(somebody->username, rando_name) == 0);
26.398 - TEST_ASSERT(somebody->user_id);
26.399 - TEST_ASSERT(strcmp(somebody->user_id, rando_userid) == 0); // ???
26.400 - TEST_ASSERT(!somebody->me);
26.401 - TEST_ASSERT(somebody->comm_type == PEP_ct_key_not_found);
26.402 - TEST_ASSERT(strcmp(somebody->address, rando_address) == 0);
26.403 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.404 + TEST_ASSERT_MSG((!somebody->fpr || somebody->fpr[0] == '\0'), "!somebody->fpr || somebody->fpr[0] == '\0'");
26.405 + TEST_ASSERT_MSG((somebody->username), "somebody->username");
26.406 + TEST_ASSERT_MSG((strcmp(somebody->username, rando_name) == 0), "strcmp(somebody->username, rando_name) == 0");
26.407 + TEST_ASSERT_MSG((somebody->user_id), "somebody->user_id");
26.408 + TEST_ASSERT_MSG((strcmp(somebody->user_id, rando_userid) == 0), "strcmp(somebody->user_id, rando_userid) == 0"); // ???
26.409 + TEST_ASSERT_MSG((!somebody->me), "!somebody->me");
26.410 + TEST_ASSERT_MSG((somebody->comm_type == PEP_ct_key_not_found), "somebody->comm_type == PEP_ct_key_not_found");
26.411 + TEST_ASSERT_MSG((strcmp(somebody->address, rando_address) == 0), "strcmp(somebody->address, rando_address) == 0");
26.412
26.413 cout << "PASS: update_identity() correctly created record with no key" << endl << endl;
26.414 free_identity(somebody);
26.415 @@ -413,15 +413,15 @@
26.416 status = update_identity(session, somebody);
26.417 const char* expected_rando2_userid = "TOFU_boof2@pickles.org";
26.418
26.419 - TEST_ASSERT(status == PEP_STATUS_OK);
26.420 - TEST_ASSERT(!somebody->fpr || somebody->fpr[0] == '\0');
26.421 - TEST_ASSERT(somebody->username);
26.422 - TEST_ASSERT(strcmp(somebody->username, rando2_name) == 0);
26.423 - TEST_ASSERT(somebody->user_id);
26.424 - TEST_ASSERT(strcmp(somebody->user_id, expected_rando2_userid) == 0); // ???
26.425 - TEST_ASSERT(!somebody->me);
26.426 - TEST_ASSERT(somebody->comm_type == PEP_ct_key_not_found);
26.427 - TEST_ASSERT(strcmp(somebody->address, rando2_address) == 0);
26.428 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.429 + TEST_ASSERT_MSG((!somebody->fpr || somebody->fpr[0] == '\0'), "!somebody->fpr || somebody->fpr[0] == '\0'");
26.430 + TEST_ASSERT_MSG((somebody->username), "somebody->username");
26.431 + TEST_ASSERT_MSG((strcmp(somebody->username, rando2_name) == 0), "strcmp(somebody->username, rando2_name) == 0");
26.432 + TEST_ASSERT_MSG((somebody->user_id), "somebody->user_id");
26.433 + TEST_ASSERT_MSG((strcmp(somebody->user_id, expected_rando2_userid) == 0), "strcmp(somebody->user_id, expected_rando2_userid) == 0"); // ???
26.434 + TEST_ASSERT_MSG((!somebody->me), "!somebody->me");
26.435 + TEST_ASSERT_MSG((somebody->comm_type == PEP_ct_key_not_found), "somebody->comm_type == PEP_ct_key_not_found");
26.436 + TEST_ASSERT_MSG((strcmp(somebody->address, rando2_address) == 0), "strcmp(somebody->address, rando2_address) == 0");
26.437
26.438 cout << "PASS: update_identity() correctly created record with no key" << endl << endl;
26.439 free_identity(somebody);
26.440 @@ -435,12 +435,12 @@
26.441
26.442 // 2. set identity
26.443 status = set_identity(session, bella);
26.444 - TEST_ASSERT(status == PEP_STATUS_OK);
26.445 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.446 free_identity(bella);
26.447
26.448 bella = new_identity(bella_address, NULL, NULL, NULL);
26.449 status = update_identity(session, bella);
26.450 - TEST_ASSERT(status == PEP_STATUS_OK);
26.451 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.452
26.453 // cout << "PASS: update_identity() correctly failed with no matching records (too little info)" << endl << endl;
26.454
26.455 @@ -460,26 +460,26 @@
26.456 const string bernd_pub_key = slurp("test_keys/pub/bernd.das.brot-0xCAFAA422_pub.asc");
26.457
26.458 statuspub = import_key(session, bernd_pub_key.c_str(), bernd_pub_key.length(), NULL);
26.459 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
26.460 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
26.461
26.462 pEp_identity* bernd = new_identity(bernd_address, bernd_fpr, bernd_userid, bernd_username);
26.463
26.464 // 2. set identity
26.465 status = set_identity(session, bernd);
26.466 - TEST_ASSERT(status == PEP_STATUS_OK);
26.467 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.468 free_identity(bernd);
26.469
26.470 bernd = new_identity(bernd_address, NULL, bernd_userid, bernd_username);
26.471 status = update_identity(session, bernd);
26.472 - TEST_ASSERT(status != PEP_STATUS_OK);
26.473 - TEST_ASSERT(!bernd->fpr || bernd->fpr[0] == '\0');
26.474 - TEST_ASSERT(bernd->username);
26.475 - TEST_ASSERT(strcmp(bernd->username, bernd_username) == 0);
26.476 - TEST_ASSERT(bernd->user_id);
26.477 - TEST_ASSERT(strcmp(bernd->user_id, bernd_userid) == 0); // ???
26.478 - TEST_ASSERT(!bernd->me);
26.479 - TEST_ASSERT(bernd->comm_type == PEP_ct_key_expired);
26.480 - TEST_ASSERT(strcmp(bernd->address, bernd_address) == 0);
26.481 + TEST_ASSERT_MSG((status != PEP_STATUS_OK), "status != PEP_STATUS_OK");
26.482 + TEST_ASSERT_MSG((!bernd->fpr || bernd->fpr[0] == '\0'), "!bernd->fpr || bernd->fpr[0] == '\0'");
26.483 + TEST_ASSERT_MSG((bernd->username), "bernd->username");
26.484 + TEST_ASSERT_MSG((strcmp(bernd->username, bernd_username) == 0), "strcmp(bernd->username, bernd_username) == 0");
26.485 + TEST_ASSERT_MSG((bernd->user_id), "bernd->user_id");
26.486 + TEST_ASSERT_MSG((strcmp(bernd->user_id, bernd_userid) == 0), "strcmp(bernd->user_id, bernd_userid) == 0"); // ???
26.487 + TEST_ASSERT_MSG((!bernd->me), "!bernd->me");
26.488 + TEST_ASSERT_MSG((bernd->comm_type == PEP_ct_key_expired), "bernd->comm_type == PEP_ct_key_expired");
26.489 + TEST_ASSERT_MSG((strcmp(bernd->address, bernd_address) == 0), "strcmp(bernd->address, bernd_address) == 0");
26.490
26.491 cout << "PASS: update_identity() correctly rejected expired key with PEP_KEY_UNSUITABLE and PEP_ct_key_expired" << endl << endl;
26.492 free_identity(bernd);
26.493 @@ -507,19 +507,19 @@
26.494 char* revoke_fpr_arr[3];
26.495
26.496 status = generate_keypair(session, revokemaster_3000);
26.497 - TEST_ASSERT(status == PEP_STATUS_OK && revokemaster_3000->fpr);
26.498 + TEST_ASSERT_MSG((status == PEP_STATUS_OK && revokemaster_3000->fpr), "status == PEP_STATUS_OK && revokemaster_3000->fpr");
26.499 revoke_fpr_arr[0] = strdup(revokemaster_3000->fpr);
26.500 free(revokemaster_3000->fpr);
26.501 revokemaster_3000->fpr = NULL;
26.502
26.503 status = generate_keypair(session, revokemaster_3000);
26.504 - TEST_ASSERT(status == PEP_STATUS_OK && revokemaster_3000->fpr);
26.505 + TEST_ASSERT_MSG((status == PEP_STATUS_OK && revokemaster_3000->fpr), "status == PEP_STATUS_OK && revokemaster_3000->fpr");
26.506 revoke_fpr_arr[1] = strdup(revokemaster_3000->fpr);
26.507 free(revokemaster_3000->fpr);
26.508 revokemaster_3000->fpr = NULL;
26.509
26.510 status = generate_keypair(session, revokemaster_3000);
26.511 - TEST_ASSERT(status == PEP_STATUS_OK && revokemaster_3000->fpr);
26.512 + TEST_ASSERT_MSG((status == PEP_STATUS_OK && revokemaster_3000->fpr), "status == PEP_STATUS_OK && revokemaster_3000->fpr");
26.513 revoke_fpr_arr[2] = strdup(revokemaster_3000->fpr);
26.514 free(revokemaster_3000->fpr);
26.515 revokemaster_3000->fpr = NULL;
26.516 @@ -529,24 +529,24 @@
26.517 free(revokemaster_3000->fpr);
26.518 revokemaster_3000->fpr = strdup(revoke_fpr_arr[2]);
26.519 status = trust_personal_key(session, revokemaster_3000);
26.520 - TEST_ASSERT(status == PEP_STATUS_OK);
26.521 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.522 status = get_trust(session, revokemaster_3000);
26.523 - TEST_ASSERT(status == PEP_STATUS_OK);
26.524 - TEST_ASSERT(revokemaster_3000->comm_type & PEP_ct_confirmed);
26.525 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.526 + TEST_ASSERT_MSG((revokemaster_3000->comm_type & PEP_ct_confirmed), "revokemaster_3000->comm_type & PEP_ct_confirmed");
26.527
26.528 free(revokemaster_3000->fpr);
26.529 revokemaster_3000->fpr = strdup(revoke_fpr_arr[0]);
26.530 status = trust_personal_key(session, revokemaster_3000);
26.531 - TEST_ASSERT(status == PEP_STATUS_OK);
26.532 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.533 status = get_trust(session, revokemaster_3000);
26.534 - TEST_ASSERT(status == PEP_STATUS_OK);
26.535 - TEST_ASSERT(revokemaster_3000->comm_type & PEP_ct_confirmed);
26.536 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.537 + TEST_ASSERT_MSG((revokemaster_3000->comm_type & PEP_ct_confirmed), "revokemaster_3000->comm_type & PEP_ct_confirmed");
26.538
26.539 status = update_identity(session, revokemaster_3000);
26.540 - TEST_ASSERT(status == PEP_STATUS_OK);
26.541 - TEST_ASSERT(revokemaster_3000->fpr);
26.542 - TEST_ASSERT(strcmp(revokemaster_3000->fpr, revoke_fpr_arr[2]) == 0);
26.543 - TEST_ASSERT(revokemaster_3000->comm_type & PEP_ct_confirmed);
26.544 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.545 + TEST_ASSERT_MSG((revokemaster_3000->fpr), "revokemaster_3000->fpr");
26.546 + TEST_ASSERT_MSG((strcmp(revokemaster_3000->fpr, revoke_fpr_arr[2]) == 0), "strcmp(revokemaster_3000->fpr, revoke_fpr_arr[2]) == 0");
26.547 + TEST_ASSERT_MSG((revokemaster_3000->comm_type & PEP_ct_confirmed), "revokemaster_3000->comm_type & PEP_ct_confirmed");
26.548
26.549 cout << "update_identity returns the correct identity default." << endl;
26.550
26.551 @@ -559,36 +559,36 @@
26.552
26.553 bool is_revoked;
26.554 status = key_revoked(session, revokemaster_3000->fpr, &is_revoked);
26.555 - TEST_ASSERT(status == PEP_STATUS_OK);
26.556 - TEST_ASSERT(is_revoked);
26.557 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.558 + TEST_ASSERT_MSG((is_revoked), "is_revoked");
26.559
26.560 cout << "Success revoking " << revoke_fpr_arr[2] << "!!! get_trust for this fpr gives us " << revokemaster_3000->comm_type << endl;
26.561
26.562 cout << "Now see if update_identity gives us " << revoke_fpr_arr[0] << ", the only trusted key left." << endl;
26.563 status = update_identity(session, revokemaster_3000);
26.564 - TEST_ASSERT(status == PEP_STATUS_OK);
26.565 - TEST_ASSERT(revokemaster_3000->fpr);
26.566 - TEST_ASSERT(strcmp(revokemaster_3000->fpr, revoke_fpr_arr[0]) == 0);
26.567 - TEST_ASSERT(revokemaster_3000->comm_type & PEP_ct_confirmed);
26.568 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.569 + TEST_ASSERT_MSG((revokemaster_3000->fpr), "revokemaster_3000->fpr");
26.570 + TEST_ASSERT_MSG((strcmp(revokemaster_3000->fpr, revoke_fpr_arr[0]) == 0), "strcmp(revokemaster_3000->fpr, revoke_fpr_arr[0]) == 0");
26.571 + TEST_ASSERT_MSG((revokemaster_3000->comm_type & PEP_ct_confirmed), "revokemaster_3000->comm_type & PEP_ct_confirmed");
26.572
26.573 cout << "Success! So let's mistrust it, because seriously, that key was so uncool." << endl;
26.574
26.575 status = key_mistrusted(session, revokemaster_3000);
26.576 - TEST_ASSERT(status == PEP_STATUS_OK);
26.577 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.578
26.579 status = get_trust(session, revokemaster_3000);
26.580 - TEST_ASSERT(status == PEP_STATUS_OK);
26.581 - TEST_ASSERT(revokemaster_3000->comm_type == PEP_ct_mistrusted);
26.582 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.583 + TEST_ASSERT_MSG((revokemaster_3000->comm_type == PEP_ct_mistrusted), "revokemaster_3000->comm_type == PEP_ct_mistrusted");
26.584
26.585 cout << "Success! get_trust for this fpr gives us " << revokemaster_3000->comm_type << endl;
26.586
26.587 cout << "The only fpr left is an untrusted one - let's make sure this is what we get from update_identity." << endl;
26.588
26.589 status = update_identity(session, revokemaster_3000);
26.590 - TEST_ASSERT(status == PEP_STATUS_OK);
26.591 - TEST_ASSERT(revokemaster_3000->fpr);
26.592 - TEST_ASSERT(strcmp(revokemaster_3000->fpr, revoke_fpr_arr[1]) == 0);
26.593 - TEST_ASSERT(!(revokemaster_3000->comm_type & PEP_ct_confirmed));
26.594 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.595 + TEST_ASSERT_MSG((revokemaster_3000->fpr), "revokemaster_3000->fpr");
26.596 + TEST_ASSERT_MSG((strcmp(revokemaster_3000->fpr, revoke_fpr_arr[1]) == 0), "strcmp(revokemaster_3000->fpr, revoke_fpr_arr[1]) == 0");
26.597 + TEST_ASSERT_MSG((!(revokemaster_3000->comm_type & PEP_ct_confirmed)), "!(revokemaster_3000->comm_type & PEP_ct_confirmed)");
26.598
26.599 cout << "Success! We got " << revoke_fpr_arr[1] << "as the fpr with comm_type " << revokemaster_3000->comm_type << endl;
26.600
26.601 @@ -598,19 +598,19 @@
26.602 TEST_ASSERT (status == PEP_STATUS_OK);
26.603
26.604 status = key_revoked(session, revokemaster_3000->fpr, &is_revoked);
26.605 - TEST_ASSERT(status == PEP_STATUS_OK);
26.606 - TEST_ASSERT(is_revoked);
26.607 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
26.608 + TEST_ASSERT_MSG((is_revoked), "is_revoked");
26.609
26.610 cout << "Success! get_trust for this fpr gives us " << revokemaster_3000->comm_type << endl;
26.611
26.612 cout << "Call update_identity - we expect nothing, plus an error comm type." << endl;
26.613
26.614 status = update_identity(session, revokemaster_3000);
26.615 - TEST_ASSERT(status != PEP_STATUS_OK);
26.616 - TEST_ASSERT(!revokemaster_3000->fpr);
26.617 - TEST_ASSERT(revokemaster_3000->username);
26.618 - TEST_ASSERT(strcmp(revokemaster_3000->user_id, revoke_uuid) == 0);
26.619 - TEST_ASSERT(revokemaster_3000->comm_type == PEP_ct_key_not_found);
26.620 + TEST_ASSERT_MSG((status != PEP_STATUS_OK), "status != PEP_STATUS_OK");
26.621 + TEST_ASSERT_MSG((!revokemaster_3000->fpr), "!revokemaster_3000->fpr");
26.622 + TEST_ASSERT_MSG((revokemaster_3000->username), "revokemaster_3000->username");
26.623 + TEST_ASSERT_MSG((strcmp(revokemaster_3000->user_id, revoke_uuid) == 0), "strcmp(revokemaster_3000->user_id, revoke_uuid) == 0");
26.624 + TEST_ASSERT_MSG((revokemaster_3000->comm_type == PEP_ct_key_not_found), "revokemaster_3000->comm_type == PEP_ct_key_not_found");
26.625 cout << "Success! No key found. The comm_status error was " << revokemaster_3000->comm_type << "and the return status was " << tl_status_string(status) << endl;
26.626
26.627 free_identity(revokemaster_3000);
27.1 --- a/test/src/engine_tests/PepSubjectReceivedTests.cc Wed May 09 10:22:22 2018 +0200
27.2 +++ b/test/src/engine_tests/PepSubjectReceivedTests.cc Wed May 09 11:39:10 2018 +0200
27.3 @@ -61,8 +61,8 @@
27.4 PEP_decrypt_flags_t flags;
27.5
27.6 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.7 - TEST_ASSERT(status == PEP_STATUS_OK);
27.8 - TEST_ASSERT(msg_ptr);
27.9 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.10 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.11 final_ptr = msg_ptr;
27.12 flags = 0;
27.13 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.14 @@ -72,7 +72,7 @@
27.15 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.16 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.17
27.18 - TEST_ASSERT(strcmp("This is the usual pEp subject that should replace the above.", final_ptr->shortmsg) == 0);
27.19 + TEST_ASSERT_MSG((strcmp("This is the usual pEp subject that should replace the above.", final_ptr->shortmsg) == 0), "strcmp(\"This is the usual pEp subject that should replace the above.\", final_ptr->shortmsg) == 0");
27.20
27.21 cout << "Test 1a: Subject replaced as expected." << endl << endl;
27.22
27.23 @@ -94,8 +94,8 @@
27.24 rating = PEP_rating_unreliable;
27.25
27.26 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.27 - TEST_ASSERT(status == PEP_STATUS_OK);
27.28 - TEST_ASSERT(msg_ptr);
27.29 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.30 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.31 final_ptr = msg_ptr;
27.32 flags = 0;
27.33 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.34 @@ -105,7 +105,7 @@
27.35 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.36 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.37
27.38 - TEST_ASSERT(strcmp("This is the usual pEp subject that should replace the above.", final_ptr->shortmsg) == 0);
27.39 + TEST_ASSERT_MSG((strcmp("This is the usual pEp subject that should replace the above.", final_ptr->shortmsg) == 0), "strcmp(\"This is the usual pEp subject that should replace the above.\", final_ptr->shortmsg) == 0");
27.40
27.41 cout << "Test 1b: Subject replaced as expected." << endl << endl;
27.42
27.43 @@ -127,8 +127,8 @@
27.44 mailtext = slurp("test_mails/pEp_subject_normal_signed_2a.eml");
27.45
27.46 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.47 - TEST_ASSERT(status == PEP_STATUS_OK);
27.48 - TEST_ASSERT(msg_ptr);
27.49 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.50 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.51 final_ptr = msg_ptr;
27.52 flags = 0;
27.53 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.54 @@ -138,7 +138,7 @@
27.55 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.56 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.57
27.58 - TEST_ASSERT(strcmp("Now signed!", final_ptr->shortmsg) == 0);
27.59 + TEST_ASSERT_MSG((strcmp("Now signed!", final_ptr->shortmsg) == 0), "strcmp(\"Now signed!\", final_ptr->shortmsg) == 0");
27.60
27.61 cout << "Test 2a: Subject replaced as expected." << endl << endl;
27.62
27.63 @@ -160,8 +160,8 @@
27.64 mailtext = slurp("test_mails/p3p_subject_normal_signed_2b.eml");
27.65
27.66 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.67 - TEST_ASSERT(status == PEP_STATUS_OK);
27.68 - TEST_ASSERT(msg_ptr);
27.69 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.70 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.71 final_ptr = msg_ptr;
27.72 flags = 0;
27.73 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.74 @@ -171,7 +171,7 @@
27.75 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.76 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.77
27.78 - TEST_ASSERT(strcmp("Now signed!", final_ptr->shortmsg) == 0);
27.79 + TEST_ASSERT_MSG((strcmp("Now signed!", final_ptr->shortmsg) == 0), "strcmp(\"Now signed!\", final_ptr->shortmsg) == 0");
27.80
27.81 cout << "Test 2b: Subject replaced as expected." << endl << endl;
27.82
27.83 @@ -194,8 +194,8 @@
27.84 mailtext = slurp("test_mails/pEp_encrypted_subject_IS_pEp_3a.eml");
27.85
27.86 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.87 - TEST_ASSERT(status == PEP_STATUS_OK);
27.88 - TEST_ASSERT(msg_ptr);
27.89 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.90 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.91 final_ptr = msg_ptr;
27.92 flags = 0;
27.93 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.94 @@ -205,7 +205,7 @@
27.95 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.96 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.97
27.98 - TEST_ASSERT(strcmp("pEp", final_ptr->shortmsg) == 0);
27.99 + TEST_ASSERT_MSG((strcmp("pEp", final_ptr->shortmsg) == 0), "strcmp(\"pEp\", final_ptr->shortmsg) == 0");
27.100
27.101 cout << "Test 3a: Subject remains intact as desired." << endl << endl;
27.102
27.103 @@ -227,8 +227,8 @@
27.104 mailtext = slurp("test_mails/p3p_encrypted_subject_IS_pEp_3b.eml");
27.105
27.106 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.107 - TEST_ASSERT(status == PEP_STATUS_OK);
27.108 - TEST_ASSERT(msg_ptr);
27.109 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.110 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.111 final_ptr = msg_ptr;
27.112 flags = 0;
27.113 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.114 @@ -238,7 +238,7 @@
27.115 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.116 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.117
27.118 - TEST_ASSERT(strcmp("p≡p", final_ptr->shortmsg) == 0);
27.119 + TEST_ASSERT_MSG((strcmp("p≡p", final_ptr->shortmsg) == 0), "strcmp(\"p≡p\", final_ptr->shortmsg) == 0");
27.120
27.121 cout << "Test 3: Subject remains intact as desired." << endl << endl;
27.122
27.123 @@ -261,8 +261,8 @@
27.124 mailtext = slurp("test_mails/pEp_subject_pEp_replaced_w_pEp_4a.eml");
27.125
27.126 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.127 - TEST_ASSERT(status == PEP_STATUS_OK);
27.128 - TEST_ASSERT(msg_ptr);
27.129 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.130 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.131 final_ptr = msg_ptr;
27.132 flags = 0;
27.133 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.134 @@ -272,7 +272,7 @@
27.135 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.136 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.137
27.138 - TEST_ASSERT(strcmp("pEp", final_ptr->shortmsg) == 0);
27.139 + TEST_ASSERT_MSG((strcmp("pEp", final_ptr->shortmsg) == 0), "strcmp(\"pEp\", final_ptr->shortmsg) == 0");
27.140
27.141 cout << "Test 4a: Subject correct." << endl << endl;
27.142
27.143 @@ -294,8 +294,8 @@
27.144 mailtext = slurp("test_mails/pEp_subject_pEp_replaced_w_p3p_4b.eml");
27.145
27.146 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.147 - TEST_ASSERT(status == PEP_STATUS_OK);
27.148 - TEST_ASSERT(msg_ptr);
27.149 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.150 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.151 final_ptr = msg_ptr;
27.152 flags = 0;
27.153 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.154 @@ -305,7 +305,7 @@
27.155 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.156 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.157
27.158 - TEST_ASSERT(strcmp("pEp", final_ptr->shortmsg) == 0);
27.159 + TEST_ASSERT_MSG((strcmp("pEp", final_ptr->shortmsg) == 0), "strcmp(\"pEp\", final_ptr->shortmsg) == 0");
27.160
27.161 cout << "Test 4b: Subject correct." << endl << endl;
27.162
27.163 @@ -327,8 +327,8 @@
27.164 mailtext = slurp("test_mails/pEp_subject_p3p_replaced_w_pEp_4c.eml");
27.165
27.166 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.167 - TEST_ASSERT(status == PEP_STATUS_OK);
27.168 - TEST_ASSERT(msg_ptr);
27.169 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.170 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.171 final_ptr = msg_ptr;
27.172 flags = 0;
27.173 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.174 @@ -338,7 +338,7 @@
27.175 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.176 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.177
27.178 - TEST_ASSERT(strcmp("p≡p", final_ptr->shortmsg) == 0);
27.179 + TEST_ASSERT_MSG((strcmp("p≡p", final_ptr->shortmsg) == 0), "strcmp(\"p≡p\", final_ptr->shortmsg) == 0");
27.180
27.181 cout << "Test 4c: Subject correct." << endl << endl;
27.182
27.183 @@ -360,8 +360,8 @@
27.184 mailtext = slurp("test_mails/pEp_subject_p3p_replaced_w_p3p_4d.eml");
27.185
27.186 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.187 - TEST_ASSERT(status == PEP_STATUS_OK);
27.188 - TEST_ASSERT(msg_ptr);
27.189 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.190 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.191 final_ptr = msg_ptr;
27.192 flags = 0;
27.193 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.194 @@ -371,7 +371,7 @@
27.195 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.196 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.197
27.198 - TEST_ASSERT(strcmp("p≡p", final_ptr->shortmsg) == 0);
27.199 + TEST_ASSERT_MSG((strcmp("p≡p", final_ptr->shortmsg) == 0), "strcmp(\"p≡p\", final_ptr->shortmsg) == 0");
27.200
27.201 cout << "Test 4d: Subject correct, in any event." << endl << endl;
27.202
27.203 @@ -394,8 +394,8 @@
27.204 mailtext = slurp("test_mails/pEp_unencrypted_pEp_subject_5a.eml");
27.205
27.206 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.207 - TEST_ASSERT(status == PEP_STATUS_OK);
27.208 - TEST_ASSERT(msg_ptr);
27.209 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.210 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.211 final_ptr = msg_ptr;
27.212 flags = 0;
27.213 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.214 @@ -405,7 +405,7 @@
27.215 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.216 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.217
27.218 - TEST_ASSERT(strcmp("pEp", final_ptr->shortmsg) == 0);
27.219 + TEST_ASSERT_MSG((strcmp("pEp", final_ptr->shortmsg) == 0), "strcmp(\"pEp\", final_ptr->shortmsg) == 0");
27.220
27.221 cout << "Test 5a: Subject remains intact." << endl << endl;
27.222
27.223 @@ -428,8 +428,8 @@
27.224 mailtext = slurp("test_mails/pEp_unencrypted_p3p_subject_5b.eml");
27.225
27.226 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.227 - TEST_ASSERT(status == PEP_STATUS_OK);
27.228 - TEST_ASSERT(msg_ptr);
27.229 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.230 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.231 final_ptr = msg_ptr;
27.232 flags = 0;
27.233 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.234 @@ -439,7 +439,7 @@
27.235 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.236 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.237
27.238 - TEST_ASSERT(strcmp("p≡p", final_ptr->shortmsg) == 0);
27.239 + TEST_ASSERT_MSG((strcmp("p≡p", final_ptr->shortmsg) == 0), "strcmp(\"p≡p\", final_ptr->shortmsg) == 0");
27.240
27.241 cout << "Test 5b: Subject remains intact." << endl << endl;
27.242
27.243 @@ -461,8 +461,8 @@
27.244 mailtext = slurp("test_mails/pEp_subject_normal_unencrypted_6.eml");
27.245
27.246 status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
27.247 - TEST_ASSERT(status == PEP_STATUS_OK);
27.248 - TEST_ASSERT(msg_ptr);
27.249 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
27.250 + TEST_ASSERT_MSG((msg_ptr), "msg_ptr");
27.251 final_ptr = msg_ptr;
27.252 flags = 0;
27.253 status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
27.254 @@ -472,7 +472,7 @@
27.255 cout << "longmsg: " << final_ptr->longmsg << endl << endl;
27.256 cout << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
27.257
27.258 - TEST_ASSERT(strcmp("This is just a normal subject, really", final_ptr->shortmsg) == 0);
27.259 + TEST_ASSERT_MSG((strcmp("This is just a normal subject, really", final_ptr->shortmsg) == 0), "strcmp(\"This is just a normal subject, really\", final_ptr->shortmsg) == 0");
27.260
27.261 cout << "Test 6: Subject remains intact." << endl << endl;
27.262
28.1 --- a/test/src/engine_tests/PgpBinaryTests.cc Wed May 09 10:22:22 2018 +0200
28.2 +++ b/test/src/engine_tests/PgpBinaryTests.cc Wed May 09 11:39:10 2018 +0200
28.3 @@ -26,9 +26,9 @@
28.4
28.5 const char *path;
28.6 PEP_STATUS status2 = get_binary_path(PEP_crypt_OpenPGP, &path);
28.7 - TEST_ASSERT(status2 == PEP_STATUS_OK);
28.8 + TEST_ASSERT_MSG((status2 == PEP_STATUS_OK), "status2 == PEP_STATUS_OK");
28.9 #ifdef USE_GPG
28.10 - TEST_ASSERT(path);
28.11 + TEST_ASSERT_MSG((path), "path");
28.12 #endif
28.13 if (path)
28.14 cout << "PGP binary at " << path << "\n";
29.1 --- a/test/src/engine_tests/RevokeRegenAttachTests.cc Wed May 09 10:22:22 2018 +0200
29.2 +++ b/test/src/engine_tests/RevokeRegenAttachTests.cc Wed May 09 11:39:10 2018 +0200
29.3 @@ -52,11 +52,11 @@
29.4 free(me->fpr);
29.5 me->fpr = NULL;
29.6 status = myself(session, me);
29.7 - TEST_ASSERT(status == PEP_STATUS_OK);
29.8 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
29.9 cout << me->fpr << "\n";
29.10
29.11 - TEST_ASSERT(me->fpr);
29.12 - TEST_ASSERT(strcmp(me->fpr, prev_fpr) != 0);
29.13 + TEST_ASSERT_MSG((me->fpr), "me->fpr");
29.14 + TEST_ASSERT_MSG((strcmp(me->fpr, prev_fpr) != 0), "strcmp(me->fpr, prev_fpr) != 0");
29.15 cout << "New fpr is: " << me->fpr;
29.16
29.17 me->fpr = NULL;
29.18 @@ -65,7 +65,7 @@
29.19
29.20 identity_list *to = new_identity_list(new_identity("pep.test.alice@pep-project.org", NULL, "42", "pEp Test Alice (test key don't use)"));
29.21 message *msg = new_message(PEP_dir_outgoing);
29.22 - TEST_ASSERT(msg);
29.23 + TEST_ASSERT_MSG((msg), "msg");
29.24 msg->from = me;
29.25 msg->to = to;
29.26 msg->shortmsg = strdup("hello, world");
29.27 @@ -75,16 +75,16 @@
29.28 message *enc_msg;
29.29 cout << "calling encrypt_message()\n";
29.30 status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
29.31 - TEST_ASSERT(status == PEP_STATUS_OK);
29.32 - TEST_ASSERT(enc_msg);
29.33 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
29.34 + TEST_ASSERT_MSG((enc_msg), "enc_msg");
29.35 cout << "message encrypted.\n";
29.36
29.37 // cout << msg->attachments->filename;
29.38 // int bl_len = bloblist_length(msg->attachments);
29.39 // cout << "Message contains " << bloblist_length(msg->attachments) << " attachments." << endl;
29.40 - // TEST_ASSERT(bloblist_length(msg->attachments) == 2);
29.41 - // TEST_ASSERT(strcmp(msg->attachments->filename, "file://pEpkey.asc") == 0);
29.42 - // TEST_ASSERT(strcmp(msg->attachments->next->filename, "file://pEpkey.asc") == 0);
29.43 + // TEST_ASSERT_MSG((bloblist_length(msg->attachments) == 2), "bloblist_length(msg->attachments) == 2");
29.44 + // TEST_ASSERT_MSG((strcmp(msg->attachments->filename, "file://pEpkey.asc") == 0), "strcmp(msg->attachments->filename, \"file://pEpkey.asc\") == 0");
29.45 + // TEST_ASSERT_MSG((strcmp(msg->attachments->next->filename, "file://pEpkey.asc") == 0), "strcmp(msg->attachments->next->filename, \"file://pEpkey.asc\") == 0");
29.46 //
29.47 // cout << "message contains 2 key attachments.\n";
29.48
30.1 --- a/test/src/engine_tests/StringlistTests.cc Wed May 09 10:22:22 2018 +0200
30.2 +++ b/test/src/engine_tests/StringlistTests.cc Wed May 09 11:39:10 2018 +0200
30.3 @@ -28,10 +28,10 @@
30.4 cout << "creating one-element stringlist…\n";
30.5
30.6 stringlist_t* src = new_stringlist(str0);
30.7 - TEST_ASSERT(src);
30.8 - TEST_ASSERT(strcmp(src->value,str0) == 0);
30.9 + TEST_ASSERT_MSG((src), "src");
30.10 + TEST_ASSERT_MSG((strcmp(src->value,str0) == 0), "strcmp(src->value,str0) == 0");
30.11 cout << "Value: " << src->value;
30.12 - TEST_ASSERT(src->next == NULL);
30.13 + TEST_ASSERT_MSG((src->next == NULL), "src->next == NULL");
30.14 cout << "one-element stringlist created, next element is NULL\n";
30.15
30.16 cout << "freeing stringlist…\n\n";
30.17 @@ -47,41 +47,41 @@
30.18 const char* strarr[4] = {str1, str2, str3, str4};
30.19 cout << "stringlist_add on empty list…\n";
30.20 src = stringlist_add(src, str1); // src is NULL
30.21 - TEST_ASSERT(src);
30.22 - TEST_ASSERT(stringlist_add(src, str2)); // returns ptr to new elt
30.23 - TEST_ASSERT(stringlist_add(src, str3));
30.24 - TEST_ASSERT(stringlist_add(src, str4));
30.25 + TEST_ASSERT_MSG((src), "src");
30.26 + TEST_ASSERT_MSG((stringlist_add(src, str2)), "stringlist_add(src, str2)"); // returns ptr to new elt
30.27 + TEST_ASSERT_MSG((stringlist_add(src, str3)), "stringlist_add(src, str3)");
30.28 + TEST_ASSERT_MSG((stringlist_add(src, str4)), "stringlist_add(src, str4)");
30.29
30.30 cout << "checking contents\n";
30.31 stringlist_t* p = src;
30.32 int i = 0;
30.33 while (p) {
30.34 - TEST_ASSERT(p->value);
30.35 - TEST_ASSERT(strcmp(p->value, strarr[i]) == 0);
30.36 - TEST_ASSERT(p->value != strarr[i]); // ensure this is a copy
30.37 + TEST_ASSERT_MSG((p->value), "p->value");
30.38 + TEST_ASSERT_MSG((strcmp(p->value, strarr[i]) == 0), "strcmp(p->value, strarr[i]) == 0");
30.39 + TEST_ASSERT_MSG((p->value != strarr[i]), "p->value != strarr[i]"); // ensure this is a copy
30.40 p = p->next;
30.41 i++;
30.42 }
30.43 - TEST_ASSERT(p == NULL); // list ends properly
30.44 + TEST_ASSERT_MSG((p == NULL), "p == NULL"); // list ends properly
30.45
30.46 cout << "\nduplicating four-element stringlist…\n";
30.47 stringlist_t* dst = stringlist_dup(src);
30.48 - TEST_ASSERT(dst);
30.49 + TEST_ASSERT_MSG((dst), "dst");
30.50
30.51 stringlist_t* p_dst = dst;
30.52 p = src;
30.53
30.54 cout << "checking contents\n";
30.55 while (p_dst) {
30.56 - TEST_ASSERT(p_dst->value);
30.57 - TEST_ASSERT(strcmp(p->value, p_dst->value) == 0);
30.58 - TEST_ASSERT(p->value != p_dst->value); // ensure this is a copy
30.59 + TEST_ASSERT_MSG((p_dst->value), "p_dst->value");
30.60 + TEST_ASSERT_MSG((strcmp(p->value, p_dst->value) == 0), "strcmp(p->value, p_dst->value) == 0");
30.61 + TEST_ASSERT_MSG((p->value != p_dst->value), "p->value != p_dst->value"); // ensure this is a copy
30.62 cout << p_dst->value;
30.63 p = p->next;
30.64 p_dst = p_dst->next;
30.65 - TEST_ASSERT((p == NULL) == (p_dst == NULL));
30.66 + TEST_ASSERT_MSG(((p == NULL) == (p_dst == NULL)), "(p == NULL) == (p_dst == NULL)");
30.67 }
30.68 - TEST_ASSERT(p_dst == NULL);
30.69 + TEST_ASSERT_MSG((p_dst == NULL), "p_dst == NULL");
30.70
30.71 cout << "freeing stringlists…\n\n";
30.72 free_stringlist(src);
30.73 @@ -91,11 +91,11 @@
30.74
30.75 cout << "duplicating one-element stringlist…\n";
30.76 src = new_stringlist(str0);
30.77 - TEST_ASSERT(src);
30.78 + TEST_ASSERT_MSG((src), "src");
30.79 dst = stringlist_dup(src);
30.80 - TEST_ASSERT(strcmp(dst->value, str0) == 0);
30.81 + TEST_ASSERT_MSG((strcmp(dst->value, str0) == 0), "strcmp(dst->value, str0) == 0");
30.82 cout << "Value: " << src->value;
30.83 - TEST_ASSERT(dst->next == NULL);
30.84 + TEST_ASSERT_MSG((dst->next == NULL), "dst->next == NULL");
30.85 cout << "one-element stringlist duped, next element is NULL\n";
30.86
30.87 cout << "\nAdd to empty stringlist (node exists, but no value…)\n";
30.88 @@ -103,9 +103,9 @@
30.89 free(src->value);
30.90 src->value = NULL;
30.91 stringlist_add(src, str2);
30.92 - TEST_ASSERT(src->value);
30.93 - TEST_ASSERT(strcmp(src->value, str2) == 0);
30.94 - TEST_ASSERT(src->value != str2); // ensure this is a copy
30.95 + TEST_ASSERT_MSG((src->value), "src->value");
30.96 + TEST_ASSERT_MSG((strcmp(src->value, str2) == 0), "strcmp(src->value, str2) == 0");
30.97 + TEST_ASSERT_MSG((src->value != str2), "src->value != str2"); // ensure this is a copy
30.98 cout << src->value;
30.99
30.100 cout << "\nfreeing stringlists…\n\n";
31.1 --- a/test/src/engine_tests/StringpairListTests.cc Wed May 09 10:22:22 2018 +0200
31.2 +++ b/test/src/engine_tests/StringpairListTests.cc Wed May 09 11:39:10 2018 +0200
31.3 @@ -53,23 +53,23 @@
31.4 cout << "creating one-element stringpair_list...\n";
31.5
31.6 stringpair_t* strpair = new_stringpair(val_1_arr[0], val_2_arr[0]);
31.7 - TEST_ASSERT(strpair);
31.8 + TEST_ASSERT_MSG((strpair), "strpair");
31.9 stringpair_list_t* pairlist = new_stringpair_list(strpair);
31.10 - TEST_ASSERT(pairlist->value);
31.11 - TEST_ASSERT(test_stringpair_equals(strpair, pairlist->value));
31.12 - TEST_ASSERT(pairlist->next == NULL);
31.13 + TEST_ASSERT_MSG((pairlist->value), "pairlist->value");
31.14 + TEST_ASSERT_MSG((test_stringpair_equals(strpair, pairlist->value)), "test_stringpair_equals(strpair, pairlist->value)");
31.15 + TEST_ASSERT_MSG((pairlist->next == NULL), "pairlist->next == NULL");
31.16 cout << "one-element stringpair_list created, next element is NULL\n\n";
31.17
31.18 cout << "duplicating one-element list...\n";
31.19 stringpair_list_t* duplist = stringpair_list_dup(pairlist);
31.20 stringpair_t* srcpair = pairlist->value;
31.21 stringpair_t* dstpair = duplist->value;
31.22 - TEST_ASSERT(dstpair);
31.23 - TEST_ASSERT(dstpair->value);
31.24 - TEST_ASSERT(test_stringpair_equals(srcpair, dstpair));
31.25 - TEST_ASSERT(srcpair->key != dstpair->key); // test deep copies (to be fixed in next 2 commits)
31.26 - TEST_ASSERT(srcpair->value != dstpair->value);
31.27 - TEST_ASSERT(duplist->next == NULL);
31.28 + TEST_ASSERT_MSG((dstpair), "dstpair");
31.29 + TEST_ASSERT_MSG((dstpair->value), "dstpair->value");
31.30 + TEST_ASSERT_MSG((test_stringpair_equals(srcpair, dstpair)), "test_stringpair_equals(srcpair, dstpair)");
31.31 + TEST_ASSERT_MSG((srcpair->key != dstpair->key), "srcpair->key != dstpair->key"); // test deep copies (to be fixed in next 2 commits)
31.32 + TEST_ASSERT_MSG((srcpair->value != dstpair->value), "srcpair->value != dstpair->value");
31.33 + TEST_ASSERT_MSG((duplist->next == NULL), "duplist->next == NULL");
31.34 cout << "one-element stringpair_list duplicated.\n\n";
31.35
31.36 cout << "freeing stringpair_lists...\n";
31.37 @@ -84,29 +84,29 @@
31.38 pairlist = stringpair_list_add(pairlist, new_stringpair(val_1_arr[0], val_2_arr[0]));
31.39 for (i = 1; i < 4; i++) {
31.40 p = stringpair_list_add(pairlist, new_stringpair(val_1_arr[i], val_2_arr[i]));
31.41 - TEST_ASSERT(p);
31.42 + TEST_ASSERT_MSG((p), "p");
31.43 }
31.44
31.45 p = pairlist;
31.46
31.47 for (i = 0; i < 4; i++) {
31.48 - TEST_ASSERT(p);
31.49 + TEST_ASSERT_MSG((p), "p");
31.50
31.51 strpair = p->value;
31.52 - TEST_ASSERT(strpair);
31.53 + TEST_ASSERT_MSG((strpair), "strpair");
31.54
31.55 - TEST_ASSERT(strpair->key);
31.56 - TEST_ASSERT(strcmp(val_1_arr[i], strpair->key) == 0);
31.57 + TEST_ASSERT_MSG((strpair->key), "strpair->key");
31.58 + TEST_ASSERT_MSG((strcmp(val_1_arr[i], strpair->key) == 0), "strcmp(val_1_arr[i], strpair->key) == 0");
31.59
31.60 - TEST_ASSERT(strpair->value);
31.61 - TEST_ASSERT(strcmp(val_2_arr[i], strpair->value) == 0);
31.62 + TEST_ASSERT_MSG((strpair->value), "strpair->value");
31.63 + TEST_ASSERT_MSG((strcmp(val_2_arr[i], strpair->value) == 0), "strcmp(val_2_arr[i], strpair->value) == 0");
31.64
31.65 - TEST_ASSERT(val_1_arr[i] != strpair->key);
31.66 - TEST_ASSERT(val_2_arr[i] != strpair->value);
31.67 + TEST_ASSERT_MSG((val_1_arr[i] != strpair->key), "val_1_arr[i] != strpair->key");
31.68 + TEST_ASSERT_MSG((val_2_arr[i] != strpair->value), "val_2_arr[i] != strpair->value");
31.69
31.70 p = p->next;
31.71 }
31.72 - TEST_ASSERT(p == NULL);
31.73 + TEST_ASSERT_MSG((p == NULL), "p == NULL");
31.74
31.75 cout << "\nduplicating four-element list...\n\n";
31.76 duplist = stringpair_list_dup(pairlist);
31.77 @@ -118,20 +118,20 @@
31.78 srcpair = p->value;
31.79 dstpair = dup_p->value;
31.80
31.81 - TEST_ASSERT(dstpair);
31.82 - TEST_ASSERT(dstpair->value);
31.83 + TEST_ASSERT_MSG((dstpair), "dstpair");
31.84 + TEST_ASSERT_MSG((dstpair->value), "dstpair->value");
31.85
31.86 cout << srcpair->key << ":" << srcpair->value << " / " << dstpair->key << ":" << dstpair->value << "\n";
31.87 - TEST_ASSERT(test_stringpair_equals(srcpair, dstpair));
31.88 + TEST_ASSERT_MSG((test_stringpair_equals(srcpair, dstpair)), "test_stringpair_equals(srcpair, dstpair)");
31.89
31.90 - TEST_ASSERT(srcpair->key != dstpair->key); // test deep copies (to be fixed in next 2 commits)
31.91 - TEST_ASSERT(srcpair->value != dstpair->value);
31.92 + TEST_ASSERT_MSG((srcpair->key != dstpair->key), "srcpair->key != dstpair->key"); // test deep copies (to be fixed in next 2 commits)
31.93 + TEST_ASSERT_MSG((srcpair->value != dstpair->value), "srcpair->value != dstpair->value");
31.94
31.95 i++;
31.96 p = p->next;
31.97
31.98 dup_p = dup_p->next;
31.99 - TEST_ASSERT((p == NULL) == (dup_p == NULL));
31.100 + TEST_ASSERT_MSG(((p == NULL) == (dup_p == NULL)), "(p == NULL) == (dup_p == NULL)");
31.101 }
31.102 cout << "\nfour-element stringpair_list successfully duplicated.\n\n";
31.103
32.1 --- a/test/src/engine_tests/TrustManipulationTests.cc Wed May 09 10:22:22 2018 +0200
32.2 +++ b/test/src/engine_tests/TrustManipulationTests.cc Wed May 09 11:39:10 2018 +0200
32.3 @@ -38,7 +38,7 @@
32.4 cout << uniqname << "\n";
32.5 pEp_identity * user = new_identity(uniqname, NULL, user_id, "Test User");
32.6 status = generate_keypair(session, user);
32.7 - TEST_ASSERT(user->fpr);
32.8 + TEST_ASSERT_MSG((user->fpr), "user->fpr");
32.9
32.10 char* keypair1 = strdup(user->fpr);
32.11 cout << "generated fingerprint \n";
32.12 @@ -52,55 +52,55 @@
32.13
32.14 pEp_identity * user_again = new_identity(uniqname, NULL, user_id, "Test User");
32.15 status = generate_keypair(session, user_again);
32.16 - TEST_ASSERT(user_again->fpr);
32.17 + TEST_ASSERT_MSG((user_again->fpr), "user_again->fpr");
32.18
32.19 char* keypair2 = strdup(user_again->fpr);
32.20 cout << "generated fingerprint \n";
32.21 cout << user_again->fpr << "\n";
32.22
32.23 - TEST_ASSERT(strcmp(user->fpr, user_again->fpr) != 0);
32.24 + TEST_ASSERT_MSG((strcmp(user->fpr, user_again->fpr) != 0), "strcmp(user->fpr, user_again->fpr) != 0");
32.25 update_identity(session, user);
32.26 - TEST_ASSERT(strcmp(user->fpr, keypair1) == 0);
32.27 + TEST_ASSERT_MSG((strcmp(user->fpr, keypair1) == 0), "strcmp(user->fpr, keypair1) == 0");
32.28 cout << "Key 1 (" << user->fpr << ") is still the default for the identity after update_identity." << endl;
32.29
32.30 // First, trust the SECOND key; make sure it replaces as the default
32.31 cout << "Set trust bit for key 2 (" << keypair2 << ") and ensure it replaces key 1 as the default." << endl;
32.32 status = trust_personal_key(session, user_again);
32.33 status = update_identity(session, user);
32.34 - TEST_ASSERT(user->comm_type == PEP_ct_OpenPGP);
32.35 - TEST_ASSERT(strcmp(user->fpr, keypair2) == 0);
32.36 + TEST_ASSERT_MSG((user->comm_type == PEP_ct_OpenPGP), "user->comm_type == PEP_ct_OpenPGP");
32.37 + TEST_ASSERT_MSG((strcmp(user->fpr, keypair2) == 0), "strcmp(user->fpr, keypair2) == 0");
32.38 cout << "Key 2 (" << user->fpr << ") is now the default for the identity after update_identity, and its comm_type is PEP_ct_OpenPGP (trust bit set!)." << endl;
32.39
32.40 cout << "Now make key 2 not trusted (which also removes it as a default everywhere)." << endl;
32.41 status = key_reset_trust(session, user);
32.42 status = get_trust(session, user);
32.43 - TEST_ASSERT(strcmp(user->fpr, keypair2) == 0);
32.44 - TEST_ASSERT(user->comm_type == PEP_ct_OpenPGP_unconfirmed);
32.45 + TEST_ASSERT_MSG((strcmp(user->fpr, keypair2) == 0), "strcmp(user->fpr, keypair2) == 0");
32.46 + TEST_ASSERT_MSG((user->comm_type == PEP_ct_OpenPGP_unconfirmed), "user->comm_type == PEP_ct_OpenPGP_unconfirmed");
32.47 cout << "Key 2 is untrusted in the DB." << endl;
32.48
32.49 cout << "Now let's mistrust key 2 in the DB." << endl;
32.50 // Now let's mistrust the second key.
32.51 status = key_mistrusted(session, user);
32.52 status = get_trust(session, user);
32.53 - TEST_ASSERT(strcmp(user->fpr, keypair2) == 0);
32.54 - TEST_ASSERT(user->comm_type == PEP_ct_mistrusted);
32.55 + TEST_ASSERT_MSG((strcmp(user->fpr, keypair2) == 0), "strcmp(user->fpr, keypair2) == 0");
32.56 + TEST_ASSERT_MSG((user->comm_type == PEP_ct_mistrusted), "user->comm_type == PEP_ct_mistrusted");
32.57 cout << "Hoorah, we now do not trust key 2. (We never liked key 2 anyway.)" << endl;
32.58 cout << "Now we call update_identity to see what gifts it gives us (should be key 1 with key 1's initial trust.)" << endl;
32.59 status = update_identity(session, user);
32.60 - TEST_ASSERT(strcmp(user->fpr, keypair1) == 0);
32.61 - TEST_ASSERT(user->comm_type == PEP_ct_OpenPGP_unconfirmed);
32.62 + TEST_ASSERT_MSG((strcmp(user->fpr, keypair1) == 0), "strcmp(user->fpr, keypair1) == 0");
32.63 + TEST_ASSERT_MSG((user->comm_type == PEP_ct_OpenPGP_unconfirmed), "user->comm_type == PEP_ct_OpenPGP_unconfirmed");
32.64 cout << "Yup, got key 1, and the trust status is PEP_ct_OpenPGP_unconfirmed." << endl;
32.65
32.66 cout << "Let's mistrust key 1 too. It's been acting shifty lately." << endl;
32.67 status = key_mistrusted(session, user);
32.68 status = get_trust(session, user);
32.69 - TEST_ASSERT(strcmp(user->fpr, keypair1) == 0);
32.70 - TEST_ASSERT(user->comm_type == PEP_ct_mistrusted);
32.71 + TEST_ASSERT_MSG((strcmp(user->fpr, keypair1) == 0), "strcmp(user->fpr, keypair1) == 0");
32.72 + TEST_ASSERT_MSG((user->comm_type == PEP_ct_mistrusted), "user->comm_type == PEP_ct_mistrusted");
32.73 cout << "Hoorah, we now do not trust key 1. (TRUST NO ONE)" << endl;
32.74 cout << "Now we call update_identity to see what gifts it gives us (should be an empty key and a key not found comm_type.)" << endl;
32.75 status = update_identity(session, user);
32.76 - TEST_ASSERT(user->fpr == NULL);
32.77 - TEST_ASSERT(user->comm_type == PEP_ct_key_not_found);
32.78 + TEST_ASSERT_MSG((user->fpr == NULL), "user->fpr == NULL");
32.79 + TEST_ASSERT_MSG((user->comm_type == PEP_ct_key_not_found), "user->comm_type == PEP_ct_key_not_found");
32.80 cout << "Yup, we trust no keys from " << uniqname << endl;
32.81
32.82 cout << "TODO: Add cases where we have multiple user_ids addressing a single key, and multiple identities with that key + mistrust" << endl;
33.1 --- a/test/src/engine_tests/TrustwordsTests.cc Wed May 09 10:22:22 2018 +0200
33.2 +++ b/test/src/engine_tests/TrustwordsTests.cc Wed May 09 11:39:10 2018 +0200
33.3 @@ -53,7 +53,7 @@
33.4
33.5 cout << "\nfinding German trustwords for " << fingerprint1 << "...\n";
33.6 trustwords(session, fingerprint1.c_str(), "de", &words1, &wsize1, 5);
33.7 - TEST_ASSERT(words1);
33.8 + TEST_ASSERT_MSG((words1), "words1");
33.9 cout << words1 << "\n";
33.10
33.11 free(words1);
33.12 @@ -61,7 +61,7 @@
33.13
33.14 cout << "\nfinding German trustwords for " << fingerprint2 << "...\n";
33.15 trustwords(session, fingerprint2.c_str(), "de", &words2, &wsize2, 5);
33.16 - TEST_ASSERT(words2);
33.17 + TEST_ASSERT_MSG((words2), "words2");
33.18 cout << words2 << "\n";
33.19
33.20 free(words2);
33.21 @@ -69,7 +69,7 @@
33.22
33.23 cout << "\nfinding German trustwords for " << identity1->address << " and " << identity2->address << "...\n";
33.24 get_trustwords(session, identity1, identity2, "de", &full_wordlist, &wsize_full, false);
33.25 - TEST_ASSERT(full_wordlist);
33.26 + TEST_ASSERT_MSG((full_wordlist), "full_wordlist");
33.27 cout << full_wordlist << "\n";
33.28
33.29 free(full_wordlist);
33.30 @@ -77,7 +77,7 @@
33.31
33.32 cout << "\nfinding English trustwords for " << identity1->address << " and " << identity2->address << "... with spaces\n";
33.33 get_trustwords(session, identity1, identity2_with_spaces, "en", &full_wordlist, &wsize_full, false);
33.34 - TEST_ASSERT(full_wordlist);
33.35 + TEST_ASSERT_MSG((full_wordlist), "full_wordlist");
33.36 cout << full_wordlist << "\n";
33.37
33.38 free(full_wordlist);
33.39 @@ -87,17 +87,17 @@
33.40
33.41 cout << "\nfinding French trustwords for " << fingerprint2 << "...\n";
33.42 trustwords(session, fingerprint1.c_str(), "fr", &words1, &wsize1, 5);
33.43 - TEST_ASSERT(words1);
33.44 + TEST_ASSERT_MSG((words1), "words1");
33.45 cout << words1 << "\n";
33.46
33.47 cout << "\nfinding French trustwords for " << identity2->address << " and " << identity2->address << "...\n";
33.48 status = get_trustwords(session, identity2, identity2, "fr", &full_wordlist, &wsize_full, false);
33.49 - TEST_ASSERT(status == PEP_TRUSTWORDS_DUPLICATE_FPR);
33.50 + TEST_ASSERT_MSG((status == PEP_TRUSTWORDS_DUPLICATE_FPR), "status == PEP_TRUSTWORDS_DUPLICATE_FPR");
33.51 cout << "Discovered duplicate fprs as desired" << endl;
33.52
33.53 cout << "\nfinding English trustwords for " << identity2->address << " and " << identity2->address << "... with spaces\n";
33.54 get_trustwords(session, identity2, identity2_with_spaces, "en", &full_wordlist, &wsize_full, false);
33.55 - TEST_ASSERT(status == PEP_TRUSTWORDS_DUPLICATE_FPR);
33.56 + TEST_ASSERT_MSG((status == PEP_TRUSTWORDS_DUPLICATE_FPR), "status == PEP_TRUSTWORDS_DUPLICATE_FPR");
33.57 cout << "Discovered duplicate fprs as desired" << endl;
33.58
33.59 pEp_free(words1);
33.60 @@ -109,22 +109,22 @@
33.61
33.62 cout << "\nfinding English trustwords for " << fingerprint2 << "...\n";
33.63 trustwords(session, fingerprint2.c_str(), "en", &words1, &wsize1, 0);
33.64 - TEST_ASSERT(words1);
33.65 + TEST_ASSERT_MSG((words1), "words1");
33.66 cout << words1 << "\n";
33.67
33.68 cout << "\nfinding English trustwords for " << fingerprint1 << "...\n";
33.69 trustwords(session, fingerprint1.c_str(), "en", &words2, &wsize2, 0);
33.70 - TEST_ASSERT(words2);
33.71 + TEST_ASSERT_MSG((words2), "words2");
33.72 cout << words2 << "\n";
33.73
33.74 cout << "\nfinding English trustwords for " << identity2->address << " and " << identity1->address << "...\n";
33.75 get_trustwords(session, identity2, identity1, "en", &full_wordlist, &wsize_full, true);
33.76 - TEST_ASSERT(full_wordlist);
33.77 + TEST_ASSERT_MSG((full_wordlist), "full_wordlist");
33.78 cout << full_wordlist << "\n";
33.79
33.80 cout << "\nfinding English trustwords for " << identity2->address << " and " << identity1->address << "... with spaces\n";
33.81 get_trustwords(session, identity2_with_spaces, identity1, "en", &full_wordlist, &wsize_full, true);
33.82 - TEST_ASSERT(full_wordlist);
33.83 + TEST_ASSERT_MSG((full_wordlist), "full_wordlist");
33.84 cout << full_wordlist << "\n";
33.85
33.86 pEp_free(words1);
33.87 @@ -160,17 +160,17 @@
33.88
33.89 cout << "\nfinding Catalan trustwords for " << fingerprint3 << "...\n";
33.90 trustwords(session, fingerprint3.c_str(), "ca", &words1, &wsize1, 0);
33.91 - TEST_ASSERT(words1);
33.92 + TEST_ASSERT_MSG((words1), "words1");
33.93 cout << words1 << "\n";
33.94
33.95 cout << "\nfinding Catalan trustwords for " << fingerprint4 << "...\n";
33.96 trustwords(session, fingerprint4.c_str(), "ca", &words2, &wsize2, 0);
33.97 - TEST_ASSERT(words2);
33.98 + TEST_ASSERT_MSG((words2), "words2");
33.99 cout << words2 << "\n";
33.100
33.101 cout << "\nfinding Catalan trustwords for " << identity3->address << " and " << identity4->address << "...\n";
33.102 get_trustwords(session, identity3, identity4, "ca", &full_wordlist, &wsize_full, true);
33.103 - TEST_ASSERT(full_wordlist);
33.104 + TEST_ASSERT_MSG((full_wordlist), "full_wordlist");
33.105 cout << full_wordlist << "\n";
33.106
33.107 pEp_free(words1);
33.108 @@ -184,17 +184,17 @@
33.109
33.110 cout << "\nfinding Turkish trustwords for " << fingerprint4 << "...\n";
33.111 trustwords(session, fingerprint4.c_str(), "tr", &words1, &wsize1, 5);
33.112 - TEST_ASSERT(words1);
33.113 + TEST_ASSERT_MSG((words1), "words1");
33.114 cout << words1 << "\n";
33.115
33.116 cout << "\nfinding Turkish trustwords for " << fingerprint5 << "...\n";
33.117 trustwords(session, fingerprint5.c_str(), "tr", &words2, &wsize2, 5);
33.118 - TEST_ASSERT(words2);
33.119 + TEST_ASSERT_MSG((words2), "words2");
33.120 cout << words2 << "\n";
33.121
33.122 cout << "\nfinding Turkish trustwords for " << identity4->address << " and " << identity5->address << "...\n";
33.123 get_trustwords(session, identity4, identity5, "tr", &full_wordlist, &wsize_full, false);
33.124 - TEST_ASSERT(full_wordlist);
33.125 + TEST_ASSERT_MSG((full_wordlist), "full_wordlist");
33.126 cout << full_wordlist << "\n";
33.127
33.128 pEp_free(words1);
33.129 @@ -214,7 +214,7 @@
33.130
33.131 cout << "\nfinding Turkish trustwords for " << identity5->address << " and " << identity6->address << "...\n";
33.132 PEP_STATUS status6 = get_trustwords(session, identity5, identity6, "tr", &full_wordlist, &wsize_full, false);
33.133 - TEST_ASSERT(status6 == PEP_STATUS_OK);
33.134 + TEST_ASSERT_MSG((status6 == PEP_STATUS_OK), "status6 == PEP_STATUS_OK");
33.135 cout << full_wordlist << endl;
33.136
33.137 pEp_identity* identity7 = new_identity(
33.138 @@ -227,7 +227,7 @@
33.139
33.140 cout << "\nfinding Turkish trustwords for " << identity1->address << " and " << identity7->address << "...\n";
33.141 PEP_STATUS status7 = get_trustwords(session, identity1, identity7, "tr", &full_wordlist, &wsize_full, true);
33.142 - TEST_ASSERT(status7 == PEP_ILLEGAL_VALUE);
33.143 + TEST_ASSERT_MSG((status7 == PEP_ILLEGAL_VALUE), "status7 == PEP_ILLEGAL_VALUE");
33.144 cout << "Illegal digit value correctly recognised." << "\n";
33.145
33.146
34.1 --- a/test/src/engine_tests/UserIDAliasTests.cc Wed May 09 10:22:22 2018 +0200
34.2 +++ b/test/src/engine_tests/UserIDAliasTests.cc Wed May 09 11:39:10 2018 +0200
34.3 @@ -32,8 +32,8 @@
34.4
34.5 PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
34.6 PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
34.7 - TEST_ASSERT(statuspub == PEP_STATUS_OK);
34.8 - TEST_ASSERT(statuspriv == PEP_STATUS_OK);
34.9 + TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
34.10 + TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
34.11
34.12 pEp_identity* alice = new_identity("pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", PEP_OWN_USERID, "Alice Test");
34.13
34.14 @@ -47,39 +47,39 @@
34.15
34.16 cout << "First, set up an identity with PEP_OWN_USERID as user_id." << endl;
34.17 status = myself(session, alice);
34.18 - TEST_ASSERT(status == PEP_STATUS_OK);
34.19 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
34.20 cout << "After myself, user_id is " << alice->user_id << endl;
34.21 - TEST_ASSERT(strcmp(alice->user_id, own_id) == 0);
34.22 + TEST_ASSERT_MSG((strcmp(alice->user_id, own_id) == 0), "strcmp(alice->user_id, own_id) == 0");
34.23
34.24 cout << "Now set up an identity with " << alias1 << " as user_id." << endl;
34.25 free(alice->user_id);
34.26
34.27 alice->user_id = strdup(alias1);
34.28 status = myself(session, alice);
34.29 - TEST_ASSERT(status == PEP_STATUS_OK);
34.30 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
34.31 cout << "After myself, user_id is " << alice->user_id << endl;
34.32 - TEST_ASSERT(strcmp(alice->user_id, own_id) == 0);
34.33 + TEST_ASSERT_MSG((strcmp(alice->user_id, own_id) == 0), "strcmp(alice->user_id, own_id) == 0");
34.34
34.35 cout << "Now set up an identity with " << alias2 << " as user_id." << endl;
34.36 free(alice->user_id);
34.37
34.38 alice->user_id = strdup(alias2);
34.39 status = myself(session, alice);
34.40 - TEST_ASSERT(status == PEP_STATUS_OK);
34.41 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
34.42 cout << "After myself, user_id is " << alice->user_id << endl;
34.43 - TEST_ASSERT(strcmp(alice->user_id, own_id) == 0);
34.44 + TEST_ASSERT_MSG((strcmp(alice->user_id, own_id) == 0), "strcmp(alice->user_id, own_id) == 0");
34.45
34.46 char* default_id = NULL;
34.47 status = get_userid_alias_default(session, alias1, &default_id);
34.48 - TEST_ASSERT(status == PEP_STATUS_OK);
34.49 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
34.50 cout << "Default user_id for " << alias1 << " is " << default_id << endl;
34.51 - TEST_ASSERT(strcmp(default_id, own_id) == 0);
34.52 + TEST_ASSERT_MSG((strcmp(default_id, own_id) == 0), "strcmp(default_id, own_id) == 0");
34.53
34.54 free(default_id);
34.55 default_id = NULL;
34.56 status = get_userid_alias_default(session, alias2, &default_id);
34.57 - TEST_ASSERT(status == PEP_STATUS_OK);
34.58 + TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
34.59 cout << "Default user_id for " << alias2 << " is " << default_id << endl;
34.60 - TEST_ASSERT(strcmp(default_id, own_id) == 0);
34.61 + TEST_ASSERT_MSG((strcmp(default_id, own_id) == 0), "strcmp(default_id, own_id) == 0");
34.62
34.63 }