summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--auto_tests/check_compat.h1
-rw-r--r--auto_tests/conference_two_test.c30
3 files changed, 32 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19dcacff..431faf89 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -498,6 +498,7 @@ endif()
498auto_test(TCP) 498auto_test(TCP)
499auto_test(bootstrap) 499auto_test(bootstrap)
500auto_test(conference) 500auto_test(conference)
501auto_test(conference_two)
501auto_test(crypto MSVC_DONT_BUILD) 502auto_test(crypto MSVC_DONT_BUILD)
502auto_test(dht MSVC_DONT_BUILD) 503auto_test(dht MSVC_DONT_BUILD)
503auto_test(encryptsave) 504auto_test(encryptsave)
diff --git a/auto_tests/check_compat.h b/auto_tests/check_compat.h
index badf18c8..9e174287 100644
--- a/auto_tests/check_compat.h
+++ b/auto_tests/check_compat.h
@@ -5,6 +5,7 @@
5 5
6#include <stdbool.h> 6#include <stdbool.h>
7#include <stdio.h> 7#include <stdio.h>
8#include <stdlib.h>
8 9
9#define START_TEST(name) static void name(void) 10#define START_TEST(name) static void name(void)
10#define END_TEST 11#define END_TEST
diff --git a/auto_tests/conference_two_test.c b/auto_tests/conference_two_test.c
new file mode 100644
index 00000000..c3036165
--- /dev/null
+++ b/auto_tests/conference_two_test.c
@@ -0,0 +1,30 @@
1// This test checks that we can create two conferences and quit properly.
2//
3// This test triggers a different code path than if we only allocate a single
4// conference. This is the simplest test possible that triggers it.
5#ifndef _XOPEN_SOURCE
6#define _XOPEN_SOURCE 600
7#endif
8
9#include "../toxcore/tox.h"
10
11#include "check_compat.h"
12#include "helpers.h"
13
14int main(void)
15{
16 // Create toxes.
17 uint32_t id = 1;
18 Tox *tox1 = tox_new_log(nullptr, nullptr, &id);
19
20 // Create two conferences and then exit.
21 TOX_ERR_CONFERENCE_NEW err;
22 tox_conference_new(tox1, &err);
23 ck_assert_msg(err == TOX_ERR_CONFERENCE_NEW_OK, "failed to create conference 1: %d", err);
24 tox_conference_new(tox1, &err);
25 ck_assert_msg(err == TOX_ERR_CONFERENCE_NEW_OK, "failed to create conference 2: %d", err);
26
27 tox_kill(tox1);
28
29 return 0;
30}