summary refs log tree commit diff stats
path: root/libotr/libotr-4.1.1/tests/unit/test_userstate.c
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2021-04-09 07:19:03 -0300
committerSoniEx2 <endermoneymod@gmail.com>2021-04-09 07:19:03 -0300
commit0e752a6e215aee21dc73da097c3225495d54a5b6 (patch)
treeb81be02cbf2f06aebf322ac4a5d014b44176bba5 /libotr/libotr-4.1.1/tests/unit/test_userstate.c
parent7754076c715285173311a1b6811ce377950e18a6 (diff)
Add libotr/etc sources
Diffstat (limited to 'libotr/libotr-4.1.1/tests/unit/test_userstate.c')
-rw-r--r--libotr/libotr-4.1.1/tests/unit/test_userstate.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/libotr/libotr-4.1.1/tests/unit/test_userstate.c b/libotr/libotr-4.1.1/tests/unit/test_userstate.c
new file mode 100644
index 0000000..62e996e
--- /dev/null
+++ b/libotr/libotr-4.1.1/tests/unit/test_userstate.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2014 - Julien Voisin <julien.voisin@dustri.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License, version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <gcrypt.h>
+#include <pthread.h>
+
+#include <userstate.h>
+#include <proto.h>
+
+#include <tap/tap.h>
+
+GCRY_THREAD_OPTION_PTHREAD_IMPL;
+
+#define NUM_TESTS 1
+
+static void test_otrl_userstate_create()
+{
+	OtrlUserState us = otrl_userstate_create();
+	ok(us->context_root == NULL &&
+			us->privkey_root == NULL &&
+			us->instag_root == NULL &&
+			us->pending_root == NULL &&
+			us->timer_running == 0,
+			"OtrlUserState ok");
+	otrl_userstate_free(us);
+}
+
+int main(int argc, char** argv)
+{
+	plan_tests(NUM_TESTS);
+
+	gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+	OTRL_INIT;
+
+	test_otrl_userstate_create();
+
+	return 0;
+}