diff options
author | Richard van der Hoff <github@rvanderhoff.org.uk> | 2016-10-24 10:43:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-24 10:43:43 +0100 |
commit | d8136096c045c08b6348d28ad423dec567fa4d7d (patch) | |
tree | d8c8d3894543ee95224a92c519ecdd5c3f6902e3 /tests/test_olm.cpp | |
parent | 8de0f1fbb3df0adf8dd8e9db1099eacc0edfecc9 (diff) | |
parent | a7310c5821513d5c5b0609ec506dad1ae51603d3 (diff) |
Merge pull request #33 from matrix-org/rav/pickle_length
Return the base64-encoded length of pickles
Diffstat (limited to 'tests/test_olm.cpp')
-rw-r--r-- | tests/test_olm.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/test_olm.cpp b/tests/test_olm.cpp index af2c9f7..4619558 100644 --- a/tests/test_olm.cpp +++ b/tests/test_olm.cpp @@ -49,7 +49,9 @@ mock_random(ot_random, sizeof(ot_random)); std::size_t pickle_length = ::olm_pickle_account_length(account); std::uint8_t pickle1[pickle_length]; -::olm_pickle_account(account, "secret_key", 10, pickle1, pickle_length); +std::size_t res = ::olm_pickle_account(account, "secret_key", 10, pickle1, pickle_length); +assert_equals(pickle_length, res); + std::uint8_t pickle2[pickle_length]; std::memcpy(pickle2, pickle1, pickle_length); @@ -59,10 +61,10 @@ assert_not_equals(std::size_t(-1), ::olm_unpickle_account( account2, "secret_key", 10, pickle2, pickle_length )); assert_equals(pickle_length, ::olm_pickle_account_length(account2)); -::olm_pickle_account(account2, "secret_key", 10, pickle2, pickle_length); +res = ::olm_pickle_account(account2, "secret_key", 10, pickle2, pickle_length); +assert_equals(pickle_length, res); assert_equals(pickle1, pickle2, pickle_length); - } @@ -122,7 +124,9 @@ mock_random(random2, sizeof(random2)); std::size_t pickle_length = ::olm_pickle_session_length(session); std::uint8_t pickle1[pickle_length]; -::olm_pickle_session(session, "secret_key", 10, pickle1, pickle_length); +std::size_t res = ::olm_pickle_session(session, "secret_key", 10, pickle1, pickle_length); +assert_equals(pickle_length, res); + std::uint8_t pickle2[pickle_length]; std::memcpy(pickle2, pickle1, pickle_length); @@ -132,10 +136,10 @@ assert_not_equals(std::size_t(-1), ::olm_unpickle_session( session2, "secret_key", 10, pickle2, pickle_length )); assert_equals(pickle_length, ::olm_pickle_session_length(session2)); -::olm_pickle_session(session2, "secret_key", 10, pickle2, pickle_length); +res = ::olm_pickle_session(session2, "secret_key", 10, pickle2, pickle_length); +assert_equals(pickle_length, res); assert_equals(pickle1, pickle2, pickle_length); - } { /** Loopback test */ |