summaryrefslogtreecommitdiff
path: root/auto_tests
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-06-28 14:15:44 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-06-29 18:25:44 +0000
commitb9a75d98b2c0107684bfb5a127eabba5bbb3b2b3 (patch)
tree7cc3105079dec7545acdfa82067c707ab8331b4f /auto_tests
parent86a6b17555cadcc9528429cc24278b13f30c7b2b (diff)
Remove broken conference tests.
These display some idea, but the tests are not implemented correctly. We will need to implement the idea correctly later, but for now we can't use these.
Diffstat (limited to 'auto_tests')
-rw-r--r--auto_tests/BUILD.bazel2
-rw-r--r--auto_tests/monolith_test.cc8
-rw-r--r--auto_tests/self_conference_title_change_test.c88
-rw-r--r--auto_tests/selfname_change_conference_test.c94
4 files changed, 1 insertions, 191 deletions
diff --git a/auto_tests/BUILD.bazel b/auto_tests/BUILD.bazel
index af8920b1..7b0cab7d 100644
--- a/auto_tests/BUILD.bazel
+++ b/auto_tests/BUILD.bazel
@@ -33,7 +33,7 @@ cc_library(
33cc_test( 33cc_test(
34 name = "monolith_test", 34 name = "monolith_test",
35 size = "small", 35 size = "small",
36 srcs = ["monolith_test.cpp"], 36 srcs = ["monolith_test.cc"],
37 copts = ["-Wno-sign-compare"], 37 copts = ["-Wno-sign-compare"],
38 deps = [ 38 deps = [
39 ":helpers", 39 ":helpers",
diff --git a/auto_tests/monolith_test.cc b/auto_tests/monolith_test.cc
index 9fa7ee26..d89c7625 100644
--- a/auto_tests/monolith_test.cc
+++ b/auto_tests/monolith_test.cc
@@ -89,14 +89,6 @@ namespace save_load_test {
89int main(void); 89int main(void);
90#include "save_load_test.c" 90#include "save_load_test.c"
91} // namespace save_load_test 91} // namespace save_load_test
92namespace selfname_change_conference_test {
93int main(void);
94#include "selfname_change_conference_test.c"
95} // namespace selfname_change_conference_test
96namespace self_conference_title_change_test {
97int main(void);
98#include "self_conference_title_change_test.c"
99} // namespace self_conference_title_change_test
100namespace send_message_test { 92namespace send_message_test {
101int main(void); 93int main(void);
102#include "send_message_test.c" 94#include "send_message_test.c"
diff --git a/auto_tests/self_conference_title_change_test.c b/auto_tests/self_conference_title_change_test.c
deleted file mode 100644
index 706c1338..00000000
--- a/auto_tests/self_conference_title_change_test.c
+++ /dev/null
@@ -1,88 +0,0 @@
1/* self_conference_title_change.c
2 *
3 * Small test for checking if obtaining savedata, saving it to disk and using
4 * works correctly.
5 *
6 * Copyright (C) 2017 Tox project All Rights Reserved.
7 *
8 * This file is part of Tox.
9 *
10 * Tox is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Tox is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
22 *
23 */
24#ifndef _XOPEN_SOURCE
25#define _XOPEN_SOURCE 600
26#endif
27
28#include <stdio.h>
29#include <stdlib.h>
30#include <string.h>
31#include <time.h>
32
33#include "../toxcore/tox.h"
34#include "../toxencryptsave/toxencryptsave.h"
35
36#include "helpers.h"
37
38static const char *newtitle = "kitten over darknet";
39
40static void cbtitlechange(Tox *tox, uint32_t conference_number, uint32_t peer_number, const uint8_t *title,
41 size_t length, void *user_data)
42{
43 if (!memcmp(title, newtitle, tox_conference_get_title_size(tox, conference_number, nullptr))) {
44 printf("success: title was changed and updated in the conference");
45 exit(0);
46 }
47}
48
49int main(void)
50{
51 setvbuf(stdout, nullptr, _IONBF, 0);
52
53 uint32_t conference_number;
54 struct Tox_Options *to = tox_options_new(nullptr);
55 Tox *t;
56 TOX_ERR_CONFERENCE_NEW conference_err;
57 TOX_ERR_CONFERENCE_TITLE title_err;
58
59 t = tox_new_log(to, nullptr, nullptr);
60 tox_options_free(to);
61
62 tox_callback_conference_title(t, &cbtitlechange);
63
64 if ((conference_number = tox_conference_new(t, &conference_err)) == UINT32_MAX) {
65 tox_kill(t);
66 fprintf(stderr, "error: could not create new conference, error code %d\n", conference_err);
67 return 2;
68 }
69
70 tox_iterate(t, nullptr);
71 c_sleep(tox_iteration_interval(t));
72
73 if (!tox_conference_set_title(t, conference_number, (const uint8_t *)newtitle, strlen(newtitle), &title_err)) {
74 tox_kill(t);
75 fprintf(stderr, "error: could not set conference title, error code %d\n", title_err);
76 return 3;
77 }
78
79 tox_iterate(t, nullptr);
80 c_sleep(tox_iteration_interval(t));
81 tox_iterate(t, nullptr);
82
83 fprintf(stderr, "error: title was not changed in callback. exiting.\n");
84
85 tox_kill(t);
86
87 return 1;
88}
diff --git a/auto_tests/selfname_change_conference_test.c b/auto_tests/selfname_change_conference_test.c
deleted file mode 100644
index dadfbeb6..00000000
--- a/auto_tests/selfname_change_conference_test.c
+++ /dev/null
@@ -1,94 +0,0 @@
1/* selfname_change_conference_test.c
2 *
3 * Small test for checking if obtaining savedata, saving it to disk and using
4 * works correctly.
5 *
6 * Copyright (C) 2017 Tox project All Rights Reserved.
7 *
8 * This file is part of Tox.
9 *
10 * Tox is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Tox is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
22 *
23 */
24#ifndef _XOPEN_SOURCE
25#define _XOPEN_SOURCE 600
26#endif
27
28#include <stdio.h>
29#include <stdlib.h>
30#include <string.h>
31#include <time.h>
32
33#include "helpers.h"
34
35#include "../toxcore/tox.h"
36#include "../toxencryptsave/toxencryptsave.h"
37
38static const char *newname = "chris";
39
40static void cbconfmembers(Tox *tox, uint32_t conference_number, uint32_t peer_number,
41 const uint8_t *name, size_t length,
42 void *user_data)
43{
44 uint8_t new_peer_name[TOX_MAX_NAME_LENGTH + 1];
45
46 if (!tox_conference_peer_get_name(tox, conference_number, peer_number, new_peer_name, nullptr)) {
47 return;
48 }
49
50 if (!memcmp(newname, new_peer_name, tox_conference_peer_get_name_size(tox, conference_number, peer_number, nullptr))) {
51 printf("success: own name was changed and updated in the conference");
52 exit(0);
53 }
54}
55
56int main(void)
57{
58 setvbuf(stdout, nullptr, _IONBF, 0);
59
60 struct Tox_Options *to = tox_options_new(nullptr);
61 Tox *t;
62 TOX_ERR_CONFERENCE_NEW conference_err;
63 TOX_ERR_SET_INFO name_err;
64
65 t = tox_new_log(to, nullptr, nullptr);
66 tox_options_free(to);
67
68 tox_callback_conference_peer_name(t, cbconfmembers);
69
70 if (tox_conference_new(t, &conference_err) == UINT32_MAX) {
71 tox_kill(t);
72 fprintf(stderr, "error: could not create new conference, error code %d\n", conference_err);
73 return 2;
74 }
75
76 tox_iterate(t, nullptr);
77 c_sleep(tox_iteration_interval(t));
78
79 if (!tox_self_set_name(t, (const uint8_t *)newname, strlen(newname), &name_err)) {
80 tox_kill(t);
81 fprintf(stderr, "error: could not set own name, error code %d\n", name_err);
82 return 3;
83 }
84
85 tox_iterate(t, nullptr);
86 c_sleep(tox_iteration_interval(t));
87 tox_iterate(t, nullptr);
88
89 fprintf(stderr, "error: name was not changed in callback. exiting.\n");
90
91 tox_kill(t);
92
93 return 1;
94}