aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_group_session.cpp46
1 files changed, 40 insertions, 6 deletions
diff --git a/tests/test_group_session.cpp b/tests/test_group_session.cpp
index 9081293..b9fe1ef 100644
--- a/tests/test_group_session.cpp
+++ b/tests/test_group_session.cpp
@@ -18,16 +18,50 @@
int main() {
-uint8_t random_bytes[] =
- "0123456789ABDEF0123456789ABCDEF"
- "0123456789ABDEF0123456789ABCDEF"
- "0123456789ABDEF0123456789ABCDEF"
- "0123456789ABDEF0123456789ABCDEF"
- "0123456789ABDEF0123456789ABCDEF";
+{
+
+ TestCase test_case("Pickle outbound group");
+
+ size_t size = olm_outbound_group_session_size();
+ void *memory = alloca(size);
+ OlmOutboundGroupSession *session = olm_outbound_group_session(memory);
+
+ size_t pickle_length = olm_pickle_outbound_group_session_length(session);
+ uint8_t pickle1[pickle_length];
+ olm_pickle_outbound_group_session(session,
+ "secret_key", 10,
+ pickle1, pickle_length);
+ uint8_t pickle2[pickle_length];
+ memcpy(pickle2, pickle1, pickle_length);
+
+ uint8_t buffer2[size];
+ OlmOutboundGroupSession *session2 = olm_outbound_group_session(buffer2);
+ size_t res = olm_unpickle_outbound_group_session(session2,
+ "secret_key", 10,
+ pickle2, pickle_length);
+ assert_not_equals((size_t)-1, res);
+ assert_equals(pickle_length,
+ olm_pickle_outbound_group_session_length(session2));
+ olm_pickle_outbound_group_session(session2,
+ "secret_key", 10,
+ pickle2, pickle_length);
+
+ assert_equals(pickle1, pickle2, pickle_length);
+}
+
{
TestCase test_case("Group message send/receive");
+ uint8_t random_bytes[] =
+ "0123456789ABDEF0123456789ABCDEF"
+ "0123456789ABDEF0123456789ABCDEF"
+ "0123456789ABDEF0123456789ABCDEF"
+ "0123456789ABDEF0123456789ABCDEF"
+ "0123456789ABDEF0123456789ABCDEF";
+
+
+
size_t size = olm_outbound_group_session_size();
void *memory = alloca(size);
OlmOutboundGroupSession *session = olm_outbound_group_session(memory);